diff --git a/.php_cs b/.php_cs index 7ae5d11f4ad1c9c4d65a3b9b59644885e99b327e..743cab6ee0d17db99cfd1373cf35f246772921fe 100644 --- a/.php_cs +++ b/.php_cs @@ -15,7 +15,6 @@ $finder = Symfony\CS\Finder\DefaultFinder::create() ->exclude('dev/tests/functional/vendor') ->exclude('dev/tests/integration/tmp') ->exclude('dev/tests/integration/var') - ->exclude('lib/internal/Apache') ->exclude('lib/internal/CardinalCommerce') ->exclude('lib/internal/Cm') ->exclude('lib/internal/Credis') diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php index e55da17969880f938970e312edb04d7670fd0506..c40ff5a1659cc1512af4efef6c2185ae5f7f559c 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php @@ -8,24 +8,56 @@ namespace Magento\AdminNotification\Controller\Adminhtml\System\Message; class ListAction extends \Magento\Backend\App\AbstractAction { + /** + * @var \Magento\Framework\Json\Helper\Data + */ + protected $jsonHelper; + + /** + * @var \Magento\AdminNotification\Model\Resource\System\Message\Collection + */ + protected $messageCollection; + + /** + * Initialize ListAction + * + * @param \Magento\Backend\App\Action\Context $context + * @param \Magento\Framework\Json\Helper\Data $jsonHelper + * @param \Magento\AdminNotification\Model\Resource\System\Message\Collection $messageCollection + */ + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Framework\Json\Helper\Data $jsonHelper, + \Magento\AdminNotification\Model\Resource\System\Message\Collection $messageCollection + ) { + $this->jsonHelper = $jsonHelper; + $this->messageCollection = $messageCollection; + parent::__construct($context); + } + /** * @return void */ public function execute() { $severity = $this->getRequest()->getParam('severity'); - $messageCollection = $this->_objectManager->get( - 'Magento\AdminNotification\Model\Resource\System\Message\Collection' - ); if ($severity) { - $messageCollection->setSeverity($severity); + $this->messageCollection->setSeverity($severity); } $result = []; - foreach ($messageCollection->getItems() as $item) { - $result[] = ['severity' => $item->getSeverity(), 'text' => $item->getText()]; + foreach ($this->messageCollection->getItems() as $item) { + $result[] = [ + 'severity' => $item->getSeverity(), + 'text' => $item->getText(), + ]; + } + if (empty($result)) { + $result[] = [ + 'severity' => (string)\Magento\Framework\Notification\MessageInterface::SEVERITY_NOTICE, + 'text' => 'You have viewed and resolved all recent system notices. ' + . 'Please refresh the web page to clear the notice alert.', + ]; } - $this->getResponse()->representJson( - $this->_objectManager->get('Magento\Framework\Json\Helper\Data')->jsonEncode($result) - ); + $this->getResponse()->representJson($this->jsonHelper->jsonEncode($result)); } } diff --git a/app/code/Magento/AdminNotification/etc/config.xml b/app/code/Magento/AdminNotification/etc/config.xml index 35643f62753d250562fa1f5c9f4e568ebb00f059..63c65f9ed9bfe8f6a121cc171d1778eac64f7652 100644 --- a/app/code/Magento/AdminNotification/etc/config.xml +++ b/app/code/Magento/AdminNotification/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <system> <adminnotification> diff --git a/app/code/Magento/AdminNotification/etc/module.xml b/app/code/Magento/AdminNotification/etc/module.xml index cfc791e9072d98610989d0585f175278b306f91a..dd60aeb295b79ab9516a5482f221a1748bf27382 100644 --- a/app/code/Magento/AdminNotification/etc/module.xml +++ b/app/code/Magento/AdminNotification/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_AdminNotification" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Authorization/Setup/InstallData.php b/app/code/Magento/Authorization/Setup/InstallData.php index 68c2f5fdc469da597e3c0987b19306c5ebe7cd37..17fd1fd4039e10dad8ee75e402265cc6d7504f88 100644 --- a/app/code/Magento/Authorization/Setup/InstallData.php +++ b/app/code/Magento/Authorization/Setup/InstallData.php @@ -85,5 +85,17 @@ class InstallData implements InstallDataInterface $rule->setData('resource_id', 'Magento_Backend::all')->save(); } } + + /** + * Delete rows by condition from authorization_rule + */ + $setup->startSetup(); + + $tableName = $setup->getTable('authorization_rule'); + if ($tableName) { + $setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); + } + + $setup->endSetup(); } } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php index fe01cec33c9c1f51bc3c9ed88703ddcb541f15fa..20c6f974f2c7361aaeb46378b7b1b4f54a20ec97 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php @@ -203,7 +203,11 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba $this->setChild( 'reset_filter_button', $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Button')->setData( - ['label' => __('Reset Filter'), 'onclick' => $this->getJsObjectName() . '.resetFilter()'] + [ + 'label' => __('Reset Filter'), + 'onclick' => $this->getJsObjectName() . '.resetFilter()', + 'class' => 'action-reset' + ] ) ); $this->setChild( diff --git a/app/code/Magento/Backend/Test/Unit/Model/Menu/Filter/IteratorTest.php b/app/code/Magento/Backend/Test/Unit/Model/Menu/Filter/IteratorTest.php index 6d65d43ef4a9ce4e9e4a72d4ea9c756d7b8408c7..83b1f1c8958831d3b0daa6eeb4c9b71b40a68e05 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Menu/Filter/IteratorTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Menu/Filter/IteratorTest.php @@ -12,11 +12,6 @@ class IteratorTest extends \PHPUnit_Framework_TestCase */ protected $_menuModel; - /** - * @var \Magento\Backend\Model\Menu\Filter\Iterator - */ - protected $_filterIteratorModel; - /** * @var \Magento\Backend\Model\Menu\Item[] */ @@ -42,9 +37,6 @@ class IteratorTest extends \PHPUnit_Framework_TestCase $loggerMock = $this->getMock('Psr\Log\LoggerInterface'); $this->_menuModel = new \Magento\Backend\Model\Menu($loggerMock); - $this->_filterIteratorModel = new \Magento\Backend\Model\Menu\Filter\Iterator( - $this->_menuModel->getIterator() - ); } public function testLoopWithAllItemsDisabledDoesntIterate() @@ -54,8 +46,12 @@ class IteratorTest extends \PHPUnit_Framework_TestCase $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); + $filterIteratorModel = new \Magento\Backend\Model\Menu\Filter\Iterator( + $this->_menuModel->getIterator() + ); + $items = []; - foreach ($this->_filterIteratorModel as $item) { + foreach ($filterIteratorModel as $item) { $items[] = $item; } $this->assertCount(0, $items); @@ -70,9 +66,12 @@ class IteratorTest extends \PHPUnit_Framework_TestCase $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); + $filterIteratorModel = new \Magento\Backend\Model\Menu\Filter\Iterator( + $this->_menuModel->getIterator() + ); $items = []; - foreach ($this->_filterIteratorModel as $item) { + foreach ($filterIteratorModel as $item) { $items[] = $item; } $this->assertCount(1, $items); @@ -88,9 +87,12 @@ class IteratorTest extends \PHPUnit_Framework_TestCase $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); + $filterIteratorModel = new \Magento\Backend\Model\Menu\Filter\Iterator( + $this->_menuModel->getIterator() + ); $items = []; - foreach ($this->_filterIteratorModel as $item) { + foreach ($filterIteratorModel as $item) { $items[] = $item; } $this->assertCount(1, $items); @@ -106,9 +108,12 @@ class IteratorTest extends \PHPUnit_Framework_TestCase $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); + $filterIteratorModel = new \Magento\Backend\Model\Menu\Filter\Iterator( + $this->_menuModel->getIterator() + ); $items = []; - foreach ($this->_filterIteratorModel as $item) { + foreach ($filterIteratorModel as $item) { $items[] = $item; } $this->assertCount(1, $items); @@ -125,9 +130,12 @@ class IteratorTest extends \PHPUnit_Framework_TestCase $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); $this->_menuModel->add($this->getMock('Magento\Backend\Model\Menu\Item', [], [], '', false)); + $filterIteratorModel = new \Magento\Backend\Model\Menu\Filter\Iterator( + $this->_menuModel->getIterator() + ); $items = []; - foreach ($this->_filterIteratorModel as $item) { + foreach ($filterIteratorModel as $item) { $items[] = $item; } $this->assertCount(1, $items); diff --git a/app/code/Magento/Backend/etc/adminhtml/menu.xml b/app/code/Magento/Backend/etc/adminhtml/menu.xml index e3eee55cf4e3b90e3ce046578cc988867079c4c4..08f50423e98189a9cf95a5fa031bd62658c833b9 100644 --- a/app/code/Magento/Backend/etc/adminhtml/menu.xml +++ b/app/code/Magento/Backend/etc/adminhtml/menu.xml @@ -9,7 +9,7 @@ <menu> <add id="Magento_Backend::system_design_schedule" title="Schedule" module="Magento_Backend" sortOrder="30" parent="Magento_Backend::system_design" action="adminhtml/system_design" resource="Magento_Backend::schedule"/> <add id="Magento_Backend::system_currency" title="Currency" module="Magento_Backend" sortOrder="30" parent="Magento_Backend::stores" action="adminhtml/system_currency" resource="Magento_CurrencySymbol::system_currency"/> - <add id="Magento_Backend::system_store" title="All Stores" module="Magento_Core" sortOrder="10" parent="Magento_Backend::stores_settings" action="adminhtml/system_store/" resource="Magento_Backend::store"/> + <add id="Magento_Backend::system_store" title="All Stores" module="Magento_Backend" sortOrder="10" parent="Magento_Backend::stores_settings" action="adminhtml/system_store/" resource="Magento_Backend::store"/> <add id="Magento_Backend::dashboard" title="Dashboard" module="Magento_Backend" sortOrder="10" action="adminhtml/dashboard" resource="Magento_Backend::dashboard"/> <add id="Magento_Backend::system" title="System" module="Magento_Backend" sortOrder="80" resource="Magento_Backend::system"/> <add id="Magento_Backend::system_tools" title="Tools" module="Magento_Backend" sortOrder="50" parent="Magento_Backend::system" resource="Magento_Backend::tools"/> diff --git a/app/code/Magento/Backend/etc/config.xml b/app/code/Magento/Backend/etc/config.xml index 9e58d76efd228d17e7df66ec80a1d687753d64bc..0d4c5d7180513828a1fd452c6c17d3847b8910d3 100644 --- a/app/code/Magento/Backend/etc/config.xml +++ b/app/code/Magento/Backend/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <system> <media_storage_configuration> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml index 877bdba39988344d25ddb662787616b68f0ec296..501591a40b015dffa463059e781617e0bbc5e8e7 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml @@ -15,8 +15,8 @@ </div> <div class="clear"></div> <script id="<?php echo $block->getHtmlId() ?>-template" type="text/x-magento-template"> - <div id="<%= data.id %>" class="file-row"> - <span class="file-info"><%= data.name %> (<%= data.size %>)</span> + <div id="<%- data.id %>" class="file-row"> + <span class="file-info"><%- data.name %> (<%- data.size %>)</span> <div class="progressbar-container"> <div class="progressbar upload-progress" style="width: 0%;"></div> </div> diff --git a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml index b95ad39c1f31d5fd300c737d0be14dcc5a2ce214..15b00d7a88c591da1ebb997ccb58126de599c493 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml @@ -30,11 +30,11 @@ <% if (data.items.length) { %> <% _.each(data.items, function(value){ %> <li class="item" - <%= data.optionData(value) %> + <%- data.optionData(value) %> > - <a href="<%= value.url %>" class="title"><%= value.name %></a> - <span class="type"><%= value.type %></span> - <%= value.description || "" %> + <a href="<%- value.url %>" class="title"><%- value.name %></a> + <span class="type"><%- value.type %></span> + <%- value.description || "" %> </li> <% }); %> <% } else { %> diff --git a/app/code/Magento/Bundle/Api/Data/LinkInterface.php b/app/code/Magento/Bundle/Api/Data/LinkInterface.php index 77ca71986d8a217100401a29533d913c5bcfd30a..e16fad7f555bee04fb7f42743598acff877c6c6b 100644 --- a/app/code/Magento/Bundle/Api/Data/LinkInterface.php +++ b/app/code/Magento/Bundle/Api/Data/LinkInterface.php @@ -144,4 +144,19 @@ interface LinkInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setCanChangeQuantity($canChangeQuantity); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Bundle\Api\Data\LinkExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Bundle\Api\Data\LinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Bundle\Api\Data\LinkExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Bundle/Api/Data/OptionInterface.php b/app/code/Magento/Bundle/Api/Data/OptionInterface.php index f15c1856981ba02b77f560bc8040d48a4d4bb761..47d52ba713c6410e935ccab66e3ea3b66a96416e 100644 --- a/app/code/Magento/Bundle/Api/Data/OptionInterface.php +++ b/app/code/Magento/Bundle/Api/Data/OptionInterface.php @@ -113,4 +113,19 @@ interface OptionInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setProductLinks(array $productLinks = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Bundle\Api\Data\OptionExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Bundle\Api\Data\OptionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Bundle\Api\Data\OptionExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Bundle/Api/Data/OptionTypeInterface.php b/app/code/Magento/Bundle/Api/Data/OptionTypeInterface.php index 9132f2babc7f53470b02ad93f3a2d6ef1f4d1b45..9883c8535da83ca0dd252e30d64cfe82b4144cf7 100644 --- a/app/code/Magento/Bundle/Api/Data/OptionTypeInterface.php +++ b/app/code/Magento/Bundle/Api/Data/OptionTypeInterface.php @@ -37,4 +37,19 @@ interface OptionTypeInterface extends \Magento\Framework\Api\ExtensibleDataInter * @return $this */ public function setCode($code); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Bundle\Api\Data\OptionTypeExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Bundle\Api\Data\OptionTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Bundle\Api\Data\OptionTypeExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php b/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php index f10ef9e27291ebad1a1a97e8d2fac5621b538c37..2109cde0f95d452be9456038b8cfc2fa8ca30726 100644 --- a/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php +++ b/app/code/Magento/Bundle/Api/ProductLinkManagementInterface.php @@ -21,7 +21,7 @@ interface ProductLinkManagementInterface /** * Add child product to specified Bundle option by product sku * - * @param string $productSku + * @param string $sku * @param int $optionId * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct * @throws \Magento\Framework\Exception\NoSuchEntityException @@ -29,7 +29,7 @@ interface ProductLinkManagementInterface * @throws \Magento\Framework\Exception\InputException * @return int */ - public function addChildByProductSku($productSku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct); + public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct); /** * @param \Magento\Catalog\Api\Data\ProductInterface $product @@ -49,12 +49,12 @@ interface ProductLinkManagementInterface /** * Remove product from Bundle product option * - * @param string $productSku + * @param string $sku * @param int $optionId * @param string $childSku * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException * @return bool */ - public function removeChild($productSku, $optionId, $childSku); + public function removeChild($sku, $optionId, $childSku); } diff --git a/app/code/Magento/Bundle/Api/ProductOptionRepositoryInterface.php b/app/code/Magento/Bundle/Api/ProductOptionRepositoryInterface.php index 61c942a3b15344a5ed715f7279c6a9d8b7fb9bca..26857e69449cd04a3e130a3feb1432d87aaa198c 100644 --- a/app/code/Magento/Bundle/Api/ProductOptionRepositoryInterface.php +++ b/app/code/Magento/Bundle/Api/ProductOptionRepositoryInterface.php @@ -11,23 +11,23 @@ interface ProductOptionRepositoryInterface /** * Get option for bundle product * - * @param string $productSku + * @param string $sku * @param int $optionId * @return \Magento\Bundle\Api\Data\OptionInterface * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException */ - public function get($productSku, $optionId); + public function get($sku, $optionId); /** * Get all options for bundle product * - * @param string $productSku + * @param string $sku * @return \Magento\Bundle\Api\Data\OptionInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException */ - public function getList($productSku); + public function getList($sku); /** * Remove bundle option @@ -42,13 +42,13 @@ interface ProductOptionRepositoryInterface /** * Remove bundle option * - * @param string $productSku + * @param string $sku * @param int $optionId * @return bool * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\InputException */ - public function deleteById($productSku, $optionId); + public function deleteById($sku, $optionId); /** * Add new option for bundle product diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php index 9205c9f30b5267d99258e1518b3fdb6b0efa77b9..1c2c1ed85fac6b09e240ecb1e15c52fe67a07507 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php @@ -152,7 +152,7 @@ class Option extends \Magento\Backend\Block\Widget 'add_selection_button', 'Magento\Backend\Block\Widget\Button', [ - 'id' => $this->getFieldId() . '_<%= data.index %>_add_button', + 'id' => $this->getFieldId() . '_<%- data.index %>_add_button', 'label' => __('Add Products to Option'), 'class' => 'add add-selection' ] @@ -162,7 +162,7 @@ class Option extends \Magento\Backend\Block\Widget 'close_search_button', 'Magento\Backend\Block\Widget\Button', [ - 'id' => $this->getFieldId() . '_<%= data.index %>_close_button', + 'id' => $this->getFieldId() . '_<%- data.index %>_close_button', 'label' => __('Close'), 'on_click' => 'bSelection.closeSearch(event)', 'class' => 'back no-display' @@ -272,12 +272,12 @@ class Option extends \Magento\Backend\Block\Widget 'Magento\Framework\View\Element\Html\Select' )->setData( [ - 'id' => $this->getFieldId() . '_<%= data.index %>_type', + 'id' => $this->getFieldId() . '_<%- data.index %>_type', 'class' => 'select select-product-option-type required-option-select', 'extra_params' => 'onchange="bOption.changeType(event)"', ] )->setName( - $this->getFieldName() . '[<%= data.index %>][type]' + $this->getFieldName() . '[<%- data.index %>][type]' )->setOptions( $this->_optionTypes->toOptionArray() ); @@ -293,9 +293,9 @@ class Option extends \Magento\Backend\Block\Widget $select = $this->getLayout()->createBlock( 'Magento\Framework\View\Element\Html\Select' )->setData( - ['id' => $this->getFieldId() . '_<%= data.index %>_required', 'class' => 'select'] + ['id' => $this->getFieldId() . '_<%- data.index %>_required', 'class' => 'select'] )->setName( - $this->getFieldName() . '[<%= data.index %>][required]' + $this->getFieldName() . '[<%- data.index %>][required]' )->setOptions( $this->_yesno->toOptionArray() ); diff --git a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php index 596af26f794544249a8c54f06ca95e73c37ed8e5..171d6477ad3c52cc7ee251e88c8aa432eef47a27 100644 --- a/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php +++ b/app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.php @@ -131,11 +131,11 @@ class Selection extends \Magento\Backend\Block\Widget 'Magento\Framework\View\Element\Html\Select' )->setData( [ - 'id' => $this->getFieldId() . '_<%= data.index %>_price_type', + 'id' => $this->getFieldId() . '_<%- data.index %>_price_type', 'class' => 'select select-product-option-type required-option-select', ] )->setName( - $this->getFieldName() . '[<%= data.parentIndex %>][<%= data.index %>][selection_price_type]' + $this->getFieldName() . '[<%- data.parentIndex %>][<%- data.index %>][selection_price_type]' )->setOptions( $this->_priceType->toOptionArray() ); @@ -155,9 +155,9 @@ class Selection extends \Magento\Backend\Block\Widget $select = $this->getLayout()->createBlock( 'Magento\Framework\View\Element\Html\Select' )->setData( - ['id' => $this->getFieldId() . '_<%= data.index %>_can_change_qty', 'class' => 'select'] + ['id' => $this->getFieldId() . '_<%- data.index %>_can_change_qty', 'class' => 'select'] )->setName( - $this->getFieldName() . '[<%= data.parentIndex %>][<%= data.index %>][selection_can_change_qty]' + $this->getFieldName() . '[<%- data.parentIndex %>][<%- data.index %>][selection_can_change_qty]' )->setOptions( $this->_yesno->toOptionArray() ); @@ -195,8 +195,8 @@ class Selection extends \Magento\Backend\Block\Widget { $checkboxHtml = ''; if ($this->isUsedWebsitePrice()) { - $fieldsId = $this->getFieldId() . '_<%= data.index %>_price_scope'; - $name = $this->getFieldName() . '[<%= data.parentIndex %>][<%= data.index %>][default_price_scope]'; + $fieldsId = $this->getFieldId() . '_<%- data.index %>_price_scope'; + $name = $this->getFieldName() . '[<%- data.parentIndex %>][<%- data.index %>][default_price_scope]'; $class = 'bundle-option-price-scope-checkbox'; $label = __('Use Default Value'); $disabled = $this->getCanEditPrice() === false ? ' disabled="disabled"' : ''; diff --git a/app/code/Magento/Bundle/Model/Link.php b/app/code/Magento/Bundle/Model/Link.php index f20685ee211fde7efe7c4f484a7455e169f68d90..eb99eff55e334fd9c878af2054243956b76a115c 100644 --- a/app/code/Magento/Bundle/Model/Link.php +++ b/app/code/Magento/Bundle/Model/Link.php @@ -7,6 +7,7 @@ namespace Magento\Bundle\Model; /** + * Class Link * @codeCoverageIgnore */ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements @@ -196,4 +197,25 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_CAN_CHANGE_QUANTITY, $canChangeQuantity); } + + /** + * {@inheritdoc} + * + * @return \Magento\Bundle\Api\Data\LinkExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Bundle\Api\Data\LinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Bundle\Api\Data\LinkExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Bundle/Model/LinkManagement.php b/app/code/Magento/Bundle/Model/LinkManagement.php index d6afcd452770da6fddd3b506edcacaa7a91c8860..408747b81e500ca07a4fb8125733e0a0a6fe1960 100644 --- a/app/code/Magento/Bundle/Model/LinkManagement.php +++ b/app/code/Magento/Bundle/Model/LinkManagement.php @@ -97,10 +97,10 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa /** * {@inheritdoc} */ - public function addChildByProductSku($productSku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct) + public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct) { /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); return $this->addChild($product, $optionId, $linkedProduct); } @@ -180,13 +180,13 @@ class LinkManagement implements \Magento\Bundle\Api\ProductLinkManagementInterfa /** * {@inheritdoc} */ - public function removeChild($productSku, $optionId, $childSku) + public function removeChild($sku, $optionId, $childSku) { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { throw new InputException( - sprintf('Product with specified sku: %s is not a bundle product', $productSku) + sprintf('Product with specified sku: %s is not a bundle product', $sku) ); } diff --git a/app/code/Magento/Bundle/Model/Option.php b/app/code/Magento/Bundle/Model/Option.php index dd265884d84999cb2f007c7a4a1c39b19f020f67..a541f00b80e24c7c6b8d221169b9f2efea55a900 100644 --- a/app/code/Magento/Bundle/Model/Option.php +++ b/app/code/Magento/Bundle/Model/Option.php @@ -269,5 +269,26 @@ class Option extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_PRODUCT_LINKS, $productLinks); } + + /** + * {@inheritdoc} + * + * @return \Magento\Bundle\Api\Data\OptionExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Bundle\Api\Data\OptionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Bundle\Api\Data\OptionExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Bundle/Model/OptionRepository.php b/app/code/Magento/Bundle/Model/OptionRepository.php index 6fed5aa5798aed4aa722bb8dacb52a2d9f8ebe1f..b9d42b974803e7f913e21e196601083be313d0d9 100644 --- a/app/code/Magento/Bundle/Model/OptionRepository.php +++ b/app/code/Magento/Bundle/Model/OptionRepository.php @@ -96,9 +96,9 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt /** * {@inheritdoc} */ - public function get($productSku, $optionId) + public function get($sku, $optionId) { - $product = $this->getProduct($productSku); + $product = $this->getProduct($sku); /** @var \Magento\Bundle\Model\Option $option */ $option = $this->type->getOptionsCollection($product)->getItemById($optionId); @@ -126,9 +126,9 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt /** * {@inheritdoc} */ - public function getList($productSku) + public function getList($sku) { - $product = $this->getProduct($productSku); + $product = $this->getProduct($sku); return $this->productOptionList->getItems($product); } @@ -152,9 +152,9 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt /** * {@inheritdoc} */ - public function deleteById($productSku, $optionId) + public function deleteById($sku, $optionId) { - $product = $this->getProduct($productSku); + $product = $this->getProduct($sku); $optionCollection = $this->type->getOptionsCollection($product); $optionCollection->setIdFilter($optionId); return $this->delete($optionCollection->getFirstItem()); @@ -217,13 +217,13 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt } /** - * @param string $productSku + * @param string $sku * @return \Magento\Catalog\Api\Data\ProductInterface * @throws \Magento\Framework\Exception\InputException */ - private function getProduct($productSku) + private function getProduct($sku) { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { throw new InputException('Only implemented for bundle product'); } diff --git a/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php b/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php index acbf28dd74d38916626a63e980cf36546e8c70ee..76b5dd84b3620c4ee3fa4da5eae8fc6490b602ce 100644 --- a/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php +++ b/app/code/Magento/Bundle/Model/Plugin/BundleLoadOptions.php @@ -15,20 +15,21 @@ class BundleLoadOptions protected $productOptionList; /** - * @var \Magento\Framework\Api\AttributeDataBuilder + * @var \Magento\Catalog\Api\Data\ProductExtensionFactory */ - protected $customAttributeBuilder; + protected $productExtensionFactory; /** * @param \Magento\Bundle\Model\Product\OptionList $productOptionList * @param \Magento\Framework\Api\AttributeDataBuilder $customAttributeBuilder + * @param \Magento\Catalog\Api\Data\ProductExtensionFactory $productExtensionFactory */ public function __construct( \Magento\Bundle\Model\Product\OptionList $productOptionList, - \Magento\Framework\Api\AttributeDataBuilder $customAttributeBuilder + \Magento\Catalog\Api\Data\ProductExtensionFactory $productExtensionFactory ) { $this->productOptionList = $productOptionList; - $this->customAttributeBuilder = $customAttributeBuilder; + $this->productExtensionFactory = $productExtensionFactory; } /** @@ -50,12 +51,12 @@ class BundleLoadOptions if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { return $product; } - $customAttribute = $this->customAttributeBuilder - ->setAttributeCode('bundle_product_options') - ->setValue($this->productOptionList->getItems($product)) - ->create(); - $attributes = array_merge($product->getCustomAttributes(), ['bundle_product_options' => $customAttribute]); - $product->setData('custom_attributes', $attributes); + + $productExtension = $this->productExtensionFactory->create(); + $productExtension->setBundleProductOptions($this->productOptionList->getItems($product)); + + $product->setExtensionAttributes($productExtension); + return $product; } } diff --git a/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php b/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php index 715feaab8e8220cc2396a076b7f2ed361647d198..b0e9ee6de4700da4651aee4c31aaed0b03db657b 100644 --- a/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php +++ b/app/code/Magento/Bundle/Model/Plugin/BundleSaveOptions.php @@ -44,13 +44,8 @@ class BundleSaveOptions return $result; } - /* @var \Magento\Framework\Api\AttributeValue $bundleProductOptionsAttrValue */ - $bundleProductOptionsAttrValue = $product->getCustomAttribute('bundle_product_options'); - if (is_null($bundleProductOptionsAttrValue) || !is_array($bundleProductOptionsAttrValue->getValue())) { - $bundleProductOptions = []; - } else { - $bundleProductOptions = $bundleProductOptionsAttrValue->getValue(); - } + /* @var \Magento\Bundle\Api\Data\OptionInterface[] $options */ + $bundleProductOptions = $product->getExtensionAttributes()->getBundleProductOptions(); if (is_array($bundleProductOptions)) { foreach ($bundleProductOptions as $option) { diff --git a/app/code/Magento/Bundle/Model/Source/Option/Type.php b/app/code/Magento/Bundle/Model/Source/Option/Type.php index 711b94c2a554735aca2e24cb968e983518723316..98ecd93865d4cc25ca07963e2a1fe6866f25a04a 100644 --- a/app/code/Magento/Bundle/Model/Source/Option/Type.php +++ b/app/code/Magento/Bundle/Model/Source/Option/Type.php @@ -9,8 +9,12 @@ namespace Magento\Bundle\Model\Source\Option; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Api\MetadataServiceInterface; +use Magento\Framework\Api\ExtensionAttributesFactory; +/** + * Class Type + * + */ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements \Magento\Framework\Option\ArrayInterface, \Magento\Bundle\Api\Data\OptionTypeInterface @@ -30,7 +34,7 @@ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param MetadataServiceInterface $metadataService + * @param ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param array $options * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -40,7 +44,7 @@ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - MetadataServiceInterface $metadataService, + ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, array $options, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -51,7 +55,7 @@ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -111,5 +115,26 @@ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_CODE, $code); } + + /** + * {@inheritdoc} + * + * @return \Magento\Bundle\Api\Data\OptionTypeExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Bundle\Api\Data\OptionTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Bundle\Api\Data\OptionTypeExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php index 623d647cf5b623530a2fba9e6b45030ad0e5737c..7b91140a3bfe6fd0aa0196384d298e656afbb5bd 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/OptionRepositoryTest.php @@ -4,6 +4,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Bundle\Test\Unit\Model; class OptionRepositoryTest extends \PHPUnit_Framework_TestCase @@ -69,7 +72,9 @@ class OptionRepositoryTest extends \PHPUnit_Framework_TestCase $this->productRepositoryMock = $this->getMock('\Magento\Catalog\Api\ProductRepositoryInterface'); $this->typeMock = $this->getMock('\Magento\Bundle\Model\Product\Type', [], [], '', false); $this->optionFactoryMock = $this->getMockBuilder('\Magento\Bundle\Api\Data\OptionInterfaceFactory') + ->disableOriginalConstructor() ->setMethods(['create']) + ->disableOriginalConstructor() ->getMock(); $this->dataObjectHelperMock = $this->getMockBuilder('\Magento\Framework\Api\DataObjectHelper') ->disableOriginalConstructor() diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php index fb57b32683eed7c035619ee234f6d9d0bd2bea56..e4050d99040ca61dacc97b54731fd79e67719af1 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleLoadOptionsTest.php @@ -4,6 +4,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Bundle\Test\Unit\Model\Plugin; class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase @@ -21,15 +24,22 @@ class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $attributeBuilderMock; + protected $attributeFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productExtensionFactory; protected function setUp() { $this->optionListMock = $this->getMock('\Magento\Bundle\Model\Product\OptionList', [], [], '', false); - $this->attributeBuilderMock = $this->getMock('\Magento\Framework\Api\AttributeDataBuilder', [], [], '', false); + $this->productExtensionFactory = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtensionFactory') + ->disableOriginalConstructor() + ->getMock(); $this->model = new \Magento\Bundle\Model\Plugin\BundleLoadOptions( $this->optionListMock, - $this->attributeBuilderMock + $this->productExtensionFactory ); } @@ -50,9 +60,10 @@ class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase public function testAroundLoad() { + $this->markTestSkipped('MAGETWO-34577'); $productMock = $this->getMock( '\Magento\Catalog\Model\Product', - ['getTypeId', 'getCustomAttributes', 'setData'], + ['getTypeId', 'setExtensionAttributes'], [], '', false @@ -69,22 +80,19 @@ class BundleLoadOptionsTest extends \PHPUnit_Framework_TestCase ->method('getItems') ->with($productMock) ->willReturn([$optionMock]); - $this->attributeBuilderMock->expects($this->once()) - ->method('setAttributeCode') - ->with('bundle_product_options') - ->willReturnSelf(); - $this->attributeBuilderMock->expects($this->once()) - ->method('setValue') + $productExtensionMock = $this->getMockBuilder('\Magento\Catalog\Api\Data\ProductExtension') + ->disableOriginalConstructor() + ->getMock(); + $this->productExtensionFactory->expects($this->once()) + ->method('create') + ->willReturn($productExtensionMock); + $productExtensionMock->expects($this->once()) + ->method('setBundleProductOptions') ->with([$optionMock]) ->willReturnSelf(); - $customAttributeMock = $this->getMock('\Magento\Framework\Api\AttributeValue', [], [], '', false); - $this->attributeBuilderMock->expects($this->once())->method('create')->willReturn($customAttributeMock); - - $productAttributeMock = $this->getMock('\Magento\Framework\Api\AttributeValue', [], [], '', false); - $productMock->expects($this->once())->method('getCustomAttributes')->willReturn([$productAttributeMock]); $productMock->expects($this->once()) - ->method('setData') - ->with('custom_attributes', ['bundle_product_options' => $customAttributeMock, $productAttributeMock]) + ->method('setExtensionAttributes') + ->with($productExtensionMock) ->willReturnSelf(); $this->assertEquals( diff --git a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php index 7bf90801c4620a0d40b47265b39aebac41531251..1615760e6dbee5b4ad44d0d30cd81b53b19e691e 100644 --- a/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Model/Plugin/BundleSaveOptionsTest.php @@ -5,6 +5,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Bundle\Test\Unit\Model\Plugin; use \Magento\Bundle\Model\Plugin\BundleSaveOptions; @@ -31,6 +33,16 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase */ protected $productMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productExtensionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productBundleOptionsMock; + /** * @var \Closure */ @@ -40,17 +52,37 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase { $this->productRepositoryMock = $this->getMock('Magento\Catalog\Api\ProductRepositoryInterface'); $this->productOptionRepositoryMock = $this->getMock('Magento\Bundle\Api\ProductOptionRepositoryInterface'); - $this->productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); + $this->productMock = $this->getMock( + 'Magento\Catalog\Model\Product', + ['getExtensionAttributes', 'getTypeId'], + [], + '', + false + ); $this->closureMock = function () { return $this->productMock; }; $this->plugin = new BundleSaveOptions($this->productOptionRepositoryMock); + $this->productExtensionMock = $this->getMock( + 'Magento\Catalog\Api\Data\ProductExtension', + ['getBundleProductOptions'], + [], + '', + false + ); + $this->productBundleOptionsMock = $this->getMock( + 'Magento\Bundle\Api\Data\OptionInterface', + [], + [], + '', + false + ); } public function testAroundSaveWhenProductIsSimple() { $this->productMock->expects($this->once())->method('getTypeId')->willReturn('simple'); - $this->productMock->expects($this->never())->method('getCustomAttribute'); + $this->productMock->expects($this->never())->method('getExtensionAttributes'); $this->assertEquals( $this->productMock, @@ -62,9 +94,11 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase { $this->productMock->expects($this->once())->method('getTypeId')->willReturn('bundle'); $this->productMock->expects($this->once()) - ->method('getCustomAttribute') - ->with('bundle_product_options') - ->willReturn(null); + ->method('getExtensionAttributes') + ->willReturn($this->productExtensionMock); + $this->productExtensionMock->expects($this->once()) + ->method('getBundleProductOptions') + ->willReturn([]); $this->productOptionRepositoryMock->expects($this->never())->method('save'); @@ -76,16 +110,17 @@ class BundleSaveOptionsTest extends \PHPUnit_Framework_TestCase public function testAroundSaveWhenProductIsBundleWithOptions() { - $option = $this->getMock('\Magento\Bundle\Api\Data\OptionInterface'); - $bundleProductOptionsAttrValue = $this->getMock('\Magento\Framework\Api\AttributeValue', [], [], '', false); - $bundleProductOptionsAttrValue->expects($this->atLeastOnce())->method('getValue')->willReturn([$option]); $this->productMock->expects($this->once())->method('getTypeId')->willReturn('bundle'); $this->productMock->expects($this->once()) - ->method('getCustomAttribute') - ->with('bundle_product_options') - ->willReturn($bundleProductOptionsAttrValue); - - $this->productOptionRepositoryMock->expects($this->once())->method('save')->with($this->productMock, $option); + ->method('getExtensionAttributes') + ->willReturn($this->productExtensionMock); + $this->productExtensionMock->expects($this->once()) + ->method('getBundleProductOptions') + ->willReturn([$this->productBundleOptionsMock]); + + $this->productOptionRepositoryMock->expects($this->once()) + ->method('save') + ->with($this->productMock, $this->productBundleOptionsMock); $this->assertEquals( $this->productMock, diff --git a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/DiscountCalculatorTest.php b/app/code/Magento/Bundle/Test/Unit/Pricing/Price/DiscountCalculatorTest.php index f15939bfd5add7b635db8fd8a39a875b1cf5e91c..8ebcc1cb67a8b5d2b7dc606cc99ca5e740d2f1e5 100644 --- a/app/code/Magento/Bundle/Test/Unit/Pricing/Price/DiscountCalculatorTest.php +++ b/app/code/Magento/Bundle/Test/Unit/Pricing/Price/DiscountCalculatorTest.php @@ -8,8 +8,6 @@ namespace Magento\Bundle\Test\Unit\Pricing\Price; -use Magento\Catalog\Pricing\Price\FinalPrice; - /** * Class DiscountCalculatorTest */ @@ -95,7 +93,7 @@ class DiscountCalculatorTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($this->priceInfoMock)); $this->priceInfoMock->expects($this->once()) ->method('getPrice') - ->with($this->equalTo(FinalPrice::PRICE_CODE)) + ->with($this->equalTo(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)) ->will($this->returnValue($this->finalPriceMock)); $this->finalPriceMock->expects($this->once()) ->method('getValue') diff --git a/app/code/Magento/Bundle/etc/config.xml b/app/code/Magento/Bundle/etc/config.xml index 45baec43c5ab09a3ea80b77b16e83a02da0e350d..10a14c0aab73d501f8581ba9245116e6b5246df9 100644 --- a/app/code/Magento/Bundle/etc/config.xml +++ b/app/code/Magento/Bundle/etc/config.xml @@ -5,5 +5,5 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> </config> diff --git a/app/code/Magento/Bundle/etc/data_object.xml b/app/code/Magento/Bundle/etc/data_object.xml index 2b3da013978f971bb20baca3a5e0ca95f2b501fc..88e317dafc78c8ce9d0c9a3fe6f703b777361e4a 100644 --- a/app/code/Magento/Bundle/etc/data_object.xml +++ b/app/code/Magento/Bundle/etc/data_object.xml @@ -8,5 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd"> <custom_attributes for="Magento\Catalog\Api\Data\ProductInterface"> <attribute code="bundle_product_options" type="Magento\Bundle\Api\Data\OptionInterface[]" /> + <attribute code="price_type" type="integer" /> + <attribute code="price_view" type="string" /> </custom_attributes> </config> diff --git a/app/code/Magento/Bundle/etc/webapi.xml b/app/code/Magento/Bundle/etc/webapi.xml index 36bb8f577597f238c0dce61748b7f33294bdb5a7..ec0dffcf1049e2d29da72bb80d02e8fba97ee316 100644 --- a/app/code/Magento/Bundle/etc/webapi.xml +++ b/app/code/Magento/Bundle/etc/webapi.xml @@ -7,7 +7,7 @@ --> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> - <route url="/V1/bundle-products/:productSku/links/:optionId" method="POST"> + <route url="/V1/bundle-products/:sku/links/:optionId" method="POST"> <service class="Magento\Bundle\Api\ProductLinkManagementInterface" method="addChildByProductSku"/> <resources> <resource ref="Magento_Catalog::products"/> @@ -19,43 +19,43 @@ <resource ref="Magento_Catalog::products"/> </resources> </route> - <route url="/V1/bundle-products/:productSku/option/:optionId/child/:childSku" method="DELETE"> + <route url="/V1/bundle-products/:sku/options/:optionId/children/:childSku" method="DELETE"> <service class="Magento\Bundle\Api\ProductLinkManagementInterface" method="removeChild"/> <resources> <resource ref="Magento_Catalog::products"/> </resources> </route> - <route url="/V1/bundle-products/:productSku/option/all" method="GET"> + <route url="/V1/bundle-products/:sku/options/all" method="GET"> <service class="Magento\Bundle\Api\ProductOptionRepositoryInterface" method="getList" /> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/bundle-products/option/types" method="GET"> + <route url="/V1/bundle-products/options/types" method="GET"> <service class="Magento\Bundle\Api\ProductOptionTypeListInterface" method="getItems" /> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/bundle-products/:productSku/option/:optionId" method="GET"> + <route url="/V1/bundle-products/:sku/options/:optionId" method="GET"> <service class="Magento\Bundle\Api\ProductOptionRepositoryInterface" method="get" /> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/bundle-products/option/add" method="POST"> + <route url="/V1/bundle-products/options/add" method="POST"> <service class="Magento\Bundle\Api\ProductOptionManagementInterface" method="save" /> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/bundle-products/option/:optionId" method="PUT"> + <route url="/V1/bundle-products/options/:optionId" method="PUT"> <service class="Magento\Bundle\Api\ProductOptionManagementInterface" method="save" /> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/bundle-products/:productSku/option/:optionId" method="DELETE"> + <route url="/V1/bundle-products/:sku/options/:optionId" method="DELETE"> <service class="Magento\Bundle\Api\ProductOptionRepositoryInterface" method="deleteById" /> <resources> <resource ref="Magento_Catalog::products" /> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml index 63f88f9a30f27f9747e325a750f5b1857dcbca8a..15746df3554370e6627f82aadbee123660d7c973 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option.phtml @@ -9,65 +9,65 @@ /** @var $block \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option */ ?> <script id="bundle-option-template" type="text/x-magento-template"> - <div id="<?php echo $block->getFieldId() ?>_<%= data.index %>" class="option-box"> - <div class="fieldset-wrapper collapsable-wrapper opened" id="<?php echo $block->getFieldId() ?>_<%= data.index %>-wrapper"> + <div id="<?php echo $block->getFieldId() ?>_<%- data.index %>" class="option-box"> + <div class="fieldset-wrapper collapsable-wrapper opened" id="<?php echo $block->getFieldId() ?>_<%- data.index %>-wrapper"> <div class="fieldset-wrapper-title"> - <strong class="title" data-toggle="collapse" data-target="#<?php echo $block->getFieldId() ?>_<%= data.index %>-content"> - <span><%= data.default_title %></span> + <strong class="title" data-toggle="collapse" data-target="#<?php echo $block->getFieldId() ?>_<%- data.index %>-content"> + <span><%- data.default_title %></span> </strong> <div class="actions"> <?php echo $block->getOptionDeleteButtonHtml() ?> </div> <div data-role="draggable-handle" class="draggable-handle"></div> </div> - <div class="fieldset-wrapper-content in collapse" id="<?php echo $block->getFieldId() ?>_<%= data.index %>-content"> + <div class="fieldset-wrapper-content in collapse" id="<?php echo $block->getFieldId() ?>_<%- data.index %>-content"> <fieldset class="fieldset"> <fieldset class="fieldset-alt"> <div class="field field-option-title required"> - <label class="label" for="id_<?php echo $block->getFieldName() ?>_<%= data.index %>_title"> + <label class="label" for="id_<?php echo $block->getFieldName() ?>_<%- data.index %>_title"> <?php echo __('Option Title') ?> </label> <div class="control"> <?php if ($block->isDefaultStore()): ?> <input class="input-text required-entry" type="text" - name="<?php echo $block->getFieldName() ?>[<%= data.index %>][title]" - id="id_<?php echo $block->getFieldName() ?>_<%= data.index %>_title" - value="<%= data.title %>" - data-original-value="<%= data.title %>" /> + name="<?php echo $block->getFieldName() ?>[<%- data.index %>][title]" + id="id_<?php echo $block->getFieldName() ?>_<%- data.index %>_title" + value="<%- data.title %>" + data-original-value="<%- data.title %>" /> <?php else: ?> <input class="input-text required-entry" type="text" - name="<?php echo $block->getFieldName() ?>[<%= data.index %>][default_title]" - id="id_<?php echo $block->getFieldName() ?>_<%= data.index %>_default_title" - value="<%= data.default_title %>" - data-original-value="<%= data.default_title %>" /> + name="<?php echo $block->getFieldName() ?>[<%- data.index %>][default_title]" + id="id_<?php echo $block->getFieldName() ?>_<%- data.index %>_default_title" + value="<%- data.default_title %>" + data-original-value="<%- data.default_title %>" /> <?php endif; ?> <input type="hidden" - id="<?php echo $block->getFieldId() ?>_id_<%= data.index %>" - name="<?php echo $block->getFieldName() ?>[<%= data.index %>][option_id]" - value="<%= data.option_id %>" /> + id="<?php echo $block->getFieldId() ?>_id_<%- data.index %>" + name="<?php echo $block->getFieldName() ?>[<%- data.index %>][option_id]" + value="<%- data.option_id %>" /> <input type="hidden" - name="<?php echo $block->getFieldName() ?>[<%= data.index %>][delete]" + name="<?php echo $block->getFieldName() ?>[<%- data.index %>][delete]" value="" data-state="deleted" /> </div> </div> <?php if (!$block->isDefaultStore()): ?> <div class="field field-option-store-view required"> - <label class="label" for="id_<?php echo $block->getFieldName() ?>_<%= data.index %>_title_store"> + <label class="label" for="id_<?php echo $block->getFieldName() ?>_<%- data.index %>_title_store"> <?php echo __('Store View Title') ?> </label> <div class="control"> <input class="input-text required-entry" type="text" - name="<?php echo $block->getFieldName() ?>[<%= data.index %>][title]" - id="id_<?php echo $block->getFieldName() ?>_<%= data.index %>_title_store" - value="<%= data.title %>" /> + name="<?php echo $block->getFieldName() ?>[<%- data.index %>][title]" + id="id_<?php echo $block->getFieldName() ?>_<%- data.index %>_title_store" + value="<%- data.title %>" /> </div> </div> <?php endif; ?> <div class="field field-option-input-type required"> - <label class="label" for="<?php echo $block->getFieldId() . '_<%= data.index %>_type' ?>"> + <label class="label" for="<?php echo $block->getFieldId() . '_<%- data.index %>_type' ?>"> <?php echo __('Input Type') ?> </label> <div class="control"> @@ -93,8 +93,8 @@ <div class="control"> <input class="input-text validate-zero-or-greater" type="text" - name="<?php echo $block->getFieldName() ?>[<%= data.index %>][position]" - value="<%= data.position %>" + name="<?php echo $block->getFieldName() ?>[<%- data.index %>][position]" + value="<%- data.position %>" id="field-option-position" /> </div> </div> @@ -107,7 +107,7 @@ </fieldset> </div> </div> - <div id="<?php echo $block->getFieldId() ?>_search_<%= data.index %>" class="selection-search"></div> + <div id="<?php echo $block->getFieldId() ?>_search_<%- data.index %>" class="selection-search"></div> </div> </script> diff --git a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml index 980c542278c6329e9b4a0acdebe76048418c8c13..1fb154b2a48b96020551b20280a8fb7516363c82 100644 --- a/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml +++ b/app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle/option/selection.phtml @@ -33,30 +33,30 @@ <script id="bundle-option-selection-row-template" type="text/x-magento-template"> <td class="col-draggable"> <span data-role="draggable-handle" class="draggable-handle"></span> - <input type="hidden" id="<?php echo $block->getFieldId() ?>_id<%= data.index %>" - name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][selection_id]" - value="<%= data.selection_id %>"/> - <input type="hidden" name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][option_id]" - value="<%= data.option_id %>"/> + <input type="hidden" id="<?php echo $block->getFieldId() ?>_id<%- data.index %>" + name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_id]" + value="<%- data.selection_id %>"/> + <input type="hidden" name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][option_id]" + value="<%- data.option_id %>"/> <input type="hidden" class="product" - name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][product_id]" - value="<%= data.product_id %>"/> - <input type="hidden" name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][delete]" + name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][product_id]" + value="<%- data.product_id %>"/> + <input type="hidden" name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][delete]" value="" class="delete"/> </td> <td class="col-default"> - <input onclick="bSelection.checkGroup(event)" type="<%= data.option_type %>" class="default" - name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][is_default]" - value="1" <%= data.checked %> /> + <input onclick="bSelection.checkGroup(event)" type="<%- data.option_type %>" class="default" + name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][is_default]" + value="1" <%- data.checked %> /> </td> - <td class="col-name"><%= data.name %></td> - <td class="col-sku"><%= data.sku %></td> + <td class="col-name"><%- data.name %></td> + <td class="col-sku"><%- data.sku %></td> <?php if ($block->getCanReadPrice() !== false): ?> <td class="col-price price-type-box"> - <input id="<?php echo $block->getFieldId() ?>_<%= data.index %>_price_value" + <input id="<?php echo $block->getFieldId() ?>_<%- data.index %>_price_value" class="input-text required-entry validate-zero-or-greater" type="text" - name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][selection_price_value]" - value="<%= data.selection_price_value %>" + name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_value]" + value="<%- data.selection_price_value %>" <?php if ($block->getCanEditPrice() === false): ?> disabled="disabled" <?php endif; ?>/> @@ -66,19 +66,19 @@ <div><?php echo $block->getCheckboxScopeHtml() ?></div> </td> <?php else: ?> - <input type="hidden" id="<?php echo $block->getFieldId(); ?>_<%= data.index %>_price_value" - name="<?php echo $block->getFieldName(); ?>[<%= data.parentIndex %>][<%= data.index %>][selection_price_value]" value="0" /> - <input type="hidden" id="<?php echo $block->getFieldId(); ?>_<%= data.index %>_price_type" - name="<?php echo $block->getFieldName(); ?>[<%= data.parentIndex %>][<%= data.index %>][selection_price_type]" value="0" /> + <input type="hidden" id="<?php echo $block->getFieldId(); ?>_<%- data.index %>_price_value" + name="<?php echo $block->getFieldName(); ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_value]" value="0" /> + <input type="hidden" id="<?php echo $block->getFieldId(); ?>_<%- data.index %>_price_type" + name="<?php echo $block->getFieldName(); ?>[<%- data.parentIndex %>][<%- data.index %>][selection_price_type]" value="0" /> <?php if ($block->isUsedWebsitePrice()): ?> - <input type="hidden" id="<?php echo $block->getFieldId(); ?>_<%= data.index %>_price_scope" - name="<?php echo $block->getFieldName(); ?>[<%= data.parentIndex %>][<%= data.index %>][default_price_scope]" value="1" /> + <input type="hidden" id="<?php echo $block->getFieldId(); ?>_<%- data.index %>_price_scope" + name="<?php echo $block->getFieldName(); ?>[<%- data.parentIndex %>][<%- data.index %>][default_price_scope]" value="1" /> <?php endif; ?> <?php endif; ?> <td class="col-qty"> <input class="input-text required-entry validate-greater-zero-based-on-option validate-zero-or-greater" type="text" - name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][selection_qty]" - value="<%= data.selection_qty %>" /> + name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][selection_qty]" + value="<%- data.selection_qty %>" /> </td> <td class="col-uqty qty-box"> <input type="checkbox" class="is-user-defined-qty" checked="checked" /> @@ -86,8 +86,8 @@ </td> <td class="col-order type-order" style="display:none"> <input class="input-text required-entry validate-zero-or-greater" type="text" - name="<?php echo $block->getFieldName() ?>[<%= data.parentIndex %>][<%= data.index %>][position]" - value="<%= data.position %>" /> + name="<?php echo $block->getFieldName() ?>[<%- data.parentIndex %>][<%- data.index %>][position]" + value="<%- data.position %>" /> </td> <td class="col-actions"> <span title="Delete Row"> @@ -118,9 +118,9 @@ Bundle.Selection.prototype = { selectionSearchUrl: '<?php echo $block->getSelectionSearchUrl() ?>', initialize : function() { - this.templateBox = '<div class="tier form-list" id="' + this.idLabel + '_box_<%= data.parentIndex %>">' + bundleTemplateBox + '</div>'; + this.templateBox = '<div class="tier form-list" id="' + this.idLabel + '_box_<%- data.parentIndex %>">' + bundleTemplateBox + '</div>'; - this.templateRow = '<tr class="selection" id="' + this.idLabel + '_row_<%= data.index %>">' + bundleTemplateRow + '</tr>'; + this.templateRow = '<tr class="selection" id="' + this.idLabel + '_row_<%- data.index %>">' + bundleTemplateRow + '</tr>'; }, gridUpdateCallback: function () { diff --git a/app/code/Magento/Bundle/view/base/web/js/price-bundle.js b/app/code/Magento/Bundle/view/base/web/js/price-bundle.js index 3ddaa575917b9d656f7f420c6cc8c1ee1d5ccbe6..3ad6f45b08d40194c9515e3769daf1936de8224c 100644 --- a/app/code/Magento/Bundle/view/base/web/js/price-bundle.js +++ b/app/code/Magento/Bundle/view/base/web/js/price-bundle.js @@ -17,9 +17,9 @@ define([ qtyFieldSelector: 'input.qty', priceBoxSelector: '.price-box', optionHandlers: {}, - optionTemplate: '<%= label %>' + + optionTemplate: '<%- label %>' + '<% if (finalPrice.value) { %>' + - ' +<%= finalPrice.formatted %>' + + ' +<%- finalPrice.formatted %>' + '<% } %>', controlContainer: 'dd', // should be eliminated priceFormat: {} diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml index e1d0399f1c6ae86bf454b0dc748af3abab573262..a1439de033d8f2d99c36e968b87f8723e6d7b2b2 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/summary.phtml @@ -41,32 +41,31 @@ <ul data-mage-init='{"productSummary": []}' class="bundle items"></ul> <script data-template="bundle-summary" type="text/x-magento-template"> <li> - <strong class="label"><%= data._label_ %>:</strong> + <strong class="label"><%- data._label_ %>:</strong> <div data-container="options"></div> </li> </script> <script data-template="bundle-option" type="text/x-magento-template"> - <div><?php echo __('%1 x %2', '<%= data._quantity_ %>', '<%= data._label_ %>') ?></div> + <div><?php echo __('%1 x %2', '<%- data._quantity_ %>', '<%- data._label_ %>') ?></div> </script> </div> </div> </div> </div> -<script> - require([ - "jquery", - "mage/mage" - ], function($){ - $('.product-add-form').mage('slide', { - 'slideSpeed': 1500, - 'slideSelector': '#bundle-slide', - 'slideBackSelector': '.action.customization.back', - 'bundleProductSelector': '#bundleProduct', - 'bundleOptionsContainer': '.product-add-form', - <?php if ($block->isStartCustomization()): ?> - 'autostart': true - <?php endif;?> - }); - }); +<script type="text/x-magento-init"> + { + ".product-add-form": { + "slide": { + "slideSpeed": 1500, + "slideSelector": "#bundle-slide", + "slideBackSelector": ".action.customization.back", + "bundleProductSelector": "#bundleProduct", + "bundleOptionsContainer": ".product-add-form" + <?php if ($block->isStartCustomization()): ?> + ,"autostart": true + <?php endif;?> + } + } + } </script> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml index bf0993ce8ca8a2d5625d9ce6214f0137f1447a4d..278c7d501f22dd242e48f4c52eab73082321b236 100644 --- a/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml +++ b/app/code/Magento/Bundle/view/frontend/templates/catalog/product/view/type/bundle/options.phtml @@ -15,19 +15,15 @@ $helper = $this->helper('Magento\Catalog\Helper\Output'); <?php $options = $block->decorateArray($block->getOptions()); ?> <?php if ($product->isSaleable()):?> <?php if (count($options)): ?> -<script> -require([ - 'jquery', - 'mage/mage', - 'Magento_Bundle/js/price-bundle' -], function($){ - $(function() { - $('#product_addtocart_form').priceBundle({ - optionConfig:<?php echo $block->getJsonConfig()?>, - controlContainer: '.field.option' - }); - }); -}); +<script type="text/x-magento-init"> + { + "#product_addtocart_form": { + "priceBundle": { + "optionConfig": <?php echo $block->getJsonConfig()?>, + "controlContainer": ".field.option" + } + } + } </script> <fieldset class="fieldset bundle options"> <legend id="customizeTitle" class="legend title"> diff --git a/app/code/Magento/Captcha/etc/config.xml b/app/code/Magento/Captcha/etc/config.xml index ac0f4486c7456da6bc5e3b0b397d49b326368bcd..8c91d2c706f152873ceedd4c1da7ec8de75531d6 100644 --- a/app/code/Magento/Captcha/etc/config.xml +++ b/app/code/Magento/Captcha/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <system> <media_storage_configuration> diff --git a/app/code/Magento/Catalog/Api/CategoryLinkRepositoryInterface.php b/app/code/Magento/Catalog/Api/CategoryLinkRepositoryInterface.php index d5d2500d4b1777ddbb09f8a4a4fcda67994af507..a84719da120793448d3a12d26d4606755a219f3a 100644 --- a/app/code/Magento/Catalog/Api/CategoryLinkRepositoryInterface.php +++ b/app/code/Magento/Catalog/Api/CategoryLinkRepositoryInterface.php @@ -34,12 +34,12 @@ interface CategoryLinkRepositoryInterface /** * Remove the product assignment from the category by category id and sku * - * @param string $productSku - * @param string $productSku + * @param string $sku + * @param string $sku * @return bool will returned True if products successfully deleted * * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\StateException */ - public function deleteByIds($categoryId, $productSku); + public function deleteByIds($categoryId, $sku); } diff --git a/app/code/Magento/Catalog/Api/Data/CategoryAttributeInterface.php b/app/code/Magento/Catalog/Api/Data/CategoryAttributeInterface.php index d004784f72e0c5834889b949ba51e9f2e5d15fad..8ea0563b44b9fc26f41bf8385fc0402b1604587b 100644 --- a/app/code/Magento/Catalog/Api/Data/CategoryAttributeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/CategoryAttributeInterface.php @@ -9,6 +9,4 @@ namespace Magento\Catalog\Api\Data; interface CategoryAttributeInterface extends \Magento\Catalog\Api\Data\EavAttributeInterface { const ENTITY_TYPE_CODE = 'catalog_category'; - - const DEFAULT_ATTRIBUTE_SET_ID = 3; } diff --git a/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php b/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php index 980b3c2ae8c09d96438a8ec12737f4a1f26344fb..aec790eefd288e5d642c4859e267e7cf866e9ce2 100644 --- a/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php +++ b/app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php @@ -14,4 +14,12 @@ interface CategoryAttributeSearchResultsInterface extends \Magento\Framework\Api * @return \Magento\Catalog\Api\Data\CategoryAttributeInterface[] */ public function getItems(); + + /** + * Set attributes list. + * + * @param \Magento\Catalog\Api\Data\CategoryAttributeInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Catalog/Api/Data/CategoryInterface.php b/app/code/Magento/Catalog/Api/Data/CategoryInterface.php index fe49eab7d10b1a5e31e3bb7319ec0a14658fc9e8..8ca5780579cf2f6062e9ba8df686e1f0eba56463 100644 --- a/app/code/Magento/Catalog/Api/Data/CategoryInterface.php +++ b/app/code/Magento/Catalog/Api/Data/CategoryInterface.php @@ -8,7 +8,7 @@ namespace Magento\Catalog\Api\Data; -interface CategoryInterface extends \Magento\Framework\Api\ExtensibleDataInterface +interface CategoryInterface extends \Magento\Framework\Api\CustomAttributesDataInterface { /** * @return int|null @@ -149,4 +149,19 @@ interface CategoryInterface extends \Magento\Framework\Api\ExtensibleDataInterfa * @return $this */ public function setIncludeInMenu($includeInMenu); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Catalog\Api\Data\CategoryExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\CategoryExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Catalog\Api\Data\CategoryExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Catalog/Api/Data/CategoryProductLinkInterface.php b/app/code/Magento/Catalog/Api/Data/CategoryProductLinkInterface.php index 04b8f8fe5b7a54c2e3dc4fa3857b7b8db5b9ad8b..ba9b235f9f4032658509039c0b970ae51fb2699d 100644 --- a/app/code/Magento/Catalog/Api/Data/CategoryProductLinkInterface.php +++ b/app/code/Magento/Catalog/Api/Data/CategoryProductLinkInterface.php @@ -6,7 +6,9 @@ namespace Magento\Catalog\Api\Data; -interface CategoryProductLinkInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface CategoryProductLinkInterface extends ExtensibleDataInterface { /** * @return string|null @@ -44,4 +46,21 @@ interface CategoryProductLinkInterface * @return $this */ public function setCategoryId($categoryId); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\CategoryProductLinkExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\CategoryProductLinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\CategoryProductLinkExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/CategoryTreeInterface.php b/app/code/Magento/Catalog/Api/Data/CategoryTreeInterface.php index 42f5b2c56edef8d7f18e5e438848538ecb0d10bb..66078497c25e0c479eded4aedea9fe8610a5688e 100644 --- a/app/code/Magento/Catalog/Api/Data/CategoryTreeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/CategoryTreeInterface.php @@ -7,7 +7,7 @@ namespace Magento\Catalog\Api\Data; -interface CategoryTreeInterface extends \Magento\Framework\Api\ExtensibleDataInterface +interface CategoryTreeInterface { /** * @return int|null diff --git a/app/code/Magento/Catalog/Api/Data/EavAttributeInterface.php b/app/code/Magento/Catalog/Api/Data/EavAttributeInterface.php index 02e9c54f2dc400c37bdf46044bd1fcea28cc0824..6fa35baa0f9a8257a9ad6a128477aa9321c5d11c 100644 --- a/app/code/Magento/Catalog/Api/Data/EavAttributeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/EavAttributeInterface.php @@ -275,4 +275,9 @@ interface EavAttributeInterface extends \Magento\Eav\Api\Data\AttributeInterface * @return $this */ public function setScope($scope); + + /** + * @return \Magento\Catalog\Api\Data\EavAttributeExtensionInterface|null + */ + public function getExtensionAttributes(); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeDataBuilder.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeDataBuilder.php deleted file mode 100644 index c921729a91e0b5cc33de9d6ce3edc6915c8ac8d9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Catalog/Api/Data/ProductAttributeDataBuilder.php +++ /dev/null @@ -1,382 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Catalog\Api\Data; - -use Magento\Framework\Api\MetadataServiceInterface; -use Magento\Framework\Api\ObjectFactory; - -/** - * DataBuilder class for \Magento\Catalog\Api\Data\ProductAttributeInterface - * @codeCoverageIgnore - */ -class ProductAttributeDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * @param ObjectFactory $objectFactory - * @param MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string $modelClassInterface - */ - public function __construct( - ObjectFactory $objectFactory, - MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = 'Magento\Catalog\Api\Data\ProductAttributeInterface' - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - $modelClassInterface - ); - } - - /** - * @param bool|null $isWysiwygEnabled - * @return $this - */ - public function setIsWysiwygEnabled($isWysiwygEnabled) - { - $this->_set('is_wysiwyg_enabled', $isWysiwygEnabled); - return $this; - } - - /** - * @param bool|null $isHtmlAllowedOnFront - * @return $this - */ - public function setIsHtmlAllowedOnFront($isHtmlAllowedOnFront) - { - $this->_set('is_html_allowed_on_front', $isHtmlAllowedOnFront); - return $this; - } - - /** - * @param bool|null $usedForSortBy - * @return $this - */ - public function setUsedForSortBy($usedForSortBy) - { - $this->_set('used_for_sort_by', $usedForSortBy); - return $this; - } - - /** - * @param bool|null $isFilterable - * @return $this - */ - public function setIsFilterable($isFilterable) - { - $this->_set('is_filterable', $isFilterable); - return $this; - } - - /** - * @param bool|null $isFilterableInSearch - * @return $this - */ - public function setIsFilterableInSearch($isFilterableInSearch) - { - $this->_set('is_filterable_in_search', $isFilterableInSearch); - return $this; - } - - /** - * @param int|null $position - * @return $this - */ - public function setPosition($position) - { - $this->_set('position', $position); - return $this; - } - - /** - * @param string $applyTo - * @return $this - */ - public function setApplyTo($applyTo) - { - $this->_set('apply_to', $applyTo); - return $this; - } - - /** - * @param string|null $isSearchable - * @return $this - */ - public function setIsSearchable($isSearchable) - { - $this->_set('is_searchable', $isSearchable); - return $this; - } - - /** - * @param string|null $isVisibleInAdvancedSearch - * @return $this - */ - public function setIsVisibleInAdvancedSearch($isVisibleInAdvancedSearch) - { - $this->_set('is_visible_in_advanced_search', $isVisibleInAdvancedSearch); - return $this; - } - - /** - * @param string|null $isComparable - * @return $this - */ - public function setIsComparable($isComparable) - { - $this->_set('is_comparable', $isComparable); - return $this; - } - - /** - * @param string|null $isUsedForPromoRules - * @return $this - */ - public function setIsUsedForPromoRules($isUsedForPromoRules) - { - $this->_set('is_used_for_promo_rules', $isUsedForPromoRules); - return $this; - } - - /** - * @param string|null $isVisibleOnFront - * @return $this - */ - public function setIsVisibleOnFront($isVisibleOnFront) - { - $this->_set('is_visible_on_front', $isVisibleOnFront); - return $this; - } - - /** - * @param string|null $usedInProductListing - * @return $this - */ - public function setUsedInProductListing($usedInProductListing) - { - $this->_set('used_in_product_listing', $usedInProductListing); - return $this; - } - - /** - * @param bool|null $isVisible - * @return $this - */ - public function setIsVisible($isVisible) - { - $this->_set('is_visible', $isVisible); - return $this; - } - - /** - * @param string|null $scope - * @return $this - */ - public function setScope($scope) - { - $this->_set('scope', $scope); - return $this; - } - - /** - * @param int|null $attributeId - * @return $this - */ - public function setAttributeId($attributeId) - { - $this->_set('attribute_id', $attributeId); - return $this; - } - - /** - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode) - { - $this->_set('attribute_code', $attributeCode); - return $this; - } - - /** - * @param string $frontendInput - * @return $this - */ - public function setFrontendInput($frontendInput) - { - $this->_set('frontend_input', $frontendInput); - return $this; - } - - /** - * @param string|null $entityTypeId - * @return $this - */ - public function setEntityTypeId($entityTypeId) - { - $this->_set('entity_type_id', $entityTypeId); - return $this; - } - - /** - * @param bool $isRequired - * @return $this - */ - public function setIsRequired($isRequired) - { - $this->_set('is_required', $isRequired); - return $this; - } - - /** - * @param \Magento\Eav\Api\Data\AttributeOptionInterface $options - * @return $this - */ - public function setOptions($options) - { - $this->_set('options', $options); - return $this; - } - - /** - * @param bool|null $isUserDefined - * @return $this - */ - public function setIsUserDefined($isUserDefined) - { - $this->_set('is_user_defined', $isUserDefined); - return $this; - } - - /** - * @param string $frontendLabel - * @return $this - */ - public function setDefaultFrontendLabel($frontendLabel) - { - $this->_set('frontend_label', $frontendLabel); - return $this; - } - - /** - * @param \Magento\Eav\Api\Data\AttributeFrontendLabelInterface[] - * $storeFrontendLabels - * @return $this - */ - public function setFrontendLabels($storeFrontendLabels) - { - $this->_set('frontend_labels', $storeFrontendLabels); - return $this; - } - - /** - * @param string|null $note - * @return $this - */ - public function setNote($note) - { - $this->_set('note', $note); - return $this; - } - - /** - * @param string|null $backendType - * @return $this - */ - public function setBackendType($backendType) - { - $this->_set('backend_type', $backendType); - return $this; - } - - /** - * @param string|null $backendModel - * @return $this - */ - public function setBackendModel($backendModel) - { - $this->_set('backend_model', $backendModel); - return $this; - } - - /** - * @param string|null $sourceModel - * @return $this - */ - public function setSourceModel($sourceModel) - { - $this->_set('source_model', $sourceModel); - return $this; - } - - /** - * @param string|null $defaultValue - * @return $this - */ - public function setDefaultValue($defaultValue) - { - $this->_set('default_value', $defaultValue); - return $this; - } - - /** - * @param string|null $isUnique - * @return $this - */ - public function setIsUnique($isUnique) - { - $this->_set('is_unique', $isUnique); - return $this; - } - - /** - * @param string|null $frontendClass - * @return $this - */ - public function setFrontendClass($frontendClass) - { - $this->_set('frontend_class', $frontendClass); - return $this; - } - - /** - * @param \Magento\Eav\Api\Data\AttributeValidationRuleInterface $validationRules - * @return $this - */ - public function setValidationRules($validationRules) - { - $this->_set('validation_rules', $validationRules); - return $this; - } - - /** - * {@inheritdoc} - */ - public function create() - { - /** TODO: temporary fix while problem with hasDataChanges flag not solved. MAGETWO-30324 */ - $object = parent::create(); - $object->setDataChanges(true); - return $object; - } -} diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php index a6ec3a93a7d2f81c5aec4803515df9525c0a28bb..7ebf031245f8487597af670ed8c88446161c2e8a 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php @@ -9,6 +9,4 @@ namespace Magento\Catalog\Api\Data; interface ProductAttributeInterface extends \Magento\Catalog\Api\Data\EavAttributeInterface { const ENTITY_TYPE_CODE = 'catalog_product'; - - const DEFAULT_ATTRIBUTE_SET_ID = 4; } diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryContentInterface.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryContentInterface.php index f6651f1caf686750296ee754e5d33b21a69e05d4..ccad19926c342f7a16a46c67897fcac8da48f769 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryContentInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryContentInterface.php @@ -1,13 +1,17 @@ <?php /** - * Product Media Content - * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Api\Data; -interface ProductAttributeMediaGalleryEntryContentInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +/** + * Product Media Content + */ +interface ProductAttributeMediaGalleryEntryContentInterface extends ExtensibleDataInterface { const DATA = 'entry_data'; const MIME_TYPE = 'mime_type'; @@ -57,4 +61,21 @@ interface ProductAttributeMediaGalleryEntryContentInterface * @return $this */ public function setName($name); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryInterface.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryInterface.php index 1d9a494a8958f04aab057c7a0cb72ebd06dc9107..afac0c209edd87374d0bfbcfd40655e131a0dcc3 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryInterface.php @@ -7,14 +7,17 @@ */ namespace Magento\Catalog\Api\Data; -interface ProductAttributeMediaGalleryEntryInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface ProductAttributeMediaGalleryEntryInterface extends ExtensibleDataInterface { const ID = 'id'; const LABEL = 'label'; const POSITION = 'position'; - const DISABLED = 'is_disabled'; + const DISABLED = 'disabled'; const TYPES = 'types'; const FILE = 'file'; + const CONTENT = 'content'; /** * Retrieve gallery entry ID @@ -52,7 +55,7 @@ interface ProductAttributeMediaGalleryEntryInterface * @return int */ public function getPosition(); - + /** * Set gallery entry position (sort order) * @@ -65,17 +68,16 @@ interface ProductAttributeMediaGalleryEntryInterface * Check if gallery entry is hidden from product page * * @return bool - * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ - public function getIsDisabled(); + public function isDisabled(); /** * Set whether gallery entry is hidden from product page * - * @param bool $isDisabled + * @param bool $disabled * @return $this */ - public function setIsDisabled($isDisabled); + public function setDisabled($disabled); /** * Retrieve gallery entry image types (thumbnail, image, small_image etc) @@ -106,4 +108,36 @@ interface ProductAttributeMediaGalleryEntryInterface * @return $this */ public function setFile($file); + + /** + * Get media gallery content + * + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface|null + */ + public function getContent(); + + /** + * Set media gallery content + * + * @param $content \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface + * @return $this + */ + public function setContent($content); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php index ab76e76994740fd51f91ab15818f6a029a37ab9f..0f1424a7c489536614597e1471ba315d09f7a17d 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php @@ -14,4 +14,12 @@ interface ProductAttributeSearchResultsInterface extends \Magento\Framework\Api\ * @return \Magento\Catalog\Api\Data\ProductAttributeInterface[] */ public function getItems(); + + /** + * Set attributes list. + * + * @param \Magento\Catalog\Api\Data\ProductAttributeInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeTypeInterface.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeTypeInterface.php index 759f359748a8dcf15d875a9f747cd3c473346391..eebbfb307a252827cc567bd3217d640471222f69 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductAttributeTypeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductAttributeTypeInterface.php @@ -1,12 +1,14 @@ <?php /** - * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Api\Data; -interface ProductAttributeTypeInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface ProductAttributeTypeInterface extends ExtensibleDataInterface { const VALUE = 'value'; @@ -41,4 +43,21 @@ interface ProductAttributeTypeInterface * @return $this */ public function setLabel($label); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductAttributeTypeExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductAttributeTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductAttributeTypeExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductCustomOptionInterface.php b/app/code/Magento/Catalog/Api/Data/ProductCustomOptionInterface.php index 8a2183bf8e8cd61f095b8daf8a6fc97050dd5a9b..352df7305118b354b5a21e560d3bb0a48ace8376 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductCustomOptionInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductCustomOptionInterface.php @@ -18,10 +18,10 @@ interface ProductCustomOptionInterface /** * Set product SKU * - * @param string $productSku + * @param string $sku * @return $this */ - public function setProductSku($productSku); + public function setProductSku($sku); /** * Get option id diff --git a/app/code/Magento/Catalog/Api/Data/ProductCustomOptionTypeInterface.php b/app/code/Magento/Catalog/Api/Data/ProductCustomOptionTypeInterface.php index c4f137a0cb355e74c415cf78e9728324d055e795..6a562efc3b0c73326f9d1c9a436325414f77ba72 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductCustomOptionTypeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductCustomOptionTypeInterface.php @@ -6,7 +6,9 @@ namespace Magento\Catalog\Api\Data; -interface ProductCustomOptionTypeInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface ProductCustomOptionTypeInterface extends ExtensibleDataInterface { /** * Get option type label @@ -52,4 +54,21 @@ interface ProductCustomOptionTypeInterface * @return $this */ public function setGroup($group); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductCustomOptionTypeExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductCustomOptionTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductCustomOptionTypeExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php b/app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php index 9e2162f41f2439a5e4fa82ddaa70f4293f636465..4c2b9bd80abc1e3bdbc62958d9cd5fd0739798ec 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php @@ -6,7 +6,9 @@ */ namespace Magento\Catalog\Api\Data; -interface ProductGroupPriceInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface ProductGroupPriceInterface extends ExtensibleDataInterface { /** * Retrieve customer group id @@ -37,4 +39,21 @@ interface ProductGroupPriceInterface * @return $this */ public function setValue($value); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductInterface.php b/app/code/Magento/Catalog/Api/Data/ProductInterface.php index b0021ca89cdfa04e3e126784bad1f08dd460fb0b..34eed7fdf7bab210c1ff8c75a6690973bcc1cbca 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductInterface.php @@ -7,7 +7,7 @@ namespace Magento\Catalog\Api\Data; -interface ProductInterface extends \Magento\Framework\Api\ExtensibleDataInterface +interface ProductInterface extends \Magento\Framework\Api\CustomAttributesDataInterface { /**#@+ * Constants defined for keys of data array @@ -214,4 +214,19 @@ interface ProductInterface extends \Magento\Framework\Api\ExtensibleDataInterfac * @return $this */ public function setWeight($weight); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Catalog\Api\Data\ProductExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductLinkAttributeInterface.php b/app/code/Magento/Catalog/Api/Data/ProductLinkAttributeInterface.php index 794d60b99b6c9d793e2ad957474b7152cbbf0938..bad462ff801c942b967308d12e30c5a68199a66c 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductLinkAttributeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductLinkAttributeInterface.php @@ -6,7 +6,9 @@ namespace Magento\Catalog\Api\Data; -interface ProductLinkAttributeInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface ProductLinkAttributeInterface extends ExtensibleDataInterface { /** * Get attribute code @@ -37,4 +39,21 @@ interface ProductLinkAttributeInterface * @return $this */ public function setType($type); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductLinkAttributeExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductLinkAttributeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductLinkAttributeExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductLinkInterface.php b/app/code/Magento/Catalog/Api/Data/ProductLinkInterface.php index ddf61179c1507b0b18198a09bf7694eb31265946..7a19d3c465a4b77d79b910e641c4333193c74e0e 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductLinkInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductLinkInterface.php @@ -18,10 +18,10 @@ interface ProductLinkInterface extends \Magento\Framework\Api\ExtensibleDataInte /** * Set product SKU * - * @param string $productSku + * @param string $sku * @return $this */ - public function setProductSku($productSku); + public function setProductSku($sku); /** * Get link type @@ -82,4 +82,21 @@ interface ProductLinkInterface extends \Magento\Framework\Api\ExtensibleDataInte * @return $this */ public function setPosition($position); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Catalog\Api\Data\ProductLinkExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductLinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductLinkExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductLinkSearchResults.php b/app/code/Magento/Catalog/Api/Data/ProductLinkSearchResults.php deleted file mode 100644 index bfd0f7689c7ac31702543634b62c2a06542266b6..0000000000000000000000000000000000000000 --- a/app/code/Magento/Catalog/Api/Data/ProductLinkSearchResults.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Catalog\Api\Data; - -/** - * @codeCoverageIgnore - */ -class ProductLinkSearchResults extends \Magento\Framework\Api\SearchResults -{ - /** - * Get items - * - * @return \Magento\Catalog\Api\Data\ProductLinkInterface[] - */ - public function getItems() - { - return parent::getItems(); - } -} diff --git a/app/code/Magento/Catalog/Api/Data/ProductLinkTypeInterface.php b/app/code/Magento/Catalog/Api/Data/ProductLinkTypeInterface.php index 617f9cde2c1ebad2ff2f71c6a54c4b79c590e462..a5863c09f5f099eb772b9412423523496e87c1b8 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductLinkTypeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductLinkTypeInterface.php @@ -6,7 +6,9 @@ namespace Magento\Catalog\Api\Data; -interface ProductLinkTypeInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface ProductLinkTypeInterface extends ExtensibleDataInterface { /** * Get link type code @@ -37,4 +39,21 @@ interface ProductLinkTypeInterface * @return $this */ public function setName($name); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductLinkTypeExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductLinkTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductLinkTypeExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php b/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php index d3ef0bec79d055b584fd5fc211e6f627da677d9b..7349ab87124cf7e9c1a33e38814e24b0a79d4fff 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php @@ -14,4 +14,12 @@ interface ProductSearchResultsInterface extends \Magento\Framework\Api\SearchRes * @return \Magento\Catalog\Api\Data\ProductInterface[] */ public function getItems(); + + /** + * Set attributes list. + * + * @param \Magento\Catalog\Api\Data\ProductInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php b/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php index ee7f92d622bb929128188ce385137db23a43f5e5..bee553af0f504824cb8c85b50d2a4c0fa485f9fe 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductTierPriceInterface.php @@ -7,10 +7,12 @@ namespace Magento\Catalog\Api\Data; +use Magento\Framework\Api\ExtensibleDataInterface; + /** * @todo remove this interface if framework support return array */ -interface ProductTierPriceInterface +interface ProductTierPriceInterface extends ExtensibleDataInterface { const QTY = 'qty'; @@ -45,4 +47,21 @@ interface ProductTierPriceInterface * @return $this */ public function setValue($value); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductTierPriceExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductTierPriceExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductTierPriceExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/Data/ProductTypeInterface.php b/app/code/Magento/Catalog/Api/Data/ProductTypeInterface.php index 0d888145c3fd6db515c5d92f22d9512c84b598a1..50599c36231e1b74611c1c1238d05c541627b53f 100644 --- a/app/code/Magento/Catalog/Api/Data/ProductTypeInterface.php +++ b/app/code/Magento/Catalog/Api/Data/ProductTypeInterface.php @@ -1,13 +1,17 @@ <?php /** - * Product type details - * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Api\Data; -interface ProductTypeInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +/** + * Product type details + */ +interface ProductTypeInterface extends ExtensibleDataInterface { /** * Get product type code @@ -38,4 +42,21 @@ interface ProductTypeInterface * @return $this */ public function setLabel($label); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Catalog\Api\Data\ProductTypeExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Catalog\Api\Data\ProductTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductTypeExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php b/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php index c0e4cd9b0d8fc44291a8f75f1bb2f3850cda35fa..2dfe8e5a30976dfeb65d37dd337bf73382d81093 100644 --- a/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php +++ b/app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php @@ -16,26 +16,18 @@ interface ProductAttributeMediaGalleryManagementInterface /** * Create new gallery entry * - * @param string $productSku - * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry - * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface $entryContent - * @param int $storeId + * @param \Magento\Catalog\Api\Data\ProductInterface $product * @return int gallery entry ID * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ - public function create( - $productSku, - \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry, - \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface $entryContent, - $storeId = 0 - ); + public function create($product); /** * Update gallery entry * - * @param string $productSku + * @param string $sku * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry * @param int $storeId * @return bool @@ -43,7 +35,7 @@ interface ProductAttributeMediaGalleryManagementInterface * @throws \Magento\Framework\Exception\StateException */ public function update( - $productSku, + $sku, \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface $entry, $storeId = 0 ); @@ -51,29 +43,29 @@ interface ProductAttributeMediaGalleryManagementInterface /** * Remove gallery entry * - * @param string $productSku + * @param string $sku * @param int $entryId * @return bool * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ - public function remove($productSku, $entryId); + public function remove($sku, $entryId); /** * Return information about gallery entry * - * @param string $productSku + * @param string $sku * @param int $imageId * @throws \Magento\Framework\Exception\NoSuchEntityException * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface */ - public function get($productSku, $imageId); + public function get($sku, $imageId); /** * Retrieve the list of gallery entries associated with given product * - * @param string $productSku + * @param string $sku * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[] */ - public function getList($productSku); + public function getList($sku); } diff --git a/app/code/Magento/Catalog/Api/ProductCustomOptionRepositoryInterface.php b/app/code/Magento/Catalog/Api/ProductCustomOptionRepositoryInterface.php index 1b2329931b1a9dceb34256716b58aad2c548e9a8..50b45a3b3dc8b283eaf8ea6431fb365814461b83 100644 --- a/app/code/Magento/Catalog/Api/ProductCustomOptionRepositoryInterface.php +++ b/app/code/Magento/Catalog/Api/ProductCustomOptionRepositoryInterface.php @@ -11,19 +11,19 @@ interface ProductCustomOptionRepositoryInterface /** * Get the list of custom options for a specific product * - * @param string $productSku + * @param string $sku * @return \Magento\Catalog\Api\Data\ProductCustomOptionInterface[] */ - public function getList($productSku); + public function getList($sku); /** * Get custom option for a specific product * - * @param string $productSku + * @param string $sku * @param int $optionId * @return \Magento\Catalog\Api\Data\ProductCustomOptionInterface */ - public function get($productSku, $optionId); + public function get($sku, $optionId); /** * Delete custom option from product @@ -42,9 +42,9 @@ interface ProductCustomOptionRepositoryInterface public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $option); /** - * @param string $productSku + * @param string $sku * @param int $optionId * @return bool */ - public function deleteByIdentifier($productSku, $optionId); + public function deleteByIdentifier($sku, $optionId); } diff --git a/app/code/Magento/Catalog/Api/ProductGroupPriceManagementInterface.php b/app/code/Magento/Catalog/Api/ProductGroupPriceManagementInterface.php index 7278ab50c342f3493457210e665a2cac4e2b5303..bbe7fdc66fd87a18b69c7b80658b96edc30b4a2a 100644 --- a/app/code/Magento/Catalog/Api/ProductGroupPriceManagementInterface.php +++ b/app/code/Magento/Catalog/Api/ProductGroupPriceManagementInterface.php @@ -12,32 +12,32 @@ interface ProductGroupPriceManagementInterface /** * Set group price for product * - * @param string $productSku + * @param string $sku * @param int $customerGroupId * @param float $price * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function add($productSku, $customerGroupId, $price); + public function add($sku, $customerGroupId, $price); /** * Remove group price from product * - * @param string $productSku + * @param string $sku * @param int $customerGroupId * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function remove($productSku, $customerGroupId); + public function remove($sku, $customerGroupId); /** * Retrieve list of product prices * - * @param string $productSku + * @param string $sku * @return \Magento\Catalog\Api\Data\ProductGroupPriceInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function getList($productSku); + public function getList($sku); } diff --git a/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php b/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php index 3daf804de0af0c205a3ac4d02cd91006e99ea45c..ee2ef0f062eab8ea68eea1fa9045272deb4f18e3 100644 --- a/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php +++ b/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php @@ -11,21 +11,21 @@ interface ProductLinkManagementInterface /** * Provide the list of links for a specific product * - * @param string $productSku + * @param string $sku * @param string $type * @return \Magento\Catalog\Api\Data\ProductLinkInterface[] */ - public function getLinkedItemsByType($productSku, $type); + public function getLinkedItemsByType($sku, $type); /** * Assign a product link to another product * - * @param string $productSku + * @param string $sku * @param string $type * @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $items * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool */ - public function setProductLinks($productSku, $type, array $items); + public function setProductLinks($sku, $type, array $items); } diff --git a/app/code/Magento/Catalog/Api/ProductLinkRepositoryInterface.php b/app/code/Magento/Catalog/Api/ProductLinkRepositoryInterface.php index 6af76811e585739e6e9469f82eabfcc3f4fcbef3..7b4d79d902b25835e6a28d09bb8622deef61f89f 100644 --- a/app/code/Magento/Catalog/Api/ProductLinkRepositoryInterface.php +++ b/app/code/Magento/Catalog/Api/ProductLinkRepositoryInterface.php @@ -32,12 +32,12 @@ interface ProductLinkRepositoryInterface public function delete(\Magento\Catalog\Api\Data\ProductLinkInterface $entity); /** - * @param string $productSku + * @param string $sku * @param string $type * @param string $linkedProductSku * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool */ - public function deleteById($productSku, $type, $linkedProductSku); + public function deleteById($sku, $type, $linkedProductSku); } diff --git a/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php index bad476db4bc439ebe7fac316453722a6b30be650..8205f68fca6095f9d516c01f5ad04be1a8515725 100644 --- a/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php +++ b/app/code/Magento/Catalog/Api/ProductRepositoryInterface.php @@ -24,13 +24,13 @@ interface ProductRepositoryInterface /** * Get info about product by product SKU * - * @param string $productSku + * @param string $sku * @param bool $editMode * @param null|int $storeId * @return \Magento\Catalog\Api\Data\ProductInterface * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function get($productSku, $editMode = false, $storeId = null); + public function get($sku, $editMode = false, $storeId = null); /** * Get info about product by product id @@ -53,12 +53,12 @@ interface ProductRepositoryInterface public function delete(\Magento\Catalog\Api\Data\ProductInterface $product); /** - * @param string $productSku + * @param string $sku * @return bool Will returned True if deleted * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ - public function deleteById($productSku); + public function deleteById($sku); /** * Get product list diff --git a/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php b/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php index 1f9dea7edc06e66a7bd0d09ab747867b9fc159db..c8e3a5361e72acfe0ca9e68ac64ed934037e52df 100644 --- a/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php +++ b/app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php @@ -11,7 +11,7 @@ interface ProductTierPriceManagementInterface /** * Create tier price for product * - * @param string $productSku + * @param string $sku * @param string $customerGroupId * @param float $price * @param float $qty @@ -19,27 +19,27 @@ interface ProductTierPriceManagementInterface * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function add($productSku, $customerGroupId, $price, $qty); + public function add($sku, $customerGroupId, $price, $qty); /** * Remove tire price from product * - * @param string $productSku + * @param string $sku * @param string $customerGroupId * @param float $qty * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function remove($productSku, $customerGroupId, $qty); + public function remove($sku, $customerGroupId, $qty); /** * Get tire price of product * - * @param string $productSku + * @param string $sku * @param string $customerGroupId * @return \Magento\Catalog\Api\Data\ProductTierPriceInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function getList($productSku, $customerGroupId); + public function getList($sku, $customerGroupId); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php index 484472fd3bbafa7f1086319146cc7ec3b8559ab3..088cc75846d5e136cba16d11f81dbb2889bda6cd 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php @@ -209,11 +209,11 @@ class Option extends Widget 'Magento\Framework\View\Element\Html\Select' )->setData( [ - 'id' => $this->getFieldId() . '_<%= data.id %>_type', + 'id' => $this->getFieldId() . '_<%- data.id %>_type', 'class' => 'select select-product-option-type required-option-select', ] )->setName( - $this->getFieldName() . '[<%= data.id %>][type]' + $this->getFieldName() . '[<%- data.id %>][type]' )->setOptions( $this->_optionType->toOptionArray() ); @@ -229,9 +229,9 @@ class Option extends Widget $select = $this->getLayout()->createBlock( 'Magento\Framework\View\Element\Html\Select' )->setData( - ['id' => $this->getFieldId() . '_<%= data.id %>_is_require', 'class' => 'select'] + ['id' => $this->getFieldId() . '_<%- data.id %>_is_require', 'class' => 'select'] )->setName( - $this->getFieldName() . '[<%= data.id %>][is_require]' + $this->getFieldName() . '[<%- data.id %>][is_require]' )->setOptions( $this->_configYesNo->toOptionArray() ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php index 95a350a34581ce626025e9fff6b5a55e4800eeef..b4c8d96bbdc11a4d47cafb77d8121a9c46d40e52 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/AbstractType.php @@ -50,7 +50,7 @@ class AbstractType extends \Magento\Backend\Block\Widget $this->getNameInLayout() )->setData( [ - 'id' => 'product_option_<%= data.option_id %>_price_type', + 'id' => 'product_option_<%- data.option_id %>_price_type', 'class' => 'select product-option-price-type', ] ) @@ -59,7 +59,7 @@ class AbstractType extends \Magento\Backend\Block\Widget $this->getChildBlock( 'option_price_type' )->setName( - 'product[options][<%= data.option_id %>][price_type]' + 'product[options][<%- data.option_id %>][price_type]' )->setOptions( $this->_optionPrice->toOptionArray() ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php index f8c00955c853765aded7e6d014b07235688981ef..c91c09dcb9f15fe552930a1bd7a4e03bd3350deb 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/Select.php @@ -42,7 +42,7 @@ class Select extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\T [ 'label' => __('Add New Row'), 'class' => 'add add-select-row', - 'id' => 'product_option_<%= data.option_id %>_add_select_row' + 'id' => 'product_option_<%- data.option_id %>_add_select_row' ] ); @@ -52,7 +52,7 @@ class Select extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\T [ 'label' => __('Delete Row'), 'class' => 'delete delete-select-row icon-btn', - 'id' => 'product_option_<%= data.id %>_select_<%= data.select_id %>_delete' + 'id' => 'product_option_<%- data.id %>_select_<%- data.select_id %>_delete' ] ); @@ -87,9 +87,9 @@ class Select extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\T 'option_price_type' )->setData( 'id', - 'product_option_<%= data.id %>_select_<%= data.select_id %>_price_type' + 'product_option_<%- data.id %>_select_<%- data.select_id %>_price_type' )->setName( - 'product[options][<%= data.id %>][values][<%= data.select_id %>][price_type]' + 'product[options][<%- data.id %>][values][<%- data.select_id %>][price_type]' )->setExtraParams($extraParams); return parent::getPriceTypeSelectHtml(); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php index 5bca99812e4c5afc4d71c7a25df3cd9aa62d11ac..859fd53ef081612b52e3f05bd99c7d83da33c254 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php @@ -66,9 +66,9 @@ abstract class AbstractGroup extends Widget implements RendererInterface protected $_groupManagement; /** - * @var \Magento\Framework\Api\SearchCriteriaDataBuilder + * @var \Magento\Framework\Api\SearchCriteriaBuilder */ - protected $_searchCriteriaDataBuilder; + protected $_searchCriteriaBuilder; /** * @param \Magento\Backend\Block\Template\Context $context @@ -77,7 +77,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface * @param \Magento\Framework\Module\Manager $moduleManager * @param \Magento\Framework\Registry $registry * @param GroupManagementInterface $groupManagement - * @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaDataBuilder + * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param array $data */ public function __construct( @@ -87,7 +87,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface \Magento\Framework\Module\Manager $moduleManager, \Magento\Framework\Registry $registry, GroupManagementInterface $groupManagement, - \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaDataBuilder, + \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, array $data = [] ) { $this->_groupRepository = $groupRepository; @@ -95,7 +95,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface $this->moduleManager = $moduleManager; $this->_coreRegistry = $registry; $this->_groupManagement = $groupManagement; - $this->_searchCriteriaDataBuilder = $searchCriteriaDataBuilder; + $this->_searchCriteriaBuilder = $searchCriteriaBuilder; parent::__construct($context, $data); } @@ -191,7 +191,7 @@ abstract class AbstractGroup extends Widget implements RendererInterface } $this->_customerGroups = $this->_getInitialCustomerGroups(); /** @var \Magento\Customer\Api\Data\GroupInterface[] $groups */ - $groups = $this->_groupRepository->getList($this->_searchCriteriaDataBuilder->create()); + $groups = $this->_groupRepository->getList($this->_searchCriteriaBuilder->create()); foreach ($groups->getItems() as $group) { $this->_customerGroups[$group->getId()] = $group->getCode(); } 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 31d3710ebdf2efc9df5285219fd7284e6d7fd7b5..e38a5d08f8915b29c03e0c3a72671669495a7d24 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 @@ -105,9 +105,9 @@ class BaseImage extends \Magento\Framework\Data\Form\Element\AbstractElement <img class="spacer" src="{$spacerImage}"/> <img class="product-image" - src="<%= data.url %>" - data-position="<%= data.position %>" - alt="<%= data.label %>" /> + src="<%- data.url %>" + data-position="<%- data.position %>" + alt="<%- data.label %>" /> <div class="actions"> <button type="button" class="action-delete" data-role="delete-button" title="{$deleteImageText}"> <span>{$deleteImageText}</span> diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php index 09c968830b1e8aeb78e6a6759634efd12e2a872b..26665c88a5f2fef3e5f49a91dee577a14a0e6415 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php @@ -74,7 +74,7 @@ class MassStatus extends \Magento\Catalog\Controller\Adminhtml\Product ->updateAttributes($productIds, ['status' => $status], $storeId); $this->messageManager->addSuccess(__('A total of %1 record(s) have been updated.', count($productIds))); $this->_productPriceIndexerProcessor->reindexList($productIds); - } catch (\Magento\Core\Model\Exception $e) { + } catch (\Magento\Framework\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php index befec2129c66c23d71061597defe3af86ec77b46..e22d3b2dcd39a2a8ad3138842d69d418ff8df874 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php @@ -9,6 +9,11 @@ namespace Magento\Catalog\Controller\Adminhtml\Product; use Magento\Backend\App\Action; use Magento\Catalog\Controller\Adminhtml\Product; +/** + * Product validate + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product { /** @@ -31,6 +36,9 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product */ protected $layoutFactory; + /** @var \Magento\Catalog\Model\ProductFactory */ + protected $productFactory; + /** * @param Action\Context $context * @param Builder $productBuilder @@ -38,6 +46,7 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product * @param \Magento\Catalog\Model\Product\Validator $productValidator * @param \Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory * @param \Magento\Framework\View\LayoutFactory $layoutFactory + * @param \Magento\Catalog\Model\ProductFactory $productFactory */ public function __construct( \Magento\Backend\App\Action\Context $context, @@ -45,13 +54,15 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter, \Magento\Catalog\Model\Product\Validator $productValidator, \Magento\Framework\Controller\Result\JSONFactory $resultJsonFactory, - \Magento\Framework\View\LayoutFactory $layoutFactory + \Magento\Framework\View\LayoutFactory $layoutFactory, + \Magento\Catalog\Model\ProductFactory $productFactory ) { $this->_dateFilter = $dateFilter; $this->productValidator = $productValidator; parent::__construct($context, $productBuilder); $this->resultJsonFactory = $resultJsonFactory; $this->layoutFactory = $layoutFactory; + $this->productFactory = $productFactory; } /** @@ -73,13 +84,13 @@ class Validate extends \Magento\Catalog\Controller\Adminhtml\Product $productData['stock_data']['use_config_manage_stock'] = 0; } /* @var $product \Magento\Catalog\Model\Product */ - $product = $this->_objectManager->create('Magento\Catalog\Model\Product'); + $product = $this->productFactory->create(); $product->setData('_edit_mode', true); $storeId = $this->getRequest()->getParam('store'); if ($storeId) { $product->setStoreId($storeId); } - $setId = $this->getRequest()->getParam('set'); + $setId = $this->getRequest()->getPost('set'); if ($setId) { $product->setAttributeSetId($setId); } diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php index 19c70245700c41c2c56f1f42aa645ab8a4f23cc5..738a88b5c04c9a1fafbc77c767c1e20e544c3967 100644 --- a/app/code/Magento/Catalog/Model/AbstractModel.php +++ b/app/code/Magento/Catalog/Model/AbstractModel.php @@ -62,7 +62,7 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractExtensible /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -72,7 +72,7 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractExtensible public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -83,7 +83,7 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractExtensible parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index 2a0519a89d625cfaef579fe6f3bcae92d10573e9..38261678195d2dc4f1041cd0dc1dbb0b5be0747a 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -189,12 +189,18 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements */ protected $categoryRepository; + /** + * @var \Magento\Framework\Api\MetadataServiceInterface + */ + protected $metadataService; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService * @param Resource\Category\Tree $categoryTreeResource * @param Resource\Category\TreeFactory $categoryTreeFactory * @param \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory @@ -215,9 +221,10 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService, \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource, \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory, \Magento\Store\Model\Resource\Store\CollectionFactory $storeCollectionFactory, @@ -234,6 +241,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = [] ) { + $this->metadataService = $metadataService; $this->_treeModel = $categoryTreeResource; $this->_categoryTreeFactory = $categoryTreeFactory; $this->_storeCollectionFactory = $storeCollectionFactory; @@ -249,7 +257,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $storeManager, $resource, @@ -274,6 +282,17 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements } } + /** + * {@inheritdoc} + */ + protected function getCustomAttributesCodes() + { + if ($this->customAttributesCodes === null) { + $this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService); + } + return $this->customAttributesCodes; + } + /** * Get flat resource model flag * @@ -1324,5 +1343,26 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements { return $this->setData(self::KEY_CHILDREN_DATA, $childrenData); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\CategoryExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\CategoryExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Catalog\Api\Data\CategoryExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Catalog/Model/Category/Attribute.php b/app/code/Magento/Catalog/Model/Category/Attribute.php index 99659b6760e6eb7b4311559fe7be113561c6615d..faf1fbd8c12194e79b04a91ff00c5e5c0d0ac434 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute.php @@ -5,6 +5,11 @@ */ namespace Magento\Catalog\Model\Category; +/** + * Class Attribute + * + * @method \Magento\Eav\Api\Data\AttributeExtensionInterface getExtensionAttributes() + */ class Attribute extends \Magento\Catalog\Model\Entity\Attribute implements \Magento\Catalog\Api\Data\CategoryAttributeInterface { diff --git a/app/code/Magento/Catalog/Model/Category/AttributeRepository.php b/app/code/Magento/Catalog/Model/Category/AttributeRepository.php index 98060255af1b49a195a08c39839bceb72c54c68f..38ee0f02fccdd16a5e5aad62b53a71a1429e5e9c 100644 --- a/app/code/Magento/Catalog/Model/Category/AttributeRepository.php +++ b/app/code/Magento/Catalog/Model/Category/AttributeRepository.php @@ -10,7 +10,7 @@ use Magento\Catalog\Api\CategoryAttributeRepositoryInterface; class AttributeRepository implements CategoryAttributeRepositoryInterface { /** - * @var \Magento\Framework\Api\SearchCriteriaDataBuilder + * @var \Magento\Framework\Api\SearchCriteriaBuilder */ protected $searchCriteriaBuilder; @@ -25,21 +25,21 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface protected $eavAttributeRepository; /** - * @param \Magento\Framework\Api\Config\MetadataConfig $metadataConfig - * @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder + * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @param \Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository + * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct( - \Magento\Framework\Api\Config\MetadataConfig $metadataConfig, - \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder, + \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\FilterBuilder $filterBuilder, - \Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository + \Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository, + \Magento\Eav\Model\Config $eavConfig ) { - $this->metadataConfig = $metadataConfig; $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->filterBuilder = $filterBuilder; $this->eavAttributeRepository = $eavAttributeRepository; + $this->eavConfig = $eavConfig; } /** @@ -66,24 +66,22 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getCustomAttributesMetadata($dataObjectClassName = null) { + $defaultAttributeSetId = $this->eavConfig + ->getEntityType(\Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE) + ->getDefaultAttributeSetId(); $searchCriteria = $this->searchCriteriaBuilder->addFilter( [ $this->filterBuilder ->setField('attribute_set_id') - ->setValue(\Magento\Catalog\Api\Data\CategoryAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID) + ->setValue($defaultAttributeSetId) ->create(), ] ); - $customAttributes = []; - $entityAttributes = $this->getList($searchCriteria->create())->getItems(); - - foreach ($entityAttributes as $attributeMetadata) { - $customAttributes[] = $attributeMetadata; - } - return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName)); + return $this->getList($searchCriteria->create())->getItems(); } } diff --git a/app/code/Magento/Catalog/Model/CategoryLinkRepository.php b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php index 23f40ce3c9313bfc06b3cbf9f0f611edb2af5c65..771c54e46518e565848eb15271b5d54bac7517fc 100644 --- a/app/code/Magento/Catalog/Model/CategoryLinkRepository.php +++ b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php @@ -70,10 +70,10 @@ class CategoryLinkRepository implements \Magento\Catalog\Api\CategoryLinkReposit /** * {@inheritdoc} */ - public function deleteByIds($categoryId, $productSku) + public function deleteByIds($categoryId, $sku) { $category = $this->categoryRepository->get($categoryId); - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); $productPositions = $category->getProductsPosition(); $productID = $product->getId(); diff --git a/app/code/Magento/Catalog/Model/CategoryProductLink.php b/app/code/Magento/Catalog/Model/CategoryProductLink.php index b8912fcf08e7c00f7d42114c258c5842de8040c7..2250d914d58f8e23d25c159ef1c5f9d3459829cf 100644 --- a/app/code/Magento/Catalog/Model/CategoryProductLink.php +++ b/app/code/Magento/Catalog/Model/CategoryProductLink.php @@ -72,4 +72,26 @@ class CategoryProductLink extends \Magento\Framework\Api\AbstractExtensibleObjec { return $this->setData(self::KEY_CATEGORY_ID, $categoryId); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\CategoryProductLinkExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\CategoryProductLinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\CategoryProductLinkExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/CategoryRepository.php b/app/code/Magento/Catalog/Model/CategoryRepository.php index e1fc8c0c2d670313b30e961f5e51dfff09df15c8..d436d06561d816dcce4695013d54b3f566eb575a 100644 --- a/app/code/Magento/Catalog/Model/CategoryRepository.php +++ b/app/code/Magento/Catalog/Model/CategoryRepository.php @@ -77,6 +77,8 @@ class CategoryRepository implements \Magento\Catalog\Api\CategoryRepositoryInter } else { $parentId = $category->getParentId() ?: $this->storeManager->getStore()->getRootCategoryId(); $parentCategory = $this->get($parentId); + $existingData['include_in_menu'] = + isset($existingData['include_in_menu']) ? (bool)$existingData['include_in_menu'] : false; /** @var $category Category */ $category->setData($existingData); $category->setPath($parentCategory->getPath()); diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php index 7ca6107c0518590941e8e2cee3a92cbcd074d60d..5ff035d22422267e50f777df8a92e41b38bf6e8d 100644 --- a/app/code/Magento/Catalog/Model/Entity/Attribute.php +++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php @@ -43,6 +43,7 @@ use Magento\Framework\Api\AttributeValueFactory; * @method \Magento\Catalog\Model\Entity\Attribute setIsWysiwygEnabled(int $value) * @method int getIsUsedForPromoRules() * @method \Magento\Catalog\Model\Entity\Attribute setIsUsedForPromoRules(int $value) + * @method \Magento\Eav\Api\Data\AttributeExtensionInterface getExtensionAttributes() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Attribute extends \Magento\Eav\Model\Entity\Attribute @@ -71,7 +72,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory @@ -93,7 +94,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, @@ -115,7 +116,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $eavConfig, $eavTypeFactory, diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 0b9af7cceaa0747fb642f549866b96a02e0468f1..1510c2aad137a65fe3de9b8e515c50dd001d5571 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -237,6 +237,11 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements */ protected $imageCacheFactory; + /** + * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface + */ + protected $metadataService; + /** * @var \Magento\Framework\Api\DataObjectHelper */ @@ -245,9 +250,10 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataService * @param Product\Url $url * @param Product\Link $productLink * @param Product\Configuration\Item\OptionFactory $itemOptionFactory @@ -277,9 +283,10 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataService, Product\Url $url, Product\Link $productLink, \Magento\Catalog\Model\Product\Configuration\Item\OptionFactory $itemOptionFactory, @@ -304,6 +311,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, array $data = [] ) { + $this->metadataService = $metadataService; $this->_itemOptionFactory = $itemOptionFactory; $this->_stockItemFactory = $stockItemFactory; $this->_optionInstance = $catalogProductOption; @@ -327,7 +335,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $storeManager, $resource, @@ -346,6 +354,17 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements $this->_init('Magento\Catalog\Model\Resource\Product'); } + /** + * {@inheritdoc} + */ + protected function getCustomAttributesCodes() + { + if ($this->customAttributesCodes === null) { + $this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService); + } + return $this->customAttributesCodes; + } + /** * Retrieve Store Id * @@ -2215,5 +2234,26 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements { return $this->setData(self::TYPE_ID, $typeId); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php index 97a6572077121baa53401bac3b9b8d58c85ee848..7bbabfc9b3fc8c2b62cfbb7e95a76a0c8f54cc7c 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php @@ -20,7 +20,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -30,7 +30,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -41,7 +41,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php index 0d9e8f96d0b832186e47791ac9e9ba38f645d35b..49fdcf4a8a892783d3fde5fb652f67cfbf6eee2d 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php @@ -45,12 +45,7 @@ class Repository implements \Magento\Catalog\Api\ProductAttributeRepositoryInter protected $filterManager; /** - * @var \Magento\Framework\Api\Config\MetadataConfig - */ - protected $metadataConfig; - - /** - * @var \Magento\Framework\Api\SearchCriteriaDataBuilder + * @var \Magento\Framework\Api\SearchCriteriaBuilder */ protected $searchCriteriaBuilder; @@ -66,8 +61,7 @@ class Repository implements \Magento\Catalog\Api\ProductAttributeRepositoryInter * @param \Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory $validatorFactory - * @param \Magento\Framework\Api\Config\MetadataConfig $metadataConfig - * @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder + * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -78,8 +72,7 @@ class Repository implements \Magento\Catalog\Api\ProductAttributeRepositoryInter \Magento\Eav\Api\AttributeRepositoryInterface $eavAttributeRepository, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory $validatorFactory, - \Magento\Framework\Api\Config\MetadataConfig $metadataConfig, - \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder, + \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\FilterBuilder $filterBuilder ) { $this->attributeResource = $attributeResource; @@ -88,7 +81,6 @@ class Repository implements \Magento\Catalog\Api\ProductAttributeRepositoryInter $this->eavAttributeRepository = $eavAttributeRepository; $this->eavConfig = $eavConfig; $this->inputtypeValidatorFactory = $validatorFactory; - $this->metadataConfig = $metadataConfig; $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->filterBuilder = $filterBuilder; } @@ -213,25 +205,23 @@ class Repository implements \Magento\Catalog\Api\ProductAttributeRepositoryInter /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getCustomAttributesMetadata($dataObjectClassName = null) { + $defaultAttributeSetId = $this->eavConfig + ->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE) + ->getDefaultAttributeSetId(); $searchCriteria = $this->searchCriteriaBuilder->addFilter( [ $this->filterBuilder ->setField('attribute_set_id') - ->setValue(\Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID) + ->setValue($defaultAttributeSetId) ->create(), ] ); - $customAttributes = []; - $entityAttributes = $this->getList($searchCriteria->create())->getItems(); - - foreach ($entityAttributes as $attributeMetadata) { - $customAttributes[] = $attributeMetadata; - } - return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName)); + return $this->getList($searchCriteria->create())->getItems(); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php index 356dfbaeeb86bdbd3dfbf593b2bb5ef892dce1c7..372cda91ef3bc9f08f5a297888b98d51fcca04a5 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php @@ -16,7 +16,7 @@ class SetRepository implements \Magento\Catalog\Api\AttributeSetRepositoryInterf protected $attributeSetRepository; /** - * @var \Magento\Framework\Api\SearchCriteriaDataBuilder + * @var \Magento\Framework\Api\SearchCriteriaBuilder */ protected $searchCriteriaBuilder; @@ -32,13 +32,13 @@ class SetRepository implements \Magento\Catalog\Api\AttributeSetRepositoryInterf /** * @param \Magento\Eav\Api\AttributeSetRepositoryInterface $attributeSetRepository - * @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder + * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @param \Magento\Eav\Model\Config $eavConfig */ public function __construct( \Magento\Eav\Api\AttributeSetRepositoryInterface $attributeSetRepository, - \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder, + \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\FilterBuilder $filterBuilder, \Magento\Eav\Model\Config $eavConfig ) { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Type.php b/app/code/Magento/Catalog/Model/Product/Attribute/Type.php index f3935642a168c4cf16050825e508d9f3c0470be7..a809df6591d7c34a04951cd6d330636f07ff3c05 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Type.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Type.php @@ -1,9 +1,9 @@ <?php /** - * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Attribute; /** @@ -49,4 +49,26 @@ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::LABEL, $label); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductAttributeTypeExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductAttributeTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductAttributeTypeExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/Entry.php b/app/code/Magento/Catalog/Model/Product/Gallery/Entry.php index 116899bda07e86a3128494e4a134f45a687ee99e..54c8123415d9050806de6a0509cc1c51b4828696 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/Entry.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/Entry.php @@ -6,11 +6,14 @@ */ namespace Magento\Catalog\Model\Product\Gallery; +use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; +use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionInterface; + /** * @codeCoverageIgnore */ -class Entry extends \Magento\Framework\Model\AbstractExtensibleModel implements - \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface +class Entry extends AbstractExtensibleModel implements ProductAttributeMediaGalleryEntryInterface { /** * Retrieve gallery entry ID @@ -46,9 +49,8 @@ class Entry extends \Magento\Framework\Model\AbstractExtensibleModel implements * Check if gallery entry is hidden from product page * * @return bool - * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ - public function getIsDisabled() + public function isDisabled() { return $this->getData(self::DISABLED); } @@ -73,6 +75,14 @@ class Entry extends \Magento\Framework\Model\AbstractExtensibleModel implements return $this->getData(self::FILE); } + /** + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface|null + */ + public function getContent() + { + return $this->getData(self::CONTENT); + } + /** * Set gallery entry alternative text * @@ -98,12 +108,12 @@ class Entry extends \Magento\Framework\Model\AbstractExtensibleModel implements /** * Set whether gallery entry is hidden from product page * - * @param bool $isDisabled + * @param bool $disabled * @return $this */ - public function setIsDisabled($isDisabled) + public function setDisabled($disabled) { - return $this->setData(self::DISABLED, $isDisabled); + return $this->setData(self::DISABLED, $disabled); } /** @@ -127,4 +137,36 @@ class Entry extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::FILE, $file); } + + /** + * Set media gallery content + * + * @param $content \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface + * @return $this + */ + public function setContent($content) + { + return $this->setData(self::CONTENT, $content); + } + + /** + * {@inheritdoc} + * + * @return ProductAttributeMediaGalleryEntryExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param ProductAttributeMediaGalleryEntryExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(ProductAttributeMediaGalleryEntryExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php index 7a9302300cea955e89fdc871a70f60c6025d8c61..f161a7d4ad56c28923853c37029afea0658a3ee2 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php @@ -6,14 +6,13 @@ */ namespace Magento\Catalog\Model\Product\Gallery; -use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface as ContentInterface; use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface; use Magento\Catalog\Api\Data\ProductInterface as Product; use Magento\Catalog\Model\Product\Media\Config as MediaConfig; +use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; -use Magento\Framework\App\Filesystem\DirectoryList; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -154,21 +153,21 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal /** * {@inheritdoc} */ - public function create( - $productSku, - ProductAttributeMediaGalleryEntryInterface $entry, - ContentInterface $entryContent, - $storeId = 0 - ) { + public function create($product) + { try { - $this->storeManager->getStore($storeId); + $this->storeManager->getStore($product->getStoreId()); } catch (\Exception $exception) { throw new NoSuchEntityException('There is no store with provided ID.'); } + /** @var $entry ProductAttributeMediaGalleryEntryInterface */ + $entry = $product->getCustomAttribute('media_gallery')->getValue(); + $entryContent = $entry->getContent(); + if (!$this->contentValidator->isValid($entryContent)) { throw new InputException('The image content is not valid.'); } - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($product->getSku()); $fileContent = @base64_decode($entryContent->getEntryData(), true); $mediaTmpPath = $this->mediaConfig->getBaseTmpMediaPath(); @@ -186,15 +185,18 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal $absoluteFilePath, $entry->getTypes(), true, - $entry->getIsDisabled() + $entry->isDisabled() ); // Update additional fields that are still empty after addImage call - $productMediaGallery->updateImage($product, $imageFileUri, [ + $productMediaGallery->updateImage( + $product, + $imageFileUri, + [ 'label' => $entry->getLabel(), 'position' => $entry->getPosition(), - 'disabled' => $entry->getIsDisabled(), - ]); - $product->setStoreId($storeId); + 'disabled' => $entry->isDisabled(), + ] + ); try { $this->productRepository->save($product); @@ -213,14 +215,14 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal /** * {@inheritdoc} */ - public function update($productSku, ProductAttributeMediaGalleryEntryInterface $entry, $storeId = 0) + public function update($sku, ProductAttributeMediaGalleryEntryInterface $entry, $storeId = 0) { try { $this->storeManager->getStore($storeId); } catch (\Exception $exception) { throw new NoSuchEntityException('There is no store with provided ID.'); } - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ $productMediaGallery = $this->getGalleryAttributeBackend($product); $filePath = $this->entryResolver->getEntryFilePathById($product, $entry->getId()); @@ -228,11 +230,15 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal throw new NoSuchEntityException('There is no image with provided ID.'); } - $productMediaGallery->updateImage($product, $filePath, [ - 'label' => $entry->getLabel(), - 'position' => $entry->getPosition(), - 'disabled' => $entry->getIsDisabled(), - ]); + $productMediaGallery->updateImage( + $product, + $filePath, + [ + 'label' => $entry->getLabel(), + 'position' => $entry->getPosition(), + 'disabled' => $entry->isDisabled(), + ] + ); $productMediaGallery->clearMediaAttribute($product, array_keys($product->getMediaAttributes())); $productMediaGallery->setMediaAttribute($product, $entry->getTypes(), $filePath); $product->setStoreId($storeId); @@ -248,9 +254,9 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal /** * {@inheritdoc} */ - public function remove($productSku, $entryId) + public function remove($sku, $entryId) { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ $productMediaGallery = $this->getGalleryAttributeBackend($product); $filePath = $this->entryResolver->getEntryFilePathById($product, $entryId); @@ -266,10 +272,10 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal /** * {@inheritdoc} */ - public function get($productSku, $imageId) + public function get($sku, $imageId) { try { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); } catch (\Exception $exception) { throw new NoSuchEntityException("Such product doesn't exist"); } @@ -298,11 +304,11 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal /** * {@inheritdoc} */ - public function getList($productSku) + public function getList($sku) { $result = []; /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); /** @var \Magento\Catalog\Api\Data\ProductAttributeInterface $galleryAttribute */ $galleryAttribute = $this->attributeRepository->get('media_gallery'); @@ -318,7 +324,7 @@ class GalleryManagement implements \Magento\Catalog\Api\ProductAttributeMediaGal $entry->setId($image['value_id']) ->setLabel($image['label_default']) ->setTypes(array_keys($productImages, $image['file'])) - ->setIsDisabled($image['disabled_default']) + ->setDisabled($image['disabled_default']) ->setPosition($image['position_default']) ->setFile($image['file']); $result[] = $entry; diff --git a/app/code/Magento/Catalog/Model/Product/GroupPrice.php b/app/code/Magento/Catalog/Model/Product/GroupPrice.php index 531546e1a4a086f55fc2d2170e23b1d882f91f01..740a2b1b976b47d16b07166bb7551220cf779dbf 100644 --- a/app/code/Magento/Catalog/Model/Product/GroupPrice.php +++ b/app/code/Magento/Catalog/Model/Product/GroupPrice.php @@ -61,4 +61,26 @@ class GroupPrice extends \Magento\Framework\Model\AbstractExtensibleModel implem { return $this->setData(self::KEY_VALUE, $value); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductGroupPriceExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php b/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php index 82d4985cdab134586f2823199469a082e8003eb7..0e689e4b69e3f4fe4c5eedbd04e6c19f413e306c 100644 --- a/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php +++ b/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php @@ -72,13 +72,13 @@ class GroupPriceManagement implements \Magento\Catalog\Api\ProductGroupPriceMana * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function add($productSku, $customerGroupId, $price) + public function add($sku, $customerGroupId, $price) { if (!\Zend_Validate::is($price, 'Float') || $price <= 0 || !\Zend_Validate::is($price, 'Float')) { throw new InputException('Please provide valid data'); } $customerGroup = $this->groupRepository->getById($customerGroupId); - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); $groupPrices = $product->getData('group_price'); $websiteIdentifier = 0; $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); @@ -122,9 +122,9 @@ class GroupPriceManagement implements \Magento\Catalog\Api\ProductGroupPriceMana /** * {@inheritdoc} */ - public function remove($productSku, $customerGroupId) + public function remove($sku, $customerGroupId) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); $websiteIdentifier = 0; $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); if ($value != 0) { @@ -137,9 +137,9 @@ class GroupPriceManagement implements \Magento\Catalog\Api\ProductGroupPriceMana /** * {@inheritdoc} */ - public function getList($productSku, $websiteId = null) + public function getList($sku, $websiteId = null) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); $priceKey = 'website_price'; $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); if ($value == 0) { diff --git a/app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php b/app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php index 4844a001a86add8567c691a387fa875049f7709e..48c0b4dc10739a0c8902656999fc856e701ca841 100644 --- a/app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php +++ b/app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php @@ -1,9 +1,9 @@ <?php /** - * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Catalog\Model\Product\Media; /** @@ -68,4 +68,26 @@ class GalleryEntryContent extends \Magento\Framework\Model\AbstractExtensibleMod { return $this->setData(self::NAME, $name); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index a6ba38bc1703dbb1becb1ea4404385ccdd81a757..3afdf86af8f964579c65ced1115c779102f3a8c7 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -9,11 +9,9 @@ namespace Magento\Catalog\Model\Product; use Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface; -use Magento\Framework\Model\AbstractExtensibleModel; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Resource\Product\Option\Value\Collection; use Magento\Catalog\Pricing\Price\BasePrice; -use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Model\AbstractModel; use Magento\Framework\Exception\LocalizedException; @@ -28,7 +26,7 @@ use Magento\Framework\Exception\LocalizedException; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.ExcessivePublicCount) */ -class Option extends AbstractExtensibleModel implements \Magento\Catalog\Api\Data\ProductCustomOptionInterface +class Option extends AbstractModel implements \Magento\Catalog\Api\Data\ProductCustomOptionInterface { const OPTION_GROUP_TEXT = 'text'; @@ -118,8 +116,6 @@ class Option extends AbstractExtensibleModel implements \Magento\Catalog\Api\Dat /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory * @param Option\Value $productOptionValue * @param Option\Type\Factory $optionFactory * @param \Magento\Framework\Stdlib\String $string @@ -132,8 +128,6 @@ class Option extends AbstractExtensibleModel implements \Magento\Catalog\Api\Dat public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService, - AttributeValueFactory $customAttributeFactory, Option\Value $productOptionValue, \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory, \Magento\Framework\Stdlib\String $string, @@ -149,8 +143,6 @@ class Option extends AbstractExtensibleModel implements \Magento\Catalog\Api\Dat parent::__construct( $context, $registry, - $metadataService, - $customAttributeFactory, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Catalog/Model/Product/Option/Converter.php b/app/code/Magento/Catalog/Model/Product/Option/Converter.php index 010348d3097dbecbb134746214352aa2cc3e3678..ac59498ccb58c323e6ce629bb0e2639b8e33b6db 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Converter.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Converter.php @@ -31,7 +31,7 @@ class Converter public function toArray(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $option) { $optionData = $option->getData(); - $values = $option->getData('values'); + $values = $option->getValues(); $valuesData = []; if (!empty($values)) { foreach ($values as $key => $value) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Repository.php b/app/code/Magento/Catalog/Model/Product/Option/Repository.php index 936b6569c44ecb851b59c12daf50cba9f3951e1a..e23481aafe81bbb6da8bacd42f4a7f60fdbe8d38 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Repository.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Repository.php @@ -44,18 +44,18 @@ class Repository implements \Magento\Catalog\Api\ProductCustomOptionRepositoryIn /** * {@inheritdoc} */ - public function getList($productSku) + public function getList($sku) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); return $product->getOptions(); } /** * {@inheritdoc} */ - public function get($productSku, $optionId) + public function get($sku, $optionId) { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); $option = $product->getOptionById($optionId); if (is_null($option)) { throw NoSuchEntityException::singleField('optionId', $optionId); @@ -77,8 +77,8 @@ class Repository implements \Magento\Catalog\Api\ProductCustomOptionRepositoryIn */ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $option) { - $productSku = $option->getProductSku(); - $product = $this->productRepository->get($productSku, true); + $sku = $option->getProductSku(); + $product = $this->productRepository->get($sku, true); $optionData = $this->converter->toArray($option); if ($option->getOptionId()) { if (!$product->getOptionById($option->getOptionId())) { @@ -100,7 +100,7 @@ class Repository implements \Magento\Catalog\Api\ProductCustomOptionRepositoryIn throw new CouldNotSaveException('Could not save product option'); } - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); if (!$option->getOptionId()) { $currentOptions = $product->getOptions(); @@ -112,16 +112,16 @@ class Repository implements \Magento\Catalog\Api\ProductCustomOptionRepositoryIn } else { $newID = $option->getOptionId(); } - $option = $this->get($productSku, $newID); + $option = $this->get($sku, $newID); return $option; } /** * {@inheritdoc} */ - public function deleteByIdentifier($productSku, $optionId) + public function deleteByIdentifier($sku, $optionId) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); $options = $product->getOptions(); $option = $product->getOptionById($optionId); if (is_null($option)) { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type.php b/app/code/Magento/Catalog/Model/Product/Option/Type.php index cb69c24a1c8ee27f32df3ac87c4bbbbc44b3b7cc..045bb591e8b3ea86e53f2db46c79c1ab3b54550e 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type.php @@ -82,4 +82,26 @@ class Type extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_GROUP, $group); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductCustomOptionTypeExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductCustomOptionTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductCustomOptionTypeExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php index 051681c4c319186a54020a6d0e1a9744cfb8d9d4..5bdcebfbe9b1b41e31728fee08067265fe038858 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -150,7 +150,6 @@ class ValidatorFile extends Validator $upload->addFilter(new \Zend_Filter_File_Rename(['target' => $fileFullPath, 'overwrite' => true])); - // TODO: I don't know how change this if (!is_null($this->product)) { $this->product->getTypeInstance()->addFileQueue( [ diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index 37f706b2a8163bc125810af9deae309bf33ff413..227f070a683e75e67bf464442b8c5c5c35b7381e 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -8,10 +8,9 @@ namespace Magento\Catalog\Model\Product\Option; -use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Framework\Model\AbstractModel; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Option; -use Magento\Framework\Api\AttributeValueFactory; /** * Catalog product option select type model @@ -23,7 +22,7 @@ use Magento\Framework\Api\AttributeValueFactory; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Value extends AbstractExtensibleModel implements \Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface +class Value extends AbstractModel implements \Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface { /** * Option type percent @@ -66,8 +65,6 @@ class Value extends AbstractExtensibleModel implements \Magento\Catalog\Api\Data /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -76,8 +73,6 @@ class Value extends AbstractExtensibleModel implements \Magento\Catalog\Api\Data public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService, - AttributeValueFactory $customAttributeFactory, \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, @@ -87,8 +82,6 @@ class Value extends AbstractExtensibleModel implements \Magento\Catalog\Api\Data parent::__construct( $context, $registry, - $metadataService, - $customAttributeFactory, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Catalog/Model/Product/TierPrice.php b/app/code/Magento/Catalog/Model/Product/TierPrice.php index 6bc86d069d488df581917d40dac7a344791b2f39..4f28981a036f82c1da0c118483cd3f1bc5a1fb8f 100644 --- a/app/code/Magento/Catalog/Model/Product/TierPrice.php +++ b/app/code/Magento/Catalog/Model/Product/TierPrice.php @@ -54,4 +54,26 @@ class TierPrice extends \Magento\Framework\Model\AbstractExtensibleModel impleme { return $this->setData(self::VALUE, $value); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductTierPriceExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductTierPriceExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductTierPriceExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php index e0e4c1695bb786171e377df14fcb73c3240ab628..0c0ed5d54b4e74cdca2369ae9f27a91a10490b2c 100644 --- a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php +++ b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php @@ -85,12 +85,12 @@ class TierPriceManagement implements \Magento\Catalog\Api\ProductTierPriceManage * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function add($productSku, $customerGroupId, $price, $qty) + public function add($sku, $customerGroupId, $price, $qty) { if (!\Zend_Validate::is($price, 'Float') || $price <= 0 || !\Zend_Validate::is($qty, 'Float') || $qty <= 0) { throw new InputException('Please provide valid data'); } - $product = $this->productRepository->get($productSku, ['edit_mode' => true]); + $product = $this->productRepository->get($sku, ['edit_mode' => true]); $tierPrices = $product->getData('tier_price'); $websiteIdentifier = 0; $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); @@ -145,9 +145,9 @@ class TierPriceManagement implements \Magento\Catalog\Api\ProductTierPriceManage /** * {@inheritdoc} */ - public function remove($productSku, $customerGroupId, $qty) + public function remove($sku, $customerGroupId, $qty) { - $product = $this->productRepository->get($productSku, ['edit_mode' => true]); + $product = $this->productRepository->get($sku, ['edit_mode' => true]); $websiteIdentifier = 0; $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); if ($value != 0) { @@ -160,9 +160,9 @@ class TierPriceManagement implements \Magento\Catalog\Api\ProductTierPriceManage /** * {@inheritdoc} */ - public function getList($productSku, $customerGroupId) + public function getList($sku, $customerGroupId) { - $product = $this->productRepository->get($productSku, ['edit_mode' => true]); + $product = $this->productRepository->get($sku, ['edit_mode' => true]); $priceKey = 'website_price'; $value = $this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE); diff --git a/app/code/Magento/Catalog/Model/ProductLink/Attribute.php b/app/code/Magento/Catalog/Model/ProductLink/Attribute.php index 2a2f15daa3d3856fa5aa14cf447a99f35d791253..ede2f7e22ebc204a430ca75884ab9a726df43510 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/Attribute.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Attribute.php @@ -57,4 +57,26 @@ class Attribute extends \Magento\Framework\Api\AbstractExtensibleObject implemen { return $this->setData(self::KEY_TYPE, $type); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductLinkAttributeExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductLinkAttributeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductLinkAttributeExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/ProductLink/Link.php b/app/code/Magento/Catalog/Model/ProductLink/Link.php index e105ca4317652fdbb2bfb2ba6384ff1adf58d442..84fdd67df676b354d497de50667e43d0b949ea26 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/Link.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Link.php @@ -167,4 +167,30 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_POSITION, $position); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductLinkExtensionInterface|null + */ + public function getExtensionAttributes() + { + if (!$this->_getExtensionAttributes()) { + $this->setExtensionAttributes( + $this->extensionAttributesFactory->create('Magento\Catalog\Model\ProductLink\Link') + ); + } + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductLinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductLinkExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/ProductLink/Management.php b/app/code/Magento/Catalog/Model/ProductLink/Management.php index b6d64659e3963c94cbbe52c633a7130541dea79c..2987ebc079a4bb954b2c3de90b670b99dc7198d5 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/Management.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Management.php @@ -70,10 +70,10 @@ class Management implements \Magento\Catalog\Api\ProductLinkManagementInterface /** * {@inheritdoc} */ - public function getLinkedItemsByType($productSku, $type) + public function getLinkedItemsByType($sku, $type) { $output = []; - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); try { $collection = $this->entityCollectionProvider->getCollection($product, $type); } catch (NoSuchEntityException $e) { @@ -89,10 +89,7 @@ class Management implements \Magento\Catalog\Api\ProductLinkManagementInterface ->setPosition($item['position']); if (isset($item['custom_attributes'])) { foreach ($item['custom_attributes'] as $option) { - $productLink->setCustomAttribute( - $option['attribute_code'], - $option['value'] - ); + $productLink->getExtensionAttributes()->setQty($option['value']); } } $output[] = $productLink; @@ -103,7 +100,7 @@ class Management implements \Magento\Catalog\Api\ProductLinkManagementInterface /** * {@inheritdoc} */ - public function setProductLinks($productSku, $type, array $items) + public function setProductLinks($sku, $type, array $items) { $linkTypes = $this->linkTypeProvider->getLinkTypes(); @@ -113,7 +110,7 @@ class Management implements \Magento\Catalog\Api\ProductLinkManagementInterface ); } - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); $assignedSkuList = []; /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $link */ foreach ($items as $link) { diff --git a/app/code/Magento/Catalog/Model/ProductLink/Repository.php b/app/code/Magento/Catalog/Model/ProductLink/Repository.php index 0b18b48b82ca19522f1ad198148a329034e6e21f..386e7e8bb4d880942eed3f14ed575bd7b1eb3a49 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/Repository.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Repository.php @@ -34,21 +34,31 @@ class Repository implements \Magento\Catalog\Api\ProductLinkRepositoryInterface protected $linkManagement; /** + * @var \Magento\Framework\Reflection\DataObjectProcessor + */ + protected $dataObjectProcessor; + + /** + * Initialize dependencies. + * * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository * @param CollectionProvider $entityCollectionProvider * @param LinksInitializer $linkInitializer * @param Management $linkManagement + * @param \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor */ public function __construct( \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Catalog\Model\ProductLink\CollectionProvider $entityCollectionProvider, \Magento\Catalog\Model\Product\Initialization\Helper\ProductLinks $linkInitializer, - \Magento\Catalog\Model\ProductLink\Management $linkManagement + \Magento\Catalog\Model\ProductLink\Management $linkManagement, + \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor ) { $this->productRepository = $productRepository; $this->entityCollectionProvider = $entityCollectionProvider; $this->linkInitializer = $linkInitializer; $this->linkManagement = $linkManagement; + $this->dataObjectProcessor = $dataObjectProcessor; } /** @@ -59,11 +69,16 @@ class Repository implements \Magento\Catalog\Api\ProductLinkRepositoryInterface $linkedProduct = $this->productRepository->get($entity->getLinkedProductSku()); $product = $this->productRepository->get($entity->getProductSku()); $links = $this->entityCollectionProvider->getCollection($product, $entity->getLinkType()); - + $extensions = $this->dataObjectProcessor->buildOutputDataArray( + $entity->getExtensionAttributes(), + 'Magento\Catalog\Api\Data\ProductLinkExtensionInterface' + ); + $extensions = is_array($extensions) ? $extensions : []; $data = $entity->__toArray(); - foreach ($entity->getCustomAttributes() as $attribute) { - $data[$attribute->getAttributeCode()] = $attribute->getValue(); + foreach ($extensions as $attributeCode => $attribute) { + $data[$attributeCode] = $attribute; } + unset($data['extension_attributes']); $data['product_id'] = $linkedProduct->getId(); $links[$linkedProduct->getId()] = $data; $this->linkInitializer->initializeLinks($product, [$entity->getLinkType() => $links]); @@ -108,9 +123,9 @@ class Repository implements \Magento\Catalog\Api\ProductLinkRepositoryInterface /** * {@inheritdoc} */ - public function deleteById($productSku, $type, $linkedProductSku) + public function deleteById($sku, $type, $linkedProductSku) { - $linkItems = $this->linkManagement->getLinkedItemsByType($productSku, $type); + $linkItems = $this->linkManagement->getLinkedItemsByType($sku, $type); /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $linkItem */ foreach ($linkItems as $linkItem) { if ($linkItem->getLinkedProductSku() == $linkedProductSku) { @@ -120,7 +135,7 @@ class Repository implements \Magento\Catalog\Api\ProductLinkRepositoryInterface throw new NoSuchEntityException( 'Product %s doesn\'t have linked %s as %s', [ - $productSku, + $sku, $linkedProductSku, $type ] diff --git a/app/code/Magento/Catalog/Model/ProductLink/Type.php b/app/code/Magento/Catalog/Model/ProductLink/Type.php index 493bece24b31469e1b6d35608335a710949ec1f7..278662033f544a84c4121449205c05473f7a76f4 100644 --- a/app/code/Magento/Catalog/Model/ProductLink/Type.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Type.php @@ -57,4 +57,26 @@ class Type extends \Magento\Framework\Api\AbstractExtensibleObject implements Pr { return $this->setData(self::KEY_NAME, $name); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductLinkTypeExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductLinkTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductLinkTypeExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 4a205ae8920f5a00fb1e0a3aad9de3dc09ff5151..284f7343cc629880a54d4898fc569b02599a76ed 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -37,12 +37,12 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa protected $initializationHelper; /** - * @var \Magento\Catalog\Api\Data\ProductSearchResultsDataBuilder + * @var \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory */ - protected $searchResultsBuilder; + protected $searchResultsFactory; /** - * @var \Magento\Framework\Api\SearchCriteriaDataBuilder + * @var \Magento\Framework\Api\SearchCriteriaBuilder */ protected $searchCriteriaBuilder; @@ -71,37 +71,54 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ protected $metadataService; + /** + * @var \Magento\Eav\Model\Config + */ + protected $eavConfig; + + /** + * @var \Magento\Framework\Api\ExtensibleDataObjectConverter + */ + protected $extensibleDataObjectConverter; + /** * @param ProductFactory $productFactory * @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper - * @param \Magento\Catalog\Api\Data\ProductSearchResultsDataBuilder $searchResultsBuilder + * @param \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory * @param Resource\Product\CollectionFactory $collectionFactory - * @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder + * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository * @param Resource\Product $resourceModel * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface + * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter + * @param \Magento\Eav\Model\Config $eavConfig + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( ProductFactory $productFactory, \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper, - \Magento\Catalog\Api\Data\ProductSearchResultsDataBuilder $searchResultsBuilder, + \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory, - \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder, + \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, \Magento\Catalog\Model\Resource\Product $resourceModel, \Magento\Framework\Api\FilterBuilder $filterBuilder, - \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface + \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface, + \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter, + \Magento\Eav\Model\Config $eavConfig ) { $this->productFactory = $productFactory; $this->collectionFactory = $collectionFactory; $this->initializationHelper = $initializationHelper; - $this->searchResultsBuilder = $searchResultsBuilder; + $this->searchResultsFactory = $searchResultsFactory; $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->resourceModel = $resourceModel; $this->attributeRepository = $attributeRepository; $this->filterBuilder = $filterBuilder; $this->metadataService = $metadataServiceInterface; + $this->extensibleDataObjectConverter = $extensibleDataObjectConverter; + $this->eavConfig = $eavConfig; } /** @@ -201,8 +218,16 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveOptions = false) { + if ($saveOptions) { + $productOptions = $product->getProductOptions(); + } + $groupPrices = $product->getData('group_price'); + $tierPrices = $product->getData('tier_price'); + $productId = $this->resourceModel->getIdBySku($product->getSku()); - $product = $this->initializeProductData($product->toFlatArray(), empty($productId)); + $productDataArray = $this->extensibleDataObjectConverter + ->toNestedArray($product, [], 'Magento\Catalog\Api\Data\ProductInterface'); + $product = $this->initializeProductData($productDataArray, empty($productId)); $validationResult = $this->resourceModel->validate($product); if (true !== $validationResult) { throw new \Magento\Framework\Exception\CouldNotSaveException( @@ -211,8 +236,11 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa } try { if ($saveOptions) { + $product->setProductOptions($productOptions); $product->setCanSaveCustomOptions(true); } + $product->setData('group_price', $groupPrices); + $product->setData('tier_price', $tierPrices); $this->resourceModel->save($product); } catch (\Magento\Eav\Model\Entity\Attribute\Exception $exception) { throw \Magento\Framework\Exception\InputException::invalidFieldValue( @@ -233,14 +261,14 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ public function delete(\Magento\Catalog\Api\Data\ProductInterface $product) { - $productSku = $product->getSku(); + $sku = $product->getSku(); $productId = $product->getId(); try { $this->resourceModel->delete($product); } catch (\Exception $e) { - throw new \Magento\Framework\Exception\StateException('Unable to remove product ' . $productSku); + throw new \Magento\Framework\Exception\StateException('Unable to remove product ' . $sku); } - unset($this->instances[$productSku]); + unset($this->instances[$sku]); unset($this->instancesById[$productId]); return true; } @@ -248,9 +276,9 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa /** * {@inheritdoc} */ - public function deleteById($productSku) + public function deleteById($sku) { - $product = $this->get($productSku); + $product = $this->get($sku); return $this->delete($product); } @@ -261,12 +289,14 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa { /** @var \Magento\Catalog\Model\Resource\Product\Collection $collection */ $collection = $this->collectionFactory->create(); - + $defaultAttributeSetId = $this->eavConfig + ->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE) + ->getDefaultAttributeSetId(); $extendedSearchCriteria = $this->searchCriteriaBuilder->addFilter( [ $this->filterBuilder ->setField('attribute_set_id') - ->setValue(\Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID) + ->setValue($defaultAttributeSetId) ->create(), ] ); @@ -293,10 +323,11 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa $collection->setPageSize($searchCriteria->getPageSize()); $collection->load(); - $this->searchResultsBuilder->setSearchCriteria($searchCriteria); - $this->searchResultsBuilder->setItems($collection->getItems()); - $this->searchResultsBuilder->setTotalCount($collection->getSize()); - return $this->searchResultsBuilder->create(); + $searchResult = $this->searchResultsFactory->create(); + $searchResult->setSearchCriteria($searchCriteria); + $searchResult->setItems($collection->getItems()); + $searchResult->setTotalCount($collection->getSize()); + return $searchResult; } /** diff --git a/app/code/Magento/Catalog/Model/ProductType.php b/app/code/Magento/Catalog/Model/ProductType.php index 2f5f266b2a6a0cf44456353cdf94252cf87f3bc3..ba9a7e5c4150d092bf100967d2ebc9599404f983 100644 --- a/app/code/Magento/Catalog/Model/ProductType.php +++ b/app/code/Magento/Catalog/Model/ProductType.php @@ -58,4 +58,26 @@ class ProductType extends \Magento\Framework\Api\AbstractExtensibleObject implem { return $this->setData(self::KEY_LABEL, $label); } + + /** + * {@inheritdoc} + * + * @return \Magento\Catalog\Api\Data\ProductTypeExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Catalog\Api\Data\ProductTypeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Catalog\Api\Data\ProductTypeExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php index 0a0800ce27bcd3617a68ead274a74662adcbf419..34f07aff2415de9ede946f1a30bbce63918d2f52 100644 --- a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php @@ -23,6 +23,7 @@ use Magento\Framework\Api\AttributeValueFactory; * @method int setSearchWeight(int $value) * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsUsedForPriceRules() * @method int setIsUsedForPriceRules(int $value) + * @method \Magento\Eav\Api\Data\AttributeExtensionInterface getExtensionAttributes() * * @author Magento Core Team <core@magentocommerce.com> * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -88,7 +89,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute implements /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory @@ -113,7 +114,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute implements public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, @@ -141,7 +142,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute implements parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $eavConfig, $eavTypeFactory, diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ValidateTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ValidateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2de489fa7a9e3a5eff966359a1dd3e5eb3e65e09 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ValidateTest.php @@ -0,0 +1,140 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Test\Unit\Controller\Adminhtml\Product; + +use Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; + +class ValidateTest extends \Magento\Catalog\Test\Unit\Controller\Adminhtml\ProductTest +{ + /** @var \Magento\Catalog\Controller\Adminhtml\Product\Validate */ + protected $action; + /** @var \Magento\Backend\Model\View\Result\Page|\PHPUnit_Framework_MockObject_MockObject */ + protected $resultPage; + /** @var \Magento\Backend\Model\View\Result\Forward|\PHPUnit_Framework_MockObject_MockObject */ + protected $resultForward; + /** @var \Magento\Catalog\Controller\Adminhtml\Product\Builder|\PHPUnit_Framework_MockObject_MockObject */ + protected $productBuilder; + /** @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject */ + protected $product; + /** @var \Magento\Backend\Model\View\Result\RedirectFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $resultRedirectFactory; + /** @var \Magento\Backend\Model\View\Result\Redirect|\PHPUnit_Framework_MockObject_MockObject */ + protected $resultRedirect; + /** @var Helper|\PHPUnit_Framework_MockObject_MockObject */ + protected $initializationHelper; + /** @var \Magento\Catalog\Model\ProductFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $productFactory; + /** @var \Magento\Framework\Controller\Result\JSON|\PHPUnit_Framework_MockObject_MockObject */ + protected $resultJson; + /** @var \Magento\Framework\Controller\Result\JSONFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $resultJsonFactory; + + protected function setUp() + { + $this->productBuilder = $this->getMock( + 'Magento\Catalog\Controller\Adminhtml\Product\Builder', + ['build'], + [], + '', + false + ); + $this->product = $this->getMockBuilder('Magento\Catalog\Model\Product')->disableOriginalConstructor() + ->setMethods([ + 'addData', 'getSku', 'getTypeId', 'getStoreId', '__sleep', '__wakeup', 'getAttributes', + 'setAttributeSetId', + ]) + ->getMock(); + $this->product->expects($this->any())->method('getTypeId')->will($this->returnValue('simple')); + $this->product->expects($this->any())->method('getStoreId')->will($this->returnValue('1')); + $this->product->expects($this->any())->method('getAttributes')->will($this->returnValue([])); + $this->productBuilder->expects($this->any())->method('build')->will($this->returnValue($this->product)); + + $this->resultPage = $this->getMockBuilder('Magento\Backend\Model\View\Result\Page') + ->disableOriginalConstructor() + ->getMock(); + + $resultPageFactory = $this->getMockBuilder('Magento\Framework\View\Result\PageFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $resultPageFactory->expects($this->any())->method('create')->willReturn($this->resultPage); + + $this->resultForward = $this->getMockBuilder('Magento\Backend\Model\View\Result\Forward') + ->disableOriginalConstructor() + ->getMock(); + $resultForwardFactory = $this->getMockBuilder('Magento\Backend\Model\View\Result\ForwardFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $resultForwardFactory->expects($this->any()) + ->method('create') + ->willReturn($this->resultForward); + $this->resultPage->expects($this->any())->method('getLayout')->willReturn($this->layout); + $this->resultRedirectFactory = $this->getMock( + 'Magento\Backend\Model\View\Result\RedirectFactory', + ['create'], + [], + '', + false + ); + $this->resultRedirect = $this->getMock( + 'Magento\Backend\Model\View\Result\Redirect', + [], + [], + '', + false + ); + $this->resultRedirectFactory->expects($this->any())->method('create')->willReturn($this->resultRedirect); + + $this->initializationHelper = $this->getMock( + 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper', + [], + [], + '', + false + ); + + $this->productFactory = $this->getMockBuilder('Magento\Catalog\Model\ProductFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->productFactory->expects($this->any())->method('create')->willReturn($this->product); + + $this->resultJson = $this->getMock('Magento\Framework\Controller\Result\JSON', [], [], '', false); + $this->resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JSONFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->resultJsonFactory->expects($this->any())->method('create')->willReturn($this->resultJson); + + $this->action = (new ObjectManagerHelper($this))->getObject( + 'Magento\Catalog\Controller\Adminhtml\Product\Validate', + [ + 'context' => $this->initContext(), + 'productBuilder' => $this->productBuilder, + 'resultPageFactory' => $resultPageFactory, + 'resultForwardFactory' => $resultForwardFactory, + 'resultRedirectFactory' => $this->resultRedirectFactory, + 'initializationHelper' => $this->initializationHelper, + 'resultJsonFactory' => $this->resultJsonFactory, + 'productFactory' => $this->productFactory, + ] + ); + } + + /** + * @return void + */ + public function testAttributeSetIsObtainedFromPost() + { + $this->request->expects($this->any())->method('getPost')->willReturnMap([['set', null, 9]]); + + $this->product->expects($this->once())->method('setAttributeSetId')->with(9); + + $this->action->execute(); + } +} diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/ProductTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/ProductTest.php index 0deb8c5810accfe642978c0b698292da42b0ba71..3e04c8a0c27f345cb2ef5892098f65a04f61b667 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/ProductTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/ProductTest.php @@ -41,7 +41,7 @@ abstract class ProductTest extends \PHPUnit_Framework_TestCase ->setMethods(['add'])->disableOriginalConstructor()->getMock(); $title->expects($this->any())->method('prepend')->withAnyParameters()->will($this->returnSelf()); $requestInterfaceMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')->setMethods( - ['getParam', 'getFullActionName', 'getPostValue'] + ['getParam', 'getPost', 'getFullActionName', 'getPostValue'] )->disableOriginalConstructor()->getMock(); $responseInterfaceMock = $this->getMockBuilder('Magento\Framework\App\ResponseInterface')->setMethods( diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php index 94c23c96eaf9c0775c504a7180e1ee7827829fbe..c2c63a0ed168c2dab56f20bf9044fd9310bed2fa 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/AttributeRepositoryTest.php @@ -9,7 +9,8 @@ namespace Magento\Catalog\Test\Unit\Model\Category; -use \Magento\Catalog\Model\Category\AttributeRepository; +use Magento\Catalog\Model\Category\AttributeRepository; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase { @@ -36,23 +37,21 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $metadataConfigMock; + protected $searchResultMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ - protected $searchResultMock; + protected $eavConfigMock; protected function setUp() { $this->searchBuilderMock = - $this->getMock('Magento\Framework\Api\SearchCriteriaDataBuilder', [], [], '', false); + $this->getMock('Magento\Framework\Api\SearchCriteriaBuilder', [], [], '', false); $this->filterBuilderMock = $this->getMock('Magento\Framework\Api\FilterBuilder', [], [], '', false); $this->attributeRepositoryMock = $this->getMock('Magento\Eav\Api\AttributeRepositoryInterface', [], [], '', false); - $this->metadataConfigMock = - $this->getMock('Magento\Framework\Api\Config\MetadataConfig', [], [], '', false); $this->searchResultMock = $this->getMock( 'Magento\Framework\Api\SearchResultsInterface', @@ -60,16 +59,25 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase 'getItems', 'getSearchCriteria', 'getTotalCount', - '__wakeup' + 'setItems', + 'setSearchCriteria', + 'setTotalCount', + '__wakeup', ], [], '', false); - $this->model = new AttributeRepository( - $this->metadataConfigMock, - $this->searchBuilderMock, - $this->filterBuilderMock, - $this->attributeRepositoryMock + $this->eavConfigMock = $this->getMock('Magento\Eav\Model\Config', [], [], '', false); + $this->eavConfigMock->expects($this->any())->method('getEntityType') + ->willReturn(new \Magento\Framework\Object(['default_attribute_set_id' => 3])); + $this->model = (new ObjectManager($this))->getObject( + 'Magento\Catalog\Model\Category\AttributeRepository', + [ + 'searchCriteriaBuilder' => $this->searchBuilderMock, + 'filterBuilder' => $this->filterBuilderMock, + 'eavAttributeRepository' => $this->attributeRepositoryMock, + 'eavConfig' => $this->eavConfigMock, + ] ); } @@ -103,7 +111,7 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase $this->filterBuilderMock->expects($this->once())->method('setField') ->with('attribute_set_id')->willReturnSelf(); $this->filterBuilderMock->expects($this->once())->method('setValue')->with( - \Magento\Catalog\Api\Data\CategoryAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID + 3 )->willReturnSelf(); $this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock); $this->searchBuilderMock->expects($this->once())->method('addFilter')->with([$filterMock])->willReturnSelf(); @@ -115,9 +123,7 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase $searchCriteriaMock )->willReturn($this->searchResultMock); $this->searchResultMock->expects($this->once())->method('getItems')->willReturn([$itemMock]); - $this->metadataConfigMock->expects($this->once()) - ->method('getCustomAttributesMetadata')->with(null)->willReturn(['attribute']); - $expected = array_merge([$itemMock], ['attribute']); + $expected = [$itemMock]; $this->assertEquals($expected, $this->model->getCustomAttributesMetadata(null)); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Entity/AttributeTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Entity/AttributeTest.php index 0ecf9b024aa0704ace1dfca1bdca098d9e8a5402..ca53d6b6fec5f0d7b2276692bdb65bd86a88b0d8 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Entity/AttributeTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Entity/AttributeTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Catalog\Test\Unit\Model\Entity; use Magento\Catalog\Model\Entity\Attribute; @@ -114,6 +116,11 @@ class AttributeTest extends \PHPUnit_Framework_TestCase */ private $dataObjectHelperMock; + /** + * @var \Magento\Framework\Api\ExtensionAttributesFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $extensionAttributesFactory; + protected function setUp() { $this->contextMock = $this->getMockBuilder('Magento\Framework\Model\Context') @@ -124,6 +131,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->metadataServiceMock = $this->getMockBuilder('Magento\Framework\Api\MetadataServiceInterface') ->getMock(); + $this->extensionAttributesFactory = $this->getMockBuilder('Magento\Framework\Api\ExtensionAttributesFactory') + ->disableOriginalConstructor() + ->getMock(); $this->attributeValueFactoryMock = $this->getMockBuilder('Magento\Framework\Api\AttributeValueFactory') ->disableOriginalConstructor() ->getMock(); @@ -181,7 +191,7 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $this->attribute = new Attribute( $this->contextMock, $this->registryMock, - $this->metadataServiceMock, + $this->extensionAttributesFactory, $this->attributeValueFactoryMock, $this->configMock, $this->typeFactoryMock, diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ObserverTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ObserverTest.php index d9d783495bd1332cd1d432a201e86e8b0b8969ea..5da2e23ba4b8268b5ec9b21a8b910a6c75597a46 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ObserverTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ObserverTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Catalog\Test\Unit\Model; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -63,7 +65,6 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->_observer = (new ObjectManager($this))->getObject('Magento\Catalog\Model\Observer', [ - 'urlFactory' => $this->_getCleanMock('\Magento\Catalog\Model\UrlFactory'), 'categoryResource' => $this->_getCleanMock('\Magento\Catalog\Model\Resource\Category'), 'catalogProduct' => $this->_getCleanMock('\Magento\Catalog\Model\Resource\Product'), 'storeManager' => $this->_storeManager, diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php index 198953711d6087eb6627848b2d6abc8c0abd77f9..0689f5062dcca1d5ab7f07efd57b35de33e81b6d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php @@ -79,16 +79,16 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $this->eavAttributeRepositoryMock = $this->getMock('Magento\Eav\Api\AttributeRepositoryInterface', [], [], '', false); $this->eavConfigMock = $this->getMock('Magento\Eav\Model\Config', [], [], '', false); + $this->eavConfigMock->expects($this->any())->method('getEntityType') + ->willReturn(new \Magento\Framework\Object(['default_attribute_set_id' => 4])); $this->validatorFactoryMock = $this->getMock( 'Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory', [], [], '', false); - $this->metadataConfigMock = - $this->getMock('Magento\Framework\Api\Config\MetadataConfig', [], [], '', false); $this->searchCriteriaBuilderMock = - $this->getMock('Magento\Framework\Api\SearchCriteriaDataBuilder', [], [], '', false); + $this->getMock('Magento\Framework\Api\SearchCriteriaBuilder', [], [], '', false); $this->filterBuilderMock = $this->getMock('Magento\Framework\Api\FilterBuilder', [], [], '', false); $this->searchResultMock = @@ -98,7 +98,10 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase 'getItems', 'getSearchCriteria', 'getTotalCount', - '__wakeup' + 'setItems', + 'setSearchCriteria', + 'setTotalCount', + '__wakeup', ], [], '', @@ -111,7 +114,6 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $this->eavAttributeRepositoryMock, $this->eavConfigMock, $this->validatorFactoryMock, - $this->metadataConfigMock, $this->searchCriteriaBuilderMock, $this->filterBuilderMock ); @@ -174,9 +176,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase ->willReturnSelf(); $this->filterBuilderMock->expects($this->once()) ->method('setValue') - ->with( - \Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID - ) + ->with(4) ->willReturnSelf(); $this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock); $this->searchCriteriaBuilderMock->expects($this->once()) @@ -193,11 +193,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $searchCriteriaMock )->willReturn($this->searchResultMock); $this->searchResultMock->expects($this->once())->method('getItems')->willReturn([$itemMock]); - $this->metadataConfigMock->expects($this->once()) - ->method('getCustomAttributesMetadata') - ->with(null) - ->willReturn(['Attribute metadata']); - $expected = array_merge([$itemMock], ['Attribute metadata']); + $expected = [$itemMock]; $this->assertEquals($expected, $this->model->getCustomAttributesMetadata()); } diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetRepositoryTest.php index c4717b0f781730e62ab7fb204c5f9d243d9cc261..70ba8feab8dac3e42fa185581ef583a60b784acd 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/SetRepositoryTest.php @@ -37,7 +37,7 @@ class SetRepositoryTest extends \PHPUnit_Framework_TestCase { $this->attrSetRepositoryMock = $this->getMock('\Magento\Eav\Api\AttributeSetRepositoryInterface'); $this->searchCriteriaBuilderMock = $this->getMock( - '\Magento\Framework\Api\SearchCriteriaDataBuilder', + '\Magento\Framework\Api\SearchCriteriaBuilder', [], [], '', diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php index 1d5e2965e56891741975efd17a09321020095e1f..8da00cc15b23018240ae436100afdefd3019671e 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php @@ -4,6 +4,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Catalog\Test\Unit\Model\Product\Gallery; class GalleryManagementTest extends \PHPUnit_Framework_TestCase @@ -68,6 +71,11 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase */ protected $dataObjectHelperMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\AttributeValue + */ + protected $attributeValueMock; + protected function setUp() { $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface'); @@ -108,7 +116,17 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase ); $this->productMock = $this->getMock( '\Magento\Catalog\Model\Product', - ['getTypeInstance', 'getSetAttributes', 'setStoreId', 'getMediaAttributes', 'getMediaGallery', 'getData'], + [ + 'getTypeInstance', + 'getSetAttributes', + 'setStoreId', + 'getMediaAttributes', + 'getMediaGallery', + 'getData', + 'getStoreId', + 'getSku', + 'getCustomAttribute' + ], [], '', false @@ -125,6 +143,9 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $this->mediaGalleryMock, $this->dataObjectHelperMock ); + $this->attributeValueMock = $this->getMockBuilder('\Magento\Framework\Api\AttributeValue') + ->disableOriginalConstructor() + ->getMock(); } /** @@ -133,16 +154,9 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase */ public function testCreateWithNoStoreException() { - $productSku = 'mediaProduct'; - $storeId = 0; - $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); - $entryContentMock = $this->getMock( - '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' - ); - $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId) + $this->storeManagerMock->expects($this->once())->method('getStore') ->willThrowException(new \Exception()); - $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - $this->model->create($productSku, $entryMock, $entryContentMock, $storeId); + $this->model->create($this->productMock); } /** @@ -151,17 +165,26 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase */ public function testCreateWithInvalidImageException() { - $productSku = 'mediaProduct'; - $storeId = 0; $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $entryContentMock = $this->getMock( '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' ); + $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); + $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); + + $storeId = 0; + $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); + $this->productMock->expects($this->any()) + ->method('getCustomAttribute') + ->with('media_gallery') + ->willReturn($this->attributeValueMock); + $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); $this->contentValidatorMock->expects($this->once())->method('isValid')->with($entryContentMock) ->willReturn(false); $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - $this->model->create($productSku, $entryMock, $entryContentMock, $storeId); + + $this->model->create($this->productMock); } /** @@ -171,11 +194,24 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase public function testCreateWithProductWithoutImagesSupport() { $productSku = 'mediaProduct'; - $storeId = 0; $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $entryContentMock = $this->getMock( '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' ); + $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); + $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); + + $storeId = 0; + $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); + $this->productMock->expects($this->any())->method('getSku')->willReturn($productSku); + $this->productMock->expects($this->any()) + ->method('getCustomAttribute') + ->with('media_gallery') + ->willReturn($this->attributeValueMock); + + $this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId); + $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); + $writeInterfaceMock = $this->getMock('\Magento\Framework\Filesystem\Directory\WriteInterface'); $entryData = 'entryData'; $mediaTmpPath = '/media/tmp/path'; @@ -200,7 +236,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $this->productMock->expects($this->once())->method('getSetAttributes')->with($this->productMock) ->willReturn([]); $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - $this->model->create($productSku, $entryMock, $entryContentMock, $storeId); + $this->model->create($this->productMock); } /** @@ -210,13 +246,23 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase public function testCreateWithCannotSaveException() { $productSku = 'mediaProduct'; - $storeId = 0; - $entryPosition = 'entryPosition'; - $absolutePath = 'absolute/path'; $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $entryContentMock = $this->getMock( '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' ); + $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); + $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); + + $storeId = 0; + $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); + $this->productMock->expects($this->any())->method('getSku')->willReturn($productSku); + $this->productMock->expects($this->any()) + ->method('getCustomAttribute') + ->with('media_gallery') + ->willReturn($this->attributeValueMock); + + $entryPosition = 'entryPosition'; + $absolutePath = 'absolute/path'; $productMediaGalleryMock = $this->getMock( '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', ['addImage', 'updateImage'], @@ -252,7 +298,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase ->willReturn(['media_gallery' => $attributeMock]); $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); $entryMock->expects($this->once())->method('getTypes')->willReturn(['jpg']); - $entryMock->expects($this->exactly(2))->method('getIsDisabled')->willReturn(false); + $entryMock->expects($this->exactly(2))->method('isDisabled')->willReturn(false); $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); $productMediaGalleryMock->expects($this->once())->method('addImage')->with( @@ -271,23 +317,33 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase 'disabled' => false ] ); - $this->productMock->expects($this->once())->method('setStoreId')->with($storeId); $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock) ->willThrowException(new \Exception()); $this->entryResolverMock->expects($this->never())->method('getEntryIdByFilePath'); - $this->model->create($productSku, $entryMock, $entryContentMock, $storeId); + $this->model->create($this->productMock); } public function testCreate() { $productSku = 'mediaProduct'; - $storeId = 0; - $entryPosition = 'entryPosition'; - $absolutePath = 'absolute/path'; $entryMock = $this->getMock('\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'); $entryContentMock = $this->getMock( '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryContentInterface' ); + $entryMock->expects($this->any())->method('getContent')->willReturn($entryContentMock); + $this->attributeValueMock->expects($this->any())->method('getValue')->willReturn($entryMock); + + $storeId = 0; + $this->productMock->expects($this->any())->method('getStoreId')->willReturn($storeId); + $this->productMock->expects($this->any())->method('getSku')->willReturn($productSku); + $this->productMock->expects($this->any()) + ->method('getCustomAttribute') + ->with('media_gallery') + ->willReturn($this->attributeValueMock); + + $entryPosition = 'entryPosition'; + $absolutePath = 'absolute/path'; + $productMediaGalleryMock = $this->getMock( '\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend', ['addImage', 'updateImage', 'getRenamedImage'], @@ -323,7 +379,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase ->willReturn(['media_gallery' => $attributeMock]); $attributeMock->expects($this->once())->method('getBackend')->willReturn($productMediaGalleryMock); $entryMock->expects($this->once())->method('getTypes')->willReturn(['jpg']); - $entryMock->expects($this->exactly(2))->method('getIsDisabled')->willReturn(false); + $entryMock->expects($this->exactly(2))->method('isDisabled')->willReturn(false); $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); $productMediaGalleryMock->expects($this->once())->method('addImage')->with( @@ -342,7 +398,6 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase 'disabled' => false ] ); - $this->productMock->expects($this->once())->method('setStoreId')->with($storeId); $this->productRepositoryMock->expects($this->once())->method('save')->with($this->productMock); $writeInterfaceMock->expects($this->once())->method('delete')->with($relativeFilePath); $productMediaGalleryMock->expects($this->once())->method('getRenamedImage')->with($imageFileUri) @@ -351,7 +406,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $this->productMock, 'renamed' )->willReturn(42); - $this->assertEquals(42, $this->model->create($productSku, $entryMock, $entryContentMock, $storeId)); + $this->assertEquals(42, $this->model->create($this->productMock)); } /** @@ -430,7 +485,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $entryMock->expects($this->once())->method('getId')->willReturn($entryId); $this->entryResolverMock->expects($this->once())->method('getEntryFilePathById') ->with($this->productMock, $entryId)->willReturn($filePath); - $entryMock->expects($this->once())->method('getIsDisabled')->willReturn(false); + $entryMock->expects($this->once())->method('isDisabled')->willReturn(false); $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); $productMediaGalleryMock->expects($this->once())->method('updateImage')->with( @@ -485,7 +540,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase $entryMock->expects($this->once())->method('getId')->willReturn($entryId); $this->entryResolverMock->expects($this->once())->method('getEntryFilePathById') ->with($this->productMock, $entryId)->willReturn($filePath); - $entryMock->expects($this->once())->method('getIsDisabled')->willReturn(false); + $entryMock->expects($this->once())->method('isDisabled')->willReturn(false); $entryMock->expects($this->once())->method('getPosition')->willReturn($entryPosition); $entryMock->expects($this->once())->method('getLabel')->willReturn('entryLabel'); $productMediaGalleryMock->expects($this->once())->method('updateImage')->with( @@ -640,7 +695,7 @@ class GalleryManagementTest extends \PHPUnit_Framework_TestCase ->with($gallery[0]['label_default'])->willReturnSelf(); $entryMock->expects($this->once())->method('setTypes') ->with([])->willReturnSelf(); - $entryMock->expects($this->once())->method('setIsDisabled') + $entryMock->expects($this->once())->method('setDisabled') ->with($gallery[0]['disabled_default'])->willReturnSelf(); $entryMock->expects($this->once())->method('setPosition') ->with($gallery[0]['position_default'])->willReturnSelf(); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php index cf436ae14b35b862f0d8297f2c704115d90bee03..4fcdb62579697612abcce7d2a2e6dc79ce800b16 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Catalog\Test\Unit\Model\ProductLink; use Magento\Framework\Exception\NoSuchEntityException; @@ -228,7 +231,8 @@ class ManagementTest extends \PHPUnit_Framework_TestCase 'getLinkedProductSku', 'getProductSku', 'getLinkType', '__toArray', 'getLinkedProductType', 'getPosition', 'getCustomAttribute', 'getCustomAttributes', 'setCustomAttribute', 'setCustomAttributes', 'getMetadataServiceInterface', - 'setLinkedProductSku', 'setProductSku', 'setLinkType', 'setLinkedProductType', 'setPosition', + 'getExtensionAttributes', 'setExtensionAttributes', + 'setLinkedProductSku', 'setProductSku', 'setLinkType', 'setLinkedProductType', 'setPosition' ] ); $productLinkMock->expects($this->any()) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php index 24213fbc4ca9485260dff7ca74527fa015af6a0d..affded52e9586413fb24378919bf538fdf4b74fb 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Catalog\Test\Unit\Model\ProductLink; class RepositoryTest extends \PHPUnit_Framework_TestCase @@ -28,6 +31,9 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase */ protected $linkInitializerMock; + /** + * Test method + */ protected function setUp() { $linkManagementMock = $this->getMock('\Magento\Catalog\Model\ProductLink\Management', [], [], '', false); @@ -58,6 +64,9 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test method + */ public function testSave() { $entityMock = $this->getMock('\Magento\Catalog\Model\ProductLink\Link', [], [], '', false); @@ -70,18 +79,14 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase ['linkedProduct', false, null, $linkedProductMock], ] )); - $customAttributeMock = $this->getMock('\Magento\Framework\Api\AttributeInterface'); - $customAttributeMock->expects($this->once())->method('getAttributeCode')->willReturn('attribute_code'); - $customAttributeMock->expects($this->once())->method('getValue')->willReturn('value'); $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct'); $entityMock->expects($this->once())->method('getProductSku')->willReturn('product'); $entityMock->expects($this->exactly(2))->method('getLinkType')->willReturn('linkType'); $entityMock->expects($this->once())->method('__toArray')->willReturn([]); - $entityMock->expects($this->once())->method('getCustomAttributes')->willReturn([$customAttributeMock]); $linkedProductMock->expects($this->exactly(2))->method('getId')->willReturn(42); $this->entityCollectionProviderMock->expects($this->once())->method('getCollection')->willReturn([]); $this->linkInitializerMock->expects($this->once())->method('initializeLinks')->with($productMock, [ - 'linkType' => [42 => ['attribute_code' => 'value', 'product_id' => 42]] + 'linkType' => [42 => ['product_id' => 42]] ]); $this->assertTrue($this->model->save($entityMock)); } @@ -101,10 +106,6 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase ['linkedProduct', false, null, $linkedProductMock], ] )); - $customAttributeMock = $this->getMock('\Magento\Framework\Api\AttributeInterface'); - $customAttributeMock->expects($this->once())->method('getAttributeCode')->willReturn('attribute_code'); - $customAttributeMock->expects($this->once())->method('getValue')->willReturn('value'); - $entityMock->expects($this->once())->method('getCustomAttributes')->willReturn([$customAttributeMock]); $entityMock->expects($this->once())->method('getLinkedProductSku')->willReturn('linkedProduct'); $entityMock->expects($this->once())->method('getProductSku')->willReturn('product'); $entityMock->expects($this->exactly(2))->method('getLinkType')->willReturn('linkType'); @@ -112,12 +113,15 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $linkedProductMock->expects($this->exactly(2))->method('getId')->willReturn(42); $this->entityCollectionProviderMock->expects($this->once())->method('getCollection')->willReturn([]); $this->linkInitializerMock->expects($this->once())->method('initializeLinks')->with($productMock, [ - 'linkType' => [42 => ['attribute_code' => 'value', 'product_id' => 42]] + 'linkType' => [42 => ['product_id' => 42]] ]); $productMock->expects($this->once())->method('save')->willThrowException(new \Exception()); $this->model->save($entityMock); } + /** + * Test method + */ public function testDelete() { $entityMock = $this->getMock('\Magento\Catalog\Model\ProductLink\Link', [], [], '', false); diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index 6ac9a5530e2fb31c53f4c3dd758a85cf17851e19..8a7930bb0f6d7243e66fc68fcbc51751d517f6d5 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -4,6 +4,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Catalog\Test\Unit\Model; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -58,7 +61,17 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $searchResultsBuilderMock; + protected $searchResultsFactoryMock; + + /** + * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eavConfigMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $extensibleDataObjectConverterMock; /** * @var array data to create product @@ -93,7 +106,7 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase false ); $this->searchCriteriaBuilderMock = $this->getMock( - '\Magento\Framework\Api\SearchCriteriaDataBuilder', + '\Magento\Framework\Api\SearchCriteriaBuilder', [], [], '', @@ -106,16 +119,25 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase '', false ); - $this->searchResultsBuilderMock = $this->getMock( - '\Magento\Catalog\Api\Data\ProductSearchResultsDataBuilder', - ['setSearchCriteria', 'setItems', 'setTotalCount', 'create'], + $this->searchResultsFactoryMock = $this->getMock( + '\Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory', + ['create'], [], '', false ); $this->resourceModelMock = $this->getMock('\Magento\Catalog\Model\Resource\Product', [], [], '', false); + $this->eavConfigMock = $this->getMock('Magento\Eav\Model\Config', [], [], '', false); + $this->eavConfigMock->expects($this->any())->method('getEntityType') + ->willReturn(new \Magento\Framework\Object(['default_attribute_set_id' => 4])); $this->objectManager = new ObjectManager($this); + $this->extensibleDataObjectConverterMock = $this + ->getMockBuilder('\Magento\Framework\Api\ExtensibleDataObjectConverter') + ->setMethods(['toNestedArray']) + ->disableOriginalConstructor() + ->getMock(); + $this->model = $this->objectManager->getObject( 'Magento\Catalog\Model\ProductRepository', [ @@ -126,7 +148,9 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase 'collectionFactory' => $this->collectionFactoryMock, 'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock, 'metadataServiceInterface' => $this->metadataServiceMock, - 'searchResultsBuilder' => $this->searchResultsBuilderMock + 'searchResultsFactory' => $this->searchResultsFactoryMock, + 'extensibleDataObjectConverter' => $this->extensibleDataObjectConverterMock, + 'eavConfig' => $this->eavConfigMock, ] ); } @@ -243,30 +267,34 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase public function testSaveExisting() { $this->resourceModelMock->expects($this->exactly(2))->method('getIdBySku')->will($this->returnValue(100)); - $this->productMock->expects($this->once())->method('toFlatArray')->will($this->returnValue($this->productData)); $this->productFactoryMock->expects($this->once()) ->method('create') ->will($this->returnValue($this->productMock)); $this->initializationHelperMock->expects($this->once())->method('initialize')->with($this->productMock); $this->resourceModelMock->expects($this->once())->method('validate')->with($this->productMock) ->willReturn(true); - $this->productMock->expects($this->once())->method('toFlatArray')->will($this->returnValue($this->productData)); $this->resourceModelMock->expects($this->once())->method('save')->with($this->productMock)->willReturn(true); + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); $this->assertEquals($this->productMock, $this->model->save($this->productMock)); } public function testSaveNew() { $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); - $this->productMock->expects($this->once())->method('toFlatArray')->will($this->returnValue($this->productData)); $this->productFactoryMock->expects($this->once()) ->method('create') ->will($this->returnValue($this->productMock)); $this->initializationHelperMock->expects($this->never())->method('initialize')->with($this->productMock); $this->resourceModelMock->expects($this->once())->method('validate')->with($this->productMock) ->willReturn(true); - $this->productMock->expects($this->once())->method('toFlatArray')->will($this->returnValue($this->productData)); $this->resourceModelMock->expects($this->once())->method('save')->with($this->productMock)->willReturn(true); + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); $this->assertEquals($this->productMock, $this->model->save($this->productMock)); } @@ -277,7 +305,6 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase public function testSaveUnableToSaveException() { $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); - $this->productMock->expects($this->once())->method('toFlatArray')->will($this->returnValue($this->productData)); $this->productFactoryMock->expects($this->once()) ->method('create') ->will($this->returnValue($this->productMock)); @@ -286,6 +313,10 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase ->willReturn(true); $this->resourceModelMock->expects($this->once())->method('save')->with($this->productMock) ->willThrowException(new \Exception()); + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); $this->model->save($this->productMock); } @@ -296,7 +327,6 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase public function testSaveException() { $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); - $this->productMock->expects($this->once())->method('toFlatArray')->will($this->returnValue($this->productData)); $this->productFactoryMock->expects($this->once()) ->method('create') ->will($this->returnValue($this->productMock)); @@ -306,6 +336,10 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase $this->resourceModelMock->expects($this->once())->method('save')->with($this->productMock) ->willThrowException(new \Magento\Eav\Model\Entity\Attribute\Exception('123')); $this->productMock->expects($this->never())->method('getId'); + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); $this->model->save($this->productMock); } @@ -316,7 +350,6 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase public function testSaveInvalidProductException() { $this->resourceModelMock->expects($this->exactly(1))->method('getIdBySku')->will($this->returnValue(null)); - $this->productMock->expects($this->once())->method('toFlatArray')->will($this->returnValue($this->productData)); $this->productFactoryMock->expects($this->once()) ->method('create') ->will($this->returnValue($this->productMock)); @@ -324,6 +357,10 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase $this->resourceModelMock->expects($this->once())->method('validate')->with($this->productMock) ->willReturn(['error1', 'error2']); $this->productMock->expects($this->never())->method('getId'); + $this->extensibleDataObjectConverterMock + ->expects($this->once()) + ->method('toNestedArray') + ->will($this->returnValue($this->productData)); $this->model->save($this->productMock); } @@ -392,7 +429,7 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase ->will($this->returnSelf()); $this->filterBuilderMock->expects($this->once())->method('create')->willReturn($filterMock); $this->filterBuilderMock->expects($this->once())->method('setValue') - ->with(\Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID) + ->with(4) ->willReturn($this->filterBuilderMock); $this->searchCriteriaBuilderMock->expects($this->once())->method('addFilter')->with([$filterMock]) ->willReturn($searchCriteriaBuilderMock); @@ -424,13 +461,19 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase $searchCriteriaMock->expects($this->once())->method('getPageSize')->willReturn(42); $collectionMock->expects($this->once())->method('setPageSize')->with(42); $collectionMock->expects($this->once())->method('load'); - $this->searchResultsBuilderMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock); $collectionMock->expects($this->once())->method('getItems')->willReturn([$itemsMock]); - $this->searchResultsBuilderMock->expects($this->once())->method('setItems')->with([$itemsMock]); $collectionMock->expects($this->once())->method('getSize')->willReturn(128); - $this->searchResultsBuilderMock->expects($this->once())->method('setTotalCount')->with(128); - $this->searchResultsBuilderMock->expects($this->once())->method('create')->willReturnSelf(); - $this->assertEquals($this->searchResultsBuilderMock, $this->model->getList($searchCriteriaMock)); + $searchResultsMock = $this->getMock( + '\Magento\Catalog\Api\Data\ProductSearchResultsInterface', + [], + [], + '', + false + ); + $searchResultsMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock); + $searchResultsMock->expects($this->once())->method('setItems')->with([$itemsMock]); + $this->searchResultsFactoryMock->expects($this->once())->method('create')->willReturn($searchResultsMock); + $this->assertEquals($searchResultsMock, $this->model->getList($searchCriteriaMock)); } /** @@ -455,44 +498,44 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase [ 'identifier' => 'test-sku', 'editMode' => false, - 'storeId' => null + 'storeId' => null, ], [ 'identifier' => 25, 'editMode' => false, - 'storeId' => null + 'storeId' => null, ], [ 'identifier' => 25, 'editMode' => true, - 'storeId' => null + 'storeId' => null, ], [ 'identifier' => 'test-sku', 'editMode' => true, - 'storeId' => null + 'storeId' => null, ], [ 'identifier' => 25, 'editMode' => true, - 'storeId' => $anyObject + 'storeId' => $anyObject, ], [ 'identifier' => 'test-sku', 'editMode' => true, - 'storeId' => $anyObject + 'storeId' => $anyObject, ], [ 'identifier' => 25, 'editMode' => false, - 'storeId' => $anyObject + 'storeId' => $anyObject, ], [ 'identifier' => 'test-sku', 'editMode' => false, - 'storeId' => $anyObject - ] + 'storeId' => $anyObject, + ], ]; } } diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index 92b97c635b087e12dfe820a58502df8d5e23322c..f6e7adcc008d5c41bcffa81f1aad61c587900316 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -8,7 +8,6 @@ "magento/module-cms": "0.42.0-beta11", "magento/module-indexer": "0.42.0-beta11", "magento/module-customer": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-theme": "0.42.0-beta11", "magento/module-checkout": "0.42.0-beta11", "magento/module-log": "0.42.0-beta11", diff --git a/app/code/Magento/Catalog/etc/config.xml b/app/code/Magento/Catalog/etc/config.xml index 27791541c72009b293df7ae93d4cd044c1d0ea67..9d4433c045425e2902dbc8b60c43ba01fcbeba7a 100644 --- a/app/code/Magento/Catalog/etc/config.xml +++ b/app/code/Magento/Catalog/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <catalog> <navigation> diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index d446005fc57a5f10d15c0d32f7b71920f9e81562..971bebcac3226849a1af0c88b08925230ea83246 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -442,16 +442,6 @@ <type name="Magento\Catalog\Model\Resource\Config"> <plugin name="productListingAttributesCaching" type="Magento\Catalog\Plugin\Model\Resource\Config" /> </type> - <type name="Magento\Catalog\Api\Data\CategoryDataBuilder"> - <arguments> - <argument name="metadataService" xsi:type="object">Magento\Catalog\Model\Category\AttributeRepository\Proxy</argument> - </arguments> - </type> - <type name="Magento\Catalog\Api\Data\ProductDataBuilder"> - <arguments> - <argument name="metadataService" xsi:type="object">Magento\Catalog\Model\Product\Attribute\Repository\Proxy</argument> - </arguments> - </type> <preference for="Magento\Catalog\Api\ProductLinkTypeListInterface" type="Magento\Catalog\Model\Product\LinkTypeProvider" /> <preference for="Magento\Catalog\Api\Data\ProductLinkAttributeInterface" type="\Magento\Catalog\Model\ProductLink\Attribute" /> <preference for="Magento\Catalog\Api\Data\ProductLinkTypeInterface" type="Magento\Catalog\Model\ProductLink\Type" /> diff --git a/app/code/Magento/Catalog/etc/frontend/page_types.xml b/app/code/Magento/Catalog/etc/frontend/page_types.xml index 2f789b816c75f328b7c05bd487c02064f88aefdc..7dc0beef39a5bfe7c47a704f09831547c1e9629d 100644 --- a/app/code/Magento/Catalog/etc/frontend/page_types.xml +++ b/app/code/Magento/Catalog/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="catalog_category_view" label="Catalog Category"/> <type id="catalog_product_compare_index" label="Catalog Product Compare List"/> <type id="catalog_product_gallery" label="Catalog Product Image Gallery Popup"/> diff --git a/app/code/Magento/Catalog/etc/webapi.xml b/app/code/Magento/Catalog/etc/webapi.xml index ab2485a26fd46723617e522964bb4724a5af8285..a4fb44c7eae061b3547fee1c93d61889dd923b7a 100644 --- a/app/code/Magento/Catalog/etc/webapi.xml +++ b/app/code/Magento/Catalog/etc/webapi.xml @@ -21,7 +21,7 @@ <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/products/:productSku" method="DELETE"> + <route url="/V1/products/:sku" method="DELETE"> <service class="Magento\Catalog\Api\ProductRepositoryInterface" method="deleteById"/> <resources> <resource ref="Magento_Catalog::products" /> @@ -33,7 +33,7 @@ <resource ref="anonymous" /> </resources> </route> - <route url="/V1/products/:productSku" method="GET"> + <route url="/V1/products/:sku" method="GET"> <service class="Magento\Catalog\Api\ProductRepositoryInterface" method="get"/> <resources> <resource ref="anonymous" /> @@ -196,31 +196,31 @@ <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/:productSku/media/:imageId" method="GET"> + <route url="/V1/products/:sku/media/:imageId" method="GET"> <service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="get"/> <resources> <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/:productSku/media" method="POST"> + <route url="/V1/products/media" method="POST"> <service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="create"/> <resources> <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/media/:entryId" method="PUT"> + <route url="/V1/products/:sku/media/:entryId" method="PUT"> <service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="update"/> <resources> <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/media/:entryId" method="DELETE"> + <route url="/V1/products/:sku/media/:entryId" method="DELETE"> <service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="remove"/> <resources> <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/media" method="GET"> + <route url="/V1/products/:sku/media" method="GET"> <service class="Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface" method="getList"/> <resources> <resource ref="anonymous"/> @@ -228,19 +228,19 @@ </route> <!-- Group Price --> - <route url="/V1/products/:productSku/group-prices/" method="GET"> + <route url="/V1/products/:sku/group-prices/" method="GET"> <service class="Magento\Catalog\Api\ProductGroupPriceManagementInterface" method="getList"/> <resources> <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/:productSku/group-prices/:customerGroupId/price/:price" method="POST"> + <route url="/V1/products/:sku/group-prices/:customerGroupId/price/:price" method="POST"> <service class="Magento\Catalog\Api\ProductGroupPriceManagementInterface" method="add"/> <resources> <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/group-prices/:customerGroupId/" method="DELETE"> + <route url="/V1/products/:sku/group-prices/:customerGroupId/" method="DELETE"> <service class="Magento\Catalog\Api\ProductGroupPriceManagementInterface" method="remove"/> <resources> <resource ref="Magento_Catalog::catalog"/> @@ -248,19 +248,19 @@ </route> <!-- Tear Price --> - <route url="/V1/products/:productSku/group-prices/:customerGroupId/tiers" method="GET"> + <route url="/V1/products/:sku/group-prices/:customerGroupId/tiers" method="GET"> <service class="Magento\Catalog\Api\ProductTierPriceManagementInterface" method="getList"/> <resources> <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/:productSku/group-prices/:customerGroupId/tiers/:qty/price/:price" method="POST"> + <route url="/V1/products/:sku/group-prices/:customerGroupId/tiers/:qty/price/:price" method="POST"> <service class="Magento\Catalog\Api\ProductTierPriceManagementInterface" method="add"/> <resources> <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/group-prices/:customerGroupId/tiers/:qty" method="DELETE"> + <route url="/V1/products/:sku/group-prices/:customerGroupId/tiers/:qty" method="DELETE"> <service class="Magento\Catalog\Api\ProductTierPriceManagementInterface" method="remove"/> <resources> <resource ref="Magento_Catalog::catalog"/> @@ -311,13 +311,13 @@ <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/options" method="GET"> + <route url="/V1/products/:sku/options" method="GET"> <service class="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface" method="getList"/> <resources> <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/:productSku/options/:optionId" method="GET"> + <route url="/V1/products/:sku/options/:optionId" method="GET"> <service class="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface" method="get"/> <resources> <resource ref="anonymous"/> @@ -335,7 +335,7 @@ <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/options/:optionId" method="DELETE"> + <route url="/V1/products/:sku/options/:optionId" method="DELETE"> <service class="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface" method="deleteByIdentifier"/> <resources> <resource ref="Magento_Catalog::catalog"/> @@ -355,25 +355,25 @@ <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/:productSku/links/:type" method="GET"> + <route url="/V1/products/:sku/links/:type" method="GET"> <service class="Magento\Catalog\Api\ProductLinkManagementInterface" method="getLinkedItemsByType"/> <resources> <resource ref="anonymous"/> </resources> </route> - <route url="/V1/products/:productSku/links/:type" method="POST"> + <route url="/V1/products/:sku/links/:type" method="POST"> <service class="Magento\Catalog\Api\ProductLinkManagementInterface" method="setProductLinks"/> <resources> <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:productSku/links/:type/:linkedProductSku" method="DELETE"> + <route url="/V1/products/:sku/links/:type/:linkedProductSku" method="DELETE"> <service class="Magento\Catalog\Api\ProductLinkRepositoryInterface" method="deleteById"/> <resources> <resource ref="Magento_Catalog::catalog"/> </resources> </route> - <route url="/V1/products/:product_sku/links/:link_type" method="PUT"> + <route url="/V1/products/:sku/links/:link_type" method="PUT"> <service class="Magento\Catalog\Api\ProductLinkRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Catalog::catalog"/> @@ -399,7 +399,7 @@ <resource ref="Magento_Catalog::categories" /> </resources> </route> - <route url="/V1/categories/:categoryId/products/:productSku" method="DELETE"> + <route url="/V1/categories/:categoryId/products/:sku" method="DELETE"> <service class="Magento\Catalog\Api\CategoryLinkRepositoryInterface" method="deleteByIds" /> <resources> <resource ref="Magento_Catalog::categories" /> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml index f56ab28a4b7cf8d1fd1271c769f51860b233cf4e..999e11608c9218837b8b8ddec5f542c9afb84431 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml @@ -13,10 +13,11 @@ <script> require([ + 'jquery', "prototype", "extjs/ext-tree-checkbox", "mage/adminhtml/form" - ], function(){ + ], function(jQuery){ //<![CDATA[ @@ -69,7 +70,7 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { } }); -Ext.onReady(function() +jQuery(function() { var categoryLoader = new Ext.tree.TreeLoader({ dataUrl: '<?php echo $block->getLoadTreeUrl() ?>' diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml index 11ee3d968ae71456177951cdbcd337a4eef7aab5..f80c4d2ac53cdf71f504450e1c6b74ce4cff440a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml @@ -276,7 +276,7 @@ function _renderNewTree(config, scopeParams) { //updateContent(url); //commented since ajax requests replaced with http ones to load a category } -Ext.onReady(function () { +jQuery(function () { categoryLoader = new Ext.tree.TreeLoader({ dataUrl:'<?php echo $block->getLoadTreeUrl() ?>' }); diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml index 45dcffcf34afd2c03acc10c4fbc56f17320d648f..c578a7e5e17b2dadf607f62421daefcc24ba8866 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml @@ -12,7 +12,7 @@ <div id="<?php echo $_divId ?>" class="tree"></div> <script> -require(["prototype", "extjs/ext-tree-checkbox"], function(){ +require(['jquery', "prototype", "extjs/ext-tree-checkbox"], function(jQuery){ var tree<?php echo $block->getId() ?>; @@ -54,7 +54,7 @@ Ext.extend(Ext.tree.TreePanel.Enhanced, Ext.tree.TreePanel, { } }); -Ext.onReady(function() +jQuery(function() { var emptyNodeAdded = <?php echo($block->getWithEmptyNode() ? 'false' : 'true') ?>; diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index a85267c7e753797a8f3c18bf3b95069b63c5df3f..0d0cbb27f2ec51e2a2812d602685b6584b348481 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -47,16 +47,16 @@ <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?> <div data-role="draggable-handle" class="draggable-handle" title="<?php echo __('Sort Option'); ?>"></div> <?php endif; ?> - <input data-role="order" type="hidden" name="option[order][<%= data.id %>]" value="<%= data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/> + <input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?> disabled="disabled"<?php endif; ?>/> </td> <td class="col-default"> - <input class="input-radio" type="<%= data.intype %>" name="default[]" value="<%= data.id %>" <%= data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/> + <input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/> </td> <?php foreach ($block->getStores() as $_store): ?> - <td class="col-<%= data.id %>"><input name="option[value][<%= data.id %>][<?php echo $_store->getId() ?>]" value="<%= data.store<?php echo $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td> + <td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?php echo $_store->getId() ?>]" value="<%- data.store<?php echo $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td> <?php endforeach; ?> - <td id="delete_button_container_<%= data.id %>" class="col-delete"> - <input type="hidden" class="delete-flag" name="option[delete][<%= data.id %>]" value="" /> + <td id="delete_button_container_<%- data.id %>" class="col-delete"> + <input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value="" /> <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?> <button title="<?php echo __('Delete') ?>" type="button" class="action- scalable delete delete-option" diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml index 58fa60e3ab5950a75187b8d71f39001ccacd937d..8ecc1010f041eb2608ff46013923ceef369047ff 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/attribute_set.phtml @@ -14,7 +14,7 @@ <% } %> <ul data-mage-init='{"menu":[]}'> <% _.each(data.items, function(value) { %> - <li <%= data.optionData(value) %>><a href="#"><%= value.label %></a></li> + <li <%- data.optionData(value) %>><a href="#"><%- value.label %></a></li> <% }); %> </ul> <% if (!data.term && data.items.length && !data.allShown()) { %> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml index 4dbb26fbc2eac4272a84f5d2fd7471a09f7273ab..f6a4d3c30b2dd276c9521bdd6f4bd0dd1186f2d4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/option.phtml @@ -10,48 +10,48 @@ <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Option */ ?> <?php echo $block->getTemplatesHtml() ?> <script id="custom-option-base-template" type="text/x-magento-template"> - <div class="fieldset-wrapper collapsable-wrapper opened" id="option_<%= data.id %>"> + <div class="fieldset-wrapper collapsable-wrapper opened" id="option_<%- data.id %>"> <div class="fieldset-wrapper-title"> - <strong class="title" data-toggle="collapse" data-target="#<%= data.id %>-content"> - <span id="option_<%= data.id %>_header_title"><%= data.title %></span> + <strong class="title" data-toggle="collapse" data-target="#<%- data.id %>-content"> + <span id="option_<%- data.id %>_header_title"><%- data.title %></span> </strong> <div class="actions"> - <button type="button" title="<?php echo __('Delete Custom Option'); ?>" class="action-delete" id="<?php echo $block->getFieldId() ?>_<%= data.id %>_delete"> + <button type="button" title="<?php echo __('Delete Custom Option'); ?>" class="action-delete" id="<?php echo $block->getFieldId() ?>_<%- data.id %>_delete"> <span><?php echo __('Delete Custom Option'); ?></span> </button> </div> - <div id="<?php echo $block->getFieldId() ?>_<%= data.id %>_move" data-role="draggable-handle" class="draggable-handle" + <div id="<?php echo $block->getFieldId() ?>_<%- data.id %>_move" data-role="draggable-handle" class="draggable-handle" title="<?php echo __('Sort Custom Options'); ?>"></div> </div> - <div class="fieldset-wrapper-content in collapse" id="<%= data.id %>-content"> + <div class="fieldset-wrapper-content in collapse" id="<%- data.id %>-content"> <fieldset class="fieldset"> - <fieldset class="fieldset-alt" id="<?php echo $block->getFieldId() ?>_<%= data.id %>"> - <input id="<?php echo $block->getFieldId() ?>_<%= data.id %>_is_delete" name="<?php echo $block->getFieldName() ?>[<%= data.id %>][is_delete]" type="hidden" value=""/> - <input id="<?php echo $block->getFieldId() ?>_<%= data.id %>_previous_type" name="<?php echo $block->getFieldName() ?>[<%= data.id %>][previous_type]" type="hidden" value="<%= data.type %>"/> - <input id="<?php echo $block->getFieldId() ?>_<%= data.id %>_previous_group" name="<?php echo $block->getFieldName() ?>[<%= data.id %>][previous_group]" type="hidden" value=""/> - <input id="<?php echo $block->getFieldId() ?>_<%= data.id %>_id" name="<?php echo $block->getFieldName() ?>[<%= data.id %>][id]" type="hidden" value="<%= data.id %>"/> - <input id="<?php echo $block->getFieldId() ?>_<%= data.id %>_option_id" name="<?php echo $block->getFieldName() ?>[<%= data.id %>][option_id]" type="hidden" value="<%= data.option_id %>"/> - <input name="<?php echo $block->getFieldName() ?>[<%= data.id %>][sort_order]" type="hidden" value="<%= data.sort_order %>"/> + <fieldset class="fieldset-alt" id="<?php echo $block->getFieldId() ?>_<%- data.id %>"> + <input id="<?php echo $block->getFieldId() ?>_<%- data.id %>_is_delete" name="<?php echo $block->getFieldName() ?>[<%- data.id %>][is_delete]" type="hidden" value=""/> + <input id="<?php echo $block->getFieldId() ?>_<%- data.id %>_previous_type" name="<?php echo $block->getFieldName() ?>[<%- data.id %>][previous_type]" type="hidden" value="<%- data.type %>"/> + <input id="<?php echo $block->getFieldId() ?>_<%- data.id %>_previous_group" name="<?php echo $block->getFieldName() ?>[<%- data.id %>][previous_group]" type="hidden" value=""/> + <input id="<?php echo $block->getFieldId() ?>_<%- data.id %>_id" name="<?php echo $block->getFieldName() ?>[<%- data.id %>][id]" type="hidden" value="<%- data.id %>"/> + <input id="<?php echo $block->getFieldId() ?>_<%- data.id %>_option_id" name="<?php echo $block->getFieldName() ?>[<%- data.id %>][option_id]" type="hidden" value="<%- data.option_id %>"/> + <input name="<?php echo $block->getFieldName() ?>[<%- data.id %>][sort_order]" type="hidden" value="<%- data.sort_order %>"/> <div class="field field-option-title required"> - <label class="label" for="<?php echo $block->getFieldId() ?>_<%= data.id %>_title"> + <label class="label" for="<?php echo $block->getFieldId() ?>_<%- data.id %>_title"> <?php echo __('Option Title') ?> </label> <div class="control"> - <input id="<?php echo $block->getFieldId() ?>_<%= data.id %>_title" - name="<?php echo $block->getFieldName() ?>[<%= data.id %>][title]" + <input id="<?php echo $block->getFieldId() ?>_<%- data.id %>_title" + name="<?php echo $block->getFieldName() ?>[<%- data.id %>][title]" class="required-entry input-text" type="text" - value="<%= data.title %>" - data-store-label="<%= data.title %>" + value="<%- data.title %>" + data-store-label="<%- data.title %>" <% if (typeof data.scopeTitleDisabled != 'undefined' && data.scopeTitleDisabled != null) { %> disabled="disabled" <% } %> > - <%= data.checkboxScopeTitle %> + <%- data.checkboxScopeTitle %> </div> </div> <div class="field field-option-input-type required"> - <label class="label" for="<?php echo $block->getFieldId() ?>_<%= data.id %>_title"> + <label class="label" for="<?php echo $block->getFieldId() ?>_<%- data.id %>_title"> <?php echo __('Input Type') ?> </label> <div class="control opt-type"> @@ -61,7 +61,7 @@ <div class="field field-option-req"> <div class="control"> - <input id="<?php echo $block->getFieldId() ?>_<%= data.id %>_required" class="is-required" type="checkbox" checked="checked"/> + <input id="<?php echo $block->getFieldId() ?>_<%- data.id %>_required" class="is-required" type="checkbox" checked="checked"/> <label for="field-option-req"> <?php echo __('Required')?> </label> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml index dd7a8f4f0473dc958b53f0553b8788757b134aa2..106b6408c30350b931ac18c90c2474a59126b955 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/date.phtml @@ -9,7 +9,7 @@ ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Date */ ?> <script id="custom-option-date-type-template" type="text/x-magento-template"> - <div id="product_option_<%= data.option_id %>_type_<%= data.group %>" class="fieldset"> + <div id="product_option_<%- data.option_id %>_type_<%- data.group %>" class="fieldset"> <table class="data-table" cellspacing="0"> <thead> <tr class="headings"> @@ -23,21 +23,21 @@ <tr> <?php if ($block->getCanReadPrice() !== false) : ?> <td class="opt-price"> - <input id="product_option_<%= data.option_id %>_price" - name="product[options][<%= data.option_id %>][price]" + <input id="product_option_<%- data.option_id %>_price" + name="product[options][<%- data.option_id %>][price]" class="input-text validate-number product-option-price" - type="text" value="<%= data.price %>" data-store-label="<%= data.price %>" + type="text" value="<%- data.price %>" data-store-label="<%- data.price %>" <?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>> </td> - <td class="opt-price-type"><?php echo $block->getPriceTypeSelectHtml() ?><%= data.checkboxScopePrice %></td> + <td class="opt-price-type"><?php echo $block->getPriceTypeSelectHtml() ?><%- data.checkboxScopePrice %></td> <?php else : ?> - <input id="product_option_<%= data.option_id %>_price" name="product[options][<%= data.option_id %>][price]" type="hidden"> - <input id="product_option_<%= data.option_id %>_price_type" name="product[options][<%= data.option_id %>][price_type]" type="hidden"> + <input id="product_option_<%- data.option_id %>_price" name="product[options][<%- data.option_id %>][price]" type="hidden"> + <input id="product_option_<%- data.option_id %>_price_type" name="product[options][<%- data.option_id %>][price_type]" type="hidden"> <?php endif; ?> <td> - <input name="product[options][<%= data.option_id %>][sku]" class="input-text type-sku" value="<%= data.sku %>" type="text"> + <input name="product[options][<%- data.option_id %>][sku]" class="input-text type-sku" value="<%- data.sku %>" type="text"> </td> </tr> </table> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml index 5d2c7439476620eccff0aebf049a953c254c6351..0d0b729876da816ed00bf224d2c1b94068bc3725 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/file.phtml @@ -9,7 +9,7 @@ ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\File */ ?> <script id="custom-option-file-type-template" type="text/x-magento-template"> - <div id="product_option_<%= data.option_id %>_type_<%= data.group %>" class="fieldset"> + <div id="product_option_<%- data.option_id %>_type_<%- data.group %>" class="fieldset"> <table class="data-table" cellspacing="0"> <thead> <tr> @@ -25,26 +25,26 @@ <tr> <?php if ($block->getCanReadPrice() !== false) : ?> <td class="opt-price"> - <input name="product[options][<%= data.option_id %>][price]" data-store-label="<%= data.price %>" - class="input-text validate-zero-or-greater" type="text" value="<%= data.price %>" + <input name="product[options][<%- data.option_id %>][price]" data-store-label="<%- data.price %>" + class="input-text validate-zero-or-greater" type="text" value="<%- data.price %>" <?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>> </td> - <td class="opt-price-type"><?php echo $block->getPriceTypeSelectHtml() ?><%= data.checkboxScopePrice %></td> + <td class="opt-price-type"><?php echo $block->getPriceTypeSelectHtml() ?><%- data.checkboxScopePrice %></td> <?php else : ?> - <input name="product[options][<%= data.option_id %>][price]" type="hidden"> - <input id="product_option_<%= data.option_id %>_price_type" name="product[options][<%= data.option_id %>][price_type]" type="hidden"> + <input name="product[options][<%- data.option_id %>][price]" type="hidden"> + <input id="product_option_<%- data.option_id %>_price_type" name="product[options][<%- data.option_id %>][price_type]" type="hidden"> <?php endif; ?> <td> - <input name="product[options][<%= data.option_id %>][sku]" class="input-text" type="text" value="<%= data.sku %>"> + <input name="product[options][<%- data.option_id %>][sku]" class="input-text" type="text" value="<%- data.sku %>"> </td> <td> - <input name="product[options][<%= data.option_id %>][file_extension]" class="input-text" type="text" value="<%= data.file_extension %>"> + <input name="product[options][<%- data.option_id %>][file_extension]" class="input-text" type="text" value="<%- data.file_extension %>"> </td> <td class="col-file"><?php echo __('%1 <span>x</span> %2 <span>px.</span>', - '<input class="input-text" type="text" name="product[options][<%= data.option_id %>][image_size_x]" value="<%= data.image_size_x %>">', - '<input class="input-text" type="text" name="product[options][<%= data.option_id %>][image_size_y]" value="<%= data.image_size_y %>">') ?> + '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_x]" value="<%- data.image_size_x %>">', + '<input class="input-text" type="text" name="product[options][<%- data.option_id %>][image_size_y]" value="<%- data.image_size_y %>">') ?> <div class="note"><?php echo __('Please leave blank if it is not an image.') ?></div> </td> </tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml index 3be1623371d4da3bf854b53e781805da12c9618c..06552fa3a7e4d2e63aa92e1d4453638a4201cc66 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/select.phtml @@ -9,7 +9,7 @@ ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Select */ ?> <script id="custom-option-select-type-template" type="text/x-magento-template"> - <div id="product_option_<%= data.option_id %>_type_<%= data.group %>" class="fieldset"> + <div id="product_option_<%- data.option_id %>_type_<%- data.group %>" class="fieldset"> <table class="data-table"> <thead> <tr> @@ -23,11 +23,11 @@ <th class="col-actions"> </th> </tr> </thead> - <tbody id="select_option_type_row_<%= data.option_id %>"></tbody> + <tbody id="select_option_type_row_<%- data.option_id %>"></tbody> <tfoot> <tr> <td colspan="6"><?php echo $block->getAddButtonHtml() ?> - <input name="validation_<%= data.option_id %>_result" class="required-option-select-type-rows" type="hidden" value=""> + <input name="validation_<%- data.option_id %>_result" class="required-option-select-type-rows" type="hidden" value=""> </td> </tr> </tfoot> @@ -35,35 +35,35 @@ </div> </script> <script id="custom-option-select-type-row-template" type="text/x-magento-template"> - <tr id="product_option_<%= data.id %>_select_<%= data.select_id %>"> + <tr id="product_option_<%- data.id %>_select_<%- data.select_id %>"> <td class="col-draggable"> <div data-role="draggable-handle" class="draggable-handle" title="<?php echo __('Sort Custom Option'); ?>"></div> - <input name="product[options][<%= data.id %>][values][<%= data.select_id %>][sort_order]" type="hidden" value="<%= data.sort_order %>"> + <input name="product[options][<%- data.id %>][values][<%- data.select_id %>][sort_order]" type="hidden" value="<%- data.sort_order %>"> </td> <td class="col-name select-opt-title"> - <input name="product[options][<%= data.id %>][values][<%= data.select_id %>][option_type_id]" type="hidden" value="<%= data.option_type_id %>"> - <input id="product_option_<%= data.id %>_select_<%= data.select_id %>_is_delete" name="product[options][<%= data.id %>][values][<%= data.select_id %>][is_delete]" type="hidden" value=""> - <input id="product_option_<%= data.id %>_select_<%= data.select_id %>_title" <% if (typeof data.scopeTitleDisabled != 'undefined' && data.scopeTitleDisabled != null) { %> disabled="disabled" <% } %> name="product[options][<%= data.id %>][values][<%= data.select_id %>][title]" class="required-entry input-text select-type-title <% if (typeof data.scopeTitleDisabled != 'undefined' && data.scopeTitleDisabled != null) { %> disabled <% } %>" type="text" value="<%= data.title %>" data-store-label="<%= data.title %>"><%= data.checkboxScopeTitle %> + <input name="product[options][<%- data.id %>][values][<%- data.select_id %>][option_type_id]" type="hidden" value="<%- data.option_type_id %>"> + <input id="product_option_<%- data.id %>_select_<%- data.select_id %>_is_delete" name="product[options][<%- data.id %>][values][<%- data.select_id %>][is_delete]" type="hidden" value=""> + <input id="product_option_<%- data.id %>_select_<%- data.select_id %>_title" <% if (typeof data.scopeTitleDisabled != 'undefined' && data.scopeTitleDisabled != null) { %> disabled="disabled" <% } %> name="product[options][<%- data.id %>][values][<%- data.select_id %>][title]" class="required-entry input-text select-type-title <% if (typeof data.scopeTitleDisabled != 'undefined' && data.scopeTitleDisabled != null) { %> disabled <% } %>" type="text" value="<%- data.title %>" data-store-label="<%- data.title %>"><%- data.checkboxScopeTitle %> </td> <?php if ($block->getCanReadPrice() !== false) : ?> <td class="col-price select-opt-price"> - <input id="product_option_<%= data.id %>_select_<%= data.select_id %>_price" + <input id="product_option_<%- data.id %>_select_<%- data.select_id %>_price" <% if (typeof data.scopePriceDisabled != 'undefined' && data.scopePriceDisabled != null) { %> disabled="disabled" <% } %> - name="product[options][<%= data.id %>][values][<%= data.select_id %>][price]" + name="product[options][<%- data.id %>][values][<%- data.select_id %>][price]" class="input-text validate-number product-option-price" - type="text" value="<%= data.price %>" data-store-label="<%= data.price %>" + type="text" value="<%- data.price %>" data-store-label="<%- data.price %>" <?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>> </td> - <td class="col-price-type select-opt-price-type"><?php echo $block->getPriceTypeSelectHtml('<% if (typeof data.scopePriceDisabled != "undefined" && data.scopePriceDisabled != null) { %> disabled="disabled" <% } %>') ?><%= data.checkboxScopePrice %></td> + <td class="col-price-type select-opt-price-type"><?php echo $block->getPriceTypeSelectHtml('<% if (typeof data.scopePriceDisabled != "undefined" && data.scopePriceDisabled != null) { %> disabled="disabled" <% } %>') ?><%- data.checkboxScopePrice %></td> <?php else : ?> - <input id="product_option_<%= data.id %>_select_<%= data.select_id %>_price" name="product[options][<%= data.id %>][values][<%= data.select_id %>][price]" type="hidden"> - <input id="product_option_<%= data.id %>_select_<%= data.select_id %>_price_type" name="product[options][<%= data.id %>][values][<%= data.select_id %>][price_type]" type="hidden"> + <input id="product_option_<%- data.id %>_select_<%- data.select_id %>_price" name="product[options][<%- data.id %>][values][<%- data.select_id %>][price]" type="hidden"> + <input id="product_option_<%- data.id %>_select_<%- data.select_id %>_price_type" name="product[options][<%- data.id %>][values][<%- data.select_id %>][price_type]" type="hidden"> <?php endif; ?> <td class="col-sku"> - <input name="product[options][<%= data.id %>][values][<%= data.select_id %>][sku]" class="input-text" type="text" value="<%= data.sku %>"> + <input name="product[options][<%- data.id %>][values][<%- data.select_id %>][sku]" class="input-text" type="text" value="<%- data.sku %>"> </td> <td class="col-actions col-delete"> <?php echo $block->getDeleteButtonHtml() ?></td> </tr> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml index b9a5de10d1041b05748c5b614f7218561e951815..9ec2900c974880f8347bb8ee65f087ba446aa94a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options/type/text.phtml @@ -9,7 +9,7 @@ ?> <?php /** @var $block \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Type\Text */ ?> <script id="custom-option-text-type-template" type="text/x-magento-template"> - <div id="product_option_<%= data.option_id %>_type_<%= data.group %>" class="fieldset"> + <div id="product_option_<%- data.option_id %>_type_<%- data.group %>" class="fieldset"> <table class="data-table" cellspacing="0"> <thead> <tr> @@ -24,24 +24,24 @@ <tr> <?php if ($block->getCanReadPrice() !== false) : ?> <td class="opt-price"> - <input id="product_option_<%= data.option_id %>_price" - name="product[options][<%= data.option_id %>][price]" + <input id="product_option_<%- data.option_id %>_price" + name="product[options][<%- data.option_id %>][price]" class="input-text validate-number product-option-price" - type="text" value="<%= data.price %>" data-store-label="<%= data.price %>" + type="text" value="<%- data.price %>" data-store-label="<%- data.price %>" <?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled" <?php endif; ?>> </td> - <td class="opt-price-type"><?php echo $block->getPriceTypeSelectHtml() ?><%= data.checkboxScopePrice %></td> + <td class="opt-price-type"><?php echo $block->getPriceTypeSelectHtml() ?><%- data.checkboxScopePrice %></td> <?php else : ?> - <input id="product_option_<%= data.option_id %>_price" name="product[options][<%= data.option_id %>][price]" type="hidden"> - <input id="product_option_<%= data.option_id %>_price_type" name="product[options][<%= data.option_id %>][price_type]" type="hidden"> + <input id="product_option_<%- data.option_id %>_price" name="product[options][<%- data.option_id %>][price]" type="hidden"> + <input id="product_option_<%- data.option_id %>_price_type" name="product[options][<%- data.option_id %>][price_type]" type="hidden"> <?php endif; ?> <td> - <input name="product[options][<%= data.option_id %>][sku]" class="input-text" type="text" value="<%= data.sku %>"> + <input name="product[options][<%- data.option_id %>][sku]" class="input-text" type="text" value="<%- data.sku %>"> </td> <td> - <input name="product[options][<%= data.option_id %>][max_characters]" class="input-text validate-zero-or-greater" type="text" value="<%= data.max_characters %>"> + <input name="product[options][<%- data.option_id %>][max_characters]" class="input-text validate-zero-or-greater" type="text" value="<%- data.max_characters %>"> </td> </tr> </table> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml index 96a541e1ca496228436562cdcfcecac33b2cc5ce..ed0e5a71fc8a359b1e399c3ddaa9ad32bd57723d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/group.phtml @@ -53,19 +53,19 @@ require([ //<![CDATA[ var groupPriceRowTemplate = '<tr>' + '<td<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>' - + '<select class="<?php echo $_htmlClass; ?> required-entry" name="<?php echo $_htmlName; ?>[<%= data.index %>][website_id]" id="group_price_row_<%= data.index %>_website">' + + '<select class="<?php echo $_htmlClass; ?> required-entry" name="<?php echo $_htmlName; ?>[<%- data.index %>][website_id]" id="group_price_row_<%- data.index %>_website">' <?php foreach ($block->getWebsites() as $_websiteId => $_info) : ?> + '<option value="<?php echo $_websiteId; ?>"><?php echo $block->escapeJsQuote($block->escapeHtml($_info['name'])); ?><?php if (!empty($_info['currency'])) : ?> [<?php echo $block->escapeHtml($_info['currency']); ?>]<?php endif; ?></option>' <?php endforeach; ?> + '</select></td>' - + '<td><select class="<?php echo $_htmlClass; ?> custgroup required-entry" name="<?php echo $_htmlName; ?>[<%= data.index %>][cust_group]" id="group_price_row_<%= data.index %>_cust_group">' + + '<td><select class="<?php echo $_htmlClass; ?> custgroup required-entry" name="<?php echo $_htmlName; ?>[<%- data.index %>][cust_group]" id="group_price_row_<%- data.index %>_cust_group">' <?php foreach ($block->getCustomerGroups() as $_groupId => $_groupName): ?> + '<option value="<?php echo $_groupId; ?>"><?php echo $block->escapeJsQuote($block->escapeHtml($_groupName)); ?></option>' <?php endforeach; ?> + '</select></td>' - + '<td><input class="<?php echo $_htmlClass; ?> required-entry <?php echo $_priceValueValidation; ?>" type="text" name="<?php echo $_htmlName; ?>[<%= data.index %>][price]" value="<%= data.price %>" id="group_price_row_<%= data.index %>_price" /></td>' - + '<td class="col-delete"><input type="hidden" name="<?php echo $_htmlName; ?>[<%= data.index %>][delete]" class="delete" value="" id="group_price_row_<%= data.index %>_delete" />' - + '<button title="<?php echo __('Delete Group Price'); ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="group_price_row_<%= data.index %>_delete_button" onclick="return groupPriceControl.deleteItem(event);">' + + '<td><input class="<?php echo $_htmlClass; ?> required-entry <?php echo $_priceValueValidation; ?>" type="text" name="<?php echo $_htmlName; ?>[<%- data.index %>][price]" value="<%- data.price %>" id="group_price_row_<%- data.index %>_price" /></td>' + + '<td class="col-delete"><input type="hidden" name="<?php echo $_htmlName; ?>[<%- data.index %>][delete]" class="delete" value="" id="group_price_row_<%- data.index %>_delete" />' + + '<button title="<?php echo __('Delete Group Price'); ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="group_price_row_<%- data.index %>_delete_button" onclick="return groupPriceControl.deleteItem(event);">' + '<span><?php echo __('Delete'); ?></span></button></td>' + '</tr>'; diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml index faa1bcabeeb586b09c4ba59540661e889edc7541..88815c8734846f0b6406c5f0f8026c79b067dac9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/price/tier.phtml @@ -56,21 +56,21 @@ require([ //<![CDATA[ var tierPriceRowTemplate = '<tr>' + '<td class="col-websites"<?php if (!$_showWebsite): ?> style="display:none"<?php endif; ?>>' - + '<select class="<?php echo $_htmlClass ?> required-entry" name="<?php echo $_htmlName ?>[<%= data.index %>][website_id]" id="tier_price_row_<%= data.index %>_website">' + + '<select class="<?php echo $_htmlClass ?> required-entry" name="<?php echo $_htmlName ?>[<%- data.index %>][website_id]" id="tier_price_row_<%- data.index %>_website">' <?php foreach ($block->getWebsites() as $_websiteId => $_info): ?> + '<option value="<?php echo $_websiteId ?>"><?php echo $block->escapeJsQuote($block->escapeHtml($_info['name'])) ?><?php if (!empty($_info['currency'])): ?> [<?php echo $block->escapeHtml($_info['currency']) ?>]<?php endif; ?></option>' <?php endforeach ?> + '</select></td>' - + '<td class="col-customer-group"><select class="<?php echo $_htmlClass ?> custgroup required-entry" name="<?php echo $_htmlName ?>[<%= data.index %>][cust_group]" id="tier_price_row_<%= data.index %>_cust_group">' + + '<td class="col-customer-group"><select class="<?php echo $_htmlClass ?> custgroup required-entry" name="<?php echo $_htmlName ?>[<%- data.index %>][cust_group]" id="tier_price_row_<%- data.index %>_cust_group">' <?php foreach ($block->getCustomerGroups() as $_groupId => $_groupName): ?> + '<option value="<?php echo $_groupId ?>"><?php echo $block->escapeJsQuote($block->escapeHtml($_groupName)) ?></option>' <?php endforeach ?> + '</select></td>' - + '<td class="col-qty"><small class="nobr" title="<?php echo __("and above")?>"><?php echo __("and above")?></small><input class="<?php echo $_htmlClass ?> qty required-entry validate-greater-than-zero" type="text" name="<?php echo $_htmlName ?>[<%= data.index %>][price_qty]" value="<%= data.qty %>" id="tier_price_row_<%= data.index %>_qty" />' + + '<td class="col-qty"><small class="nobr" title="<?php echo __("and above")?>"><?php echo __("and above")?></small><input class="<?php echo $_htmlClass ?> qty required-entry validate-greater-than-zero" type="text" name="<?php echo $_htmlName ?>[<%- data.index %>][price_qty]" value="<%- data.qty %>" id="tier_price_row_<%- data.index %>_qty" />' + '</td>' - + '<td class="col-price"><input class="<?php echo $_htmlClass ?> required-entry <?php echo $_priceValueValidation ?>" type="text" name="<?php echo $_htmlName ?>[<%= data.index %>][price]" value="<%= data.price %>" id="tier_price_row_<%= data.index %>_price" /></td>' - + '<td class="col-delete"><input type="hidden" name="<?php echo $_htmlName ?>[<%= data.index %>][delete]" class="delete" value="" id="tier_price_row_<%= data.index %>_delete" />' - + '<button title="<?php echo __("Delete Tier") ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%= data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' + + '<td class="col-price"><input class="<?php echo $_htmlClass ?> required-entry <?php echo $_priceValueValidation ?>" type="text" name="<?php echo $_htmlName ?>[<%- data.index %>][price]" value="<%- data.price %>" id="tier_price_row_<%- data.index %>_price" /></td>' + + '<td class="col-delete"><input type="hidden" name="<?php echo $_htmlName ?>[<%- data.index %>][delete]" class="delete" value="" id="tier_price_row_<%- data.index %>_delete" />' + + '<button title="<?php echo __("Delete Tier") ?>" type="button" class="action- scalable delete icon-btn delete-product-option" id="tier_price_row_<%- data.index %>_delete_button" onclick="return tierPriceControl.deleteItem(event);">' + '<span><?php echo __("Delete") ?></span></button></td>' + '</tr>'; diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml index aa29fe4c53d2011c745de696203278e8dabf1b55..73131febf7bf9b03d9c4f79b718991d8440becce 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/helper/gallery.phtml @@ -41,12 +41,12 @@ $elementName = $block->getElement()->getName() . '[images]'; <script id="<?php echo $block->getHtmlId() ?>-template" type="text/x-magento-template"> <div class="image item <% if (data.disabled == 1) { %>hidden-for-front<% } %>" data-role="image"> - <input type="hidden" name="<?php echo $elementName ?>[<%= data.file_id %>][position]" value="<%= data.position %>" class="position"/> - <input type="hidden" name="<?php echo $elementName ?>[<%= data.file_id %>][file]" value="<%= data.file %>"/> - <input type="hidden" name="<?php echo $elementName ?>[<%= data.file_id %>][value_id]" value="<%= data.value_id %>"/> - <input type="hidden" name="<?php echo $elementName ?>[<%= data.file_id %>][label]" value="<%= data.label %>"/> - <input type="hidden" name="<?php echo $elementName ?>[<%= data.file_id %>][disabled]" value="<%= data.disabled %>"/> - <input type="hidden" name="<?php echo $elementName ?>[<%= data.file_id %>][removed]" value="" class="is-removed"/> + <input type="hidden" name="<?php echo $elementName ?>[<%- data.file_id %>][position]" value="<%- data.position %>" class="position"/> + <input type="hidden" name="<?php echo $elementName ?>[<%- data.file_id %>][file]" value="<%- data.file %>"/> + <input type="hidden" name="<?php echo $elementName ?>[<%- data.file_id %>][value_id]" value="<%- data.value_id %>"/> + <input type="hidden" name="<?php echo $elementName ?>[<%- data.file_id %>][label]" value="<%- data.label %>"/> + <input type="hidden" name="<?php echo $elementName ?>[<%- data.file_id %>][disabled]" value="<%- data.disabled %>"/> + <input type="hidden" name="<?php echo $elementName ?>[<%- data.file_id %>][removed]" value="" class="is-removed"/> <ul class="type-labels" style="display: none"> <?php foreach ($block->getImageTypes() as $typeData) { ?> @@ -57,7 +57,7 @@ $elementName = $block->getElement()->getName() . '[images]'; } ?> </ul> <img class="spacer" src="<?php echo $block->getViewFileUrl('images/spacer.gif')?>"/> - <img class="product-image" src="<%= data.url %>" alt="<%= data.label %>"/> + <img class="product-image" src="<%- data.url %>" alt="<%- data.label %>"/> <div class="actions" > <button type="button" class="action-delete" data-role="delete-button" title="<?php echo __('Delete image') ?>"> <span> <?php echo __('Delete image') ?></span > @@ -74,10 +74,10 @@ $elementName = $block->getElement()->getName() . '[images]'; <script class="dialog-template" type="text/x-magento-template" data-title="Image Options"> <div class="image-panel" data-role="dialog"> <div class="image-panel-preview"> - <img src="<%= data.url %>" alt="<%= data.label %>" /> + <img src="<%- data.url %>" alt="<%- data.label %>" /> </div> <div class="image-panel-controls"> - <strong class="image-name"><%= data.label %></strong> + <strong class="image-name"><%- data.label %></strong> <button type="button" class="action-remove" title="<?php echo __('Remove Image'); ?>"> @@ -92,7 +92,7 @@ $elementName = $block->getElement()->getName() . '[images]'; <div class="control"> <textarea id="image-description" rows="3" - name="<?php echo $elementName ?>[<%= data.file_id %>][label]"><%= data.label %></textarea> + name="<?php echo $elementName ?>[<%- data.file_id %>][label]"><%- data.label %></textarea> </div> </div> @@ -125,7 +125,7 @@ $elementName = $block->getElement()->getName() . '[images]'; <input type="checkbox" data-role="visibility-trigger" value="1" - name="<?php echo $elementName ?>[<%= data.file_id %>][disabled]" + name="<?php echo $elementName ?>[<%- data.file_id %>][disabled]" <% if (data.disabled == 1) { %>checked="checked"<% } %> /> <span><?php echo __('Hide from Product Page')?></span> </label> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml index d9cbf58fbbcd850a204b348e8b44429f16adfe7a..98dbe730e1e75657221f838fb97deedd071d2f58 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/product/edit/attribute/search.phtml @@ -25,9 +25,9 @@ <ul data-mage-init='{"menu":[]}'> <% if (data.items.length) { %> <% _.each(data.items, function(value){ %> - <li <%= data.optionData(value) %>><a href="#"><%= value.label %></a></li> + <li <%- data.optionData(value) %>><a href="#"><%- value.label %></a></li> <% }); %> - <% } else { %><span class="mage-suggest-no-records"><%= data.noRecordsText %></span><% } %> + <% } else { %><span class="mage-suggest-no-records"><%- data.noRecordsText %></span><% } %> </ul> <div class="actions"><?php echo $block->getAttributeCreate()?></div> </script> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml index aa0c404763765b2955ceaeadd231986b006bbb9b..6018b36485e8ac6be25e37475450ad5445fb500c 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml @@ -131,14 +131,12 @@ </table> </div> <?php if (!$block->isRedirectToCartEnabled()) : ?> - <script> - require([ - 'jquery', - 'domReady!', - 'Magento_Catalog/js/catalog-add-to-cart' - ], function($) { - $('[data-role=tocart-form]').catalogAddToCart(); - }); + <script type="text/x-magento-init"> + { + "[data-role=tocart-form]": { + "catalogAddToCart": {} + } + } </script> <?php endif; ?> <?php else: ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index b6a7f7a85fbc471fda1c92ba28a56d0099a6d005..742b7521914f3184c54be01918804ccab87775bc 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -133,13 +133,12 @@ $imageBlock = $block->getLayout()->createBlock('Magento\Catalog\Block\Product\I </div> <?php echo $block->getToolbarHtml() ?> <?php if (!$block->isRedirectToCartEnabled()) : ?> - <script> - require([ - 'jquery', - 'Magento_Catalog/js/catalog-add-to-cart' - ], function($) { - $('[data-role=tocart-form],.form.map.checkout').catalogAddToCart(); - }); + <script type="text/x-magento-init"> + { + "[data-role=tocart-form], .form.map.checkout": { + "catalogAddToCart": {} + } + } </script> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml index 4e02dc8aa0c72c6a89ee228b75e6d129bcf1bcee..5d78983a248ca004c08b53be5b26cddb717cc769 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/base-image.phtml @@ -90,31 +90,31 @@ $thumbHeight = $block->getVar("product_page_more_views:height") ?: $thumbWidth; <a class="gallery control next" data-role="gallery-next" href="#"></a> </script> <script data-template="gallery-base-image" type="text/x-magento-template"> - <a class="product photo<% if (typeof data.hasImg !== 'undefined') { %> placeholder<% } %>" href="<%= data.large %>"> + <a class="product photo<% if (typeof data.hasImg !== 'undefined') { %> placeholder<% } %>" href="<%- data.large %>"> <span class="img photo container"> <img data-role="zoom-image" class="photo image" itemprop="image" <% if (!data.fullSizeMode) { %> - data-large="<%= data.large %>" src="<%= data.medium %>" + data-large="<%- data.large %>" src="<%- data.medium %>" <% } else { %> - src="<%= data.large %>" + src="<%- data.large %>" <% } %> - alt="<%= data.title %>"/> + alt="<%- data.title %>"/> </span> </a> </script> <script data-template="gallery-thumbs" type="text/x-magento-template"> <% if (data.tumbsTitle) { %> - <strong class="title"><%= data.tumbsTitle %></strong> + <strong class="title"><%- data.tumbsTitle %></strong> <% } %> <ul class="items thumbs"> <% _.each(data.images, function(img, index){ %> <li class="item thumb"> - <a title="<%= img.title %>" <% if (img.selected) { %>class="active"<% } %> data-index="<%= index %>" data-role="gallery-thumb" href="#"> + <a title="<%- img.title %>" <% if (img.selected) { %>class="active"<% } %> data-index="<%- index %>" data-role="gallery-thumb" href="#"> <span class="img"> - <img alt="<%= img.title %>" src="<%= img.small %>" itemprop="image" width="<%= data.size.width %>"> + <img alt="<%- img.title %>" src="<%- img.small %>" itemprop="image" width="<%- data.size.width %>"> </span> </a> </li> @@ -127,7 +127,7 @@ $thumbHeight = $block->getVar("product_page_more_views:height") ?: $thumbWidth; </div> </script> <script data-template="zoom-enlarged-image" type="text/x-magento-template"> - <img data-role="enlarged-image" src="<%= data.img %>" /> + <img data-role="enlarged-image" src="<%- data.img %>" /> </script> <script data-template="zoom-track" type="text/x-magento-template"> <div data-role="zoom-track"></div> @@ -136,7 +136,7 @@ $thumbHeight = $block->getVar("product_page_more_views:height") ?: $thumbWidth; <div data-role="zoom-lens"></div> </script> <script data-template="notice" type="text/x-magento-template"> - <p class="notice" data-role="notice"><%= data.text %></p> + <p class="notice" data-role="notice"><%- data.text %></p> </script> <script type="text/x-magento-init"> { diff --git a/app/code/Magento/CatalogImportExport/etc/config.xml b/app/code/Magento/CatalogImportExport/etc/config.xml index cdd8b60e4ccc8765bd9f371848fb36f118660528..707ae08d9c77fe25b799ff5199b36bf69f93de61 100644 --- a/app/code/Magento/CatalogImportExport/etc/config.xml +++ b/app/code/Magento/CatalogImportExport/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <export> </export> diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php index d97ac8660c3ea9fbb16f885f5b3f665e36502c3e..8f5bdc39025cb7437b649c78ab94c1d46228dfa8 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockCollectionInterface.php @@ -22,4 +22,12 @@ interface StockCollectionInterface extends SearchResultsInterface * @return \Magento\CatalogInventory\Api\Data\StockInterface[] */ public function getItems(); + + /** + * Set items + * + * @param \Magento\CatalogInventory\Api\Data\StockInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockInterface.php index 31aa3678440faeb85e0788a651a0a56f67318197..47bd9b85cc321a7a945c15d38304b4a97bf33059 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockInterface.php @@ -62,4 +62,21 @@ interface StockInterface extends ExtensibleDataInterface * @return $this */ public function setStockName($stockName); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\CatalogInventory\Api\Data\StockExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\CatalogInventory\Api\Data\StockExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\CatalogInventory\Api\Data\StockExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php index 9052026d81fa46d84726a756b484a9ca463bba78..fad64f575cc0005a2f6b713b74564cde3dc5353e 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockItemCollectionInterface.php @@ -24,6 +24,14 @@ interface StockItemCollectionInterface extends SearchResultsInterface */ public function getItems(); + /** + * Set items + * + * @param \Magento\CatalogInventory\Api\Data\StockItemInterface[] $items + * @return $this + */ + public function setItems(array $items = null); + /** * Get search criteria. * diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockItemInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockItemInterface.php index e32c4178e5767f73b989f983446eebe1d8802a54..46163c26be6d3df33831a35e9344333ffeaef7ef 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockItemInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockItemInterface.php @@ -398,4 +398,21 @@ interface StockItemInterface extends ExtensibleDataInterface * @return $this */ public function setStockStatusChangedAuto($stockStatusChangedAuto); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php index 13e661dc22c25bfc5126b8617ff097d12b37d415..c20852455ee36de0c0ae97532556f9b1cf6d97d8 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockStatusCollectionInterface.php @@ -19,6 +19,15 @@ interface StockStatusCollectionInterface extends SearchResultsInterface */ public function getItems(); + + /** + * Sets items + * + * @param \Magento\CatalogInventory\Api\Data\StockStatusInterface[] $items + * @return $this + */ + public function setItems(array $items = null); + /** * Get search criteria. * diff --git a/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php b/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php index 7788b53df36bf73670eab34f72e0532ce5f7e400..3c90ea451776a752c578ffb0e741de06fac46f3c 100644 --- a/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php +++ b/app/code/Magento/CatalogInventory/Api/Data/StockStatusInterface.php @@ -83,4 +83,21 @@ interface StockStatusInterface extends ExtensibleDataInterface * @return \Magento\CatalogInventory\Api\Data\StockItemInterface */ public function getStockItem(); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\CatalogInventory\Api\Data\StockStatusExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\CatalogInventory\Api\Data\StockStatusExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\CatalogInventory\Api\Data\StockStatusExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php index fe76faa8934a55a6a68915f800849af506442f84..56c05595a2c4c93020ab65fe15be63086dbba902 100644 --- a/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Adminhtml/Stock/Item.php @@ -10,10 +10,11 @@ use Magento\CatalogInventory\Api\StockItemRepositoryInterface as StockItemReposi use Magento\CatalogInventory\Api\StockRegistryInterface; use Magento\Customer\Api\GroupManagementInterface; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Api\MetadataServiceInterface; +use Magento\Framework\Api\ExtensionAttributesFactory; /** * Catalog Inventory Stock Model for adminhtml area + * @method \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface getExtensionAttributes() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Item extends \Magento\CatalogInventory\Model\Stock\Item @@ -26,7 +27,7 @@ class Item extends \Magento\CatalogInventory\Model\Stock\Item /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param MetadataServiceInterface $metadataService + * @param ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Store\Model\StoreManagerInterface $storeManager @@ -42,7 +43,7 @@ class Item extends \Magento\CatalogInventory\Model\Stock\Item public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - MetadataServiceInterface $metadataService, + ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -57,7 +58,7 @@ class Item extends \Magento\CatalogInventory\Model\Stock\Item parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $customerSession, $storeManager, diff --git a/app/code/Magento/CatalogInventory/Model/Stock.php b/app/code/Magento/CatalogInventory/Model/Stock.php index 8ba03fa36a0727b8b52d13384e62d09f89d9af6e..1eed06294edaf05139695e5048ba6725e91de515 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Stock.php @@ -10,6 +10,7 @@ use Magento\Framework\Model\AbstractExtensibleModel; /** * Class Stock + * */ class Stock extends AbstractExtensibleModel implements StockInterface { @@ -119,5 +120,27 @@ class Stock extends AbstractExtensibleModel implements StockInterface { return $this->setData(self::STOCK_NAME, $stockName); } + + /** + * {@inheritdoc} + * + * @return \Magento\CatalogInventory\Api\Data\StockExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\CatalogInventory\Api\Data\StockExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\CatalogInventory\Api\Data\StockExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Stock/Item.php index 322eb0812d8f88cd4e348afecb48494fb78a9921..cb622e904c6bbab1838275d66a5f9129e6640a24 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Item.php @@ -11,7 +11,7 @@ use Magento\CatalogInventory\Api\StockConfigurationInterface as StockConfigurati use Magento\CatalogInventory\Api\StockItemRepositoryInterface as StockItemRepositoryInterface; use Magento\CatalogInventory\Api\StockRegistryInterface; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Api\MetadataServiceInterface; +use Magento\Framework\Api\ExtensionAttributesFactory; use Magento\Framework\Model\AbstractExtensibleModel; /** @@ -92,7 +92,7 @@ class Item extends AbstractExtensibleModel implements StockItemInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param MetadataServiceInterface $metadataService + * @param ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Store\Model\StoreManagerInterface $storeManager @@ -107,7 +107,7 @@ class Item extends AbstractExtensibleModel implements StockItemInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - MetadataServiceInterface $metadataService, + ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -121,7 +121,7 @@ class Item extends AbstractExtensibleModel implements StockItemInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -807,5 +807,27 @@ class Item extends AbstractExtensibleModel implements StockItemInterface { return $this->setData(self::STOCK_STATUS_CHANGED_AUTO, $stockStatusChangedAuto); } + + /** + * {@inheritdoc} + * + * @return \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\CatalogInventory\Api\Data\StockItemExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php index a930ab4169d2f86f50f3e9429b6eabaa95da4eec..4b91ba19d267e8dea109408f44978215d7c3f29c 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php @@ -9,7 +9,7 @@ use Magento\CatalogInventory\Api\Data\StockItemInterface; use Magento\CatalogInventory\Api\Data\StockStatusInterface; use Magento\CatalogInventory\Api\StockRegistryInterface; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Api\MetadataServiceInterface; +use Magento\Framework\Api\ExtensionAttributesFactory; use Magento\Framework\Model\AbstractExtensibleModel; /** @@ -38,7 +38,7 @@ class Status extends AbstractExtensibleModel implements StockStatusInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param MetadataServiceInterface $metadataService + * @param ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param StockRegistryInterface $stockRegistry * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -48,7 +48,7 @@ class Status extends AbstractExtensibleModel implements StockStatusInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - MetadataServiceInterface $metadataService, + ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, StockRegistryInterface $stockRegistry, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -58,7 +58,7 @@ class Status extends AbstractExtensibleModel implements StockStatusInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -172,5 +172,27 @@ class Status extends AbstractExtensibleModel implements StockStatusInterface { return $this->setData(self::KEY_STOCK_STATUS, $stockStatus); } + + /** + * {@inheritdoc} + * + * @return \Magento\CatalogInventory\Api\Data\StockStatusExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\CatalogInventory\Api\Data\StockStatusExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\CatalogInventory\Api\Data\StockStatusExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/CatalogInventory/etc/config.xml b/app/code/Magento/CatalogInventory/etc/config.xml index 3b19e058fe0001cd78538f82d540785941484aef..52c6f7ce2f7b2e11a2cff2c3bd2f3e066e916835 100644 --- a/app/code/Magento/CatalogInventory/etc/config.xml +++ b/app/code/Magento/CatalogInventory/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <cataloginventory> <options> diff --git a/app/code/Magento/CatalogInventory/etc/webapi.xml b/app/code/Magento/CatalogInventory/etc/webapi.xml index 238794f1796574fe5b3633880c7083eb0f32e8d0..80317eccf51a7dd8ba3e7d24fe0497cef61e9df2 100644 --- a/app/code/Magento/CatalogInventory/etc/webapi.xml +++ b/app/code/Magento/CatalogInventory/etc/webapi.xml @@ -7,25 +7,25 @@ --> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> - <route url="/V1/stockItem/:productSku" method="GET"> + <route url="/V1/stockItems/:productSku" method="GET"> <service class="Magento\CatalogInventory\Api\StockRegistryInterface" method="getStockItemBySku"/> <resources> <resource ref="Magento_CatalogInventory::cataloginventory"/> </resources> </route> - <route url="/V1/stockItem/:productSku" method="PUT"> + <route url="/V1/stockItems/:productSku" method="PUT"> <service class="Magento\CatalogInventory\Api\StockRegistryInterface" method="updateStockItemBySku"/> <resources> <resource ref="Magento_CatalogInventory::cataloginventory"/> </resources> </route> - <route url="/V1/stockItem/lowStock/" method="GET"> + <route url="/V1/stockItems/lowStock/" method="GET"> <service class="Magento\CatalogInventory\Api\StockRegistryInterface" method="getLowStockItems"/> <resources> <resource ref="Magento_CatalogInventory::cataloginventory"/> </resources> </route> - <route url="/V1/stockStatus/:productSku" method="GET"> + <route url="/V1/stockStatuses/:productSku" method="GET"> <service class="Magento\CatalogInventory\Api\StockRegistryInterface" method="getStockStatusBySku"/> <resources> <resource ref="anonymous"/> diff --git a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php index cf52ebbe0669ae45c8ec130f440f557b22865427..a4d8b53934937cd2342f00bfd5505f6d59953ecc 100644 --- a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php +++ b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php @@ -16,12 +16,23 @@ abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInt */ protected $indexBuilder; + /** + * Application Event Dispatcher + * + * @var \Magento\Framework\Event\ManagerInterface + */ + protected $_eventManager; + /** * @param IndexBuilder $indexBuilder + * @param \Magento\Framework\Event\ManagerInterface $eventManager */ - public function __construct(IndexBuilder $indexBuilder) - { + public function __construct( + IndexBuilder $indexBuilder, + \Magento\Framework\Event\ManagerInterface $eventManager + ) { $this->indexBuilder = $indexBuilder; + $this->_eventManager = $eventManager; } /** @@ -43,6 +54,20 @@ abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInt public function executeFull() { $this->indexBuilder->reindexFull(); + $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]); + } + + /** + * Get affected cache tags + * + * @return array + */ + public function getIdentities() + { + return [ + \Magento\Catalog\Model\Category::CACHE_TAG, + \Magento\Catalog\Model\Product::CACHE_TAG + ]; } /** diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index 61eac7c2b59f204a98ee782994d04eed6e97bfbf..99eb4752f691cb88006c3cd108782aa53600e991 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -143,6 +143,11 @@ class Rule extends \Magento\Rule\Model\AbstractModel */ protected $dateTime; + /** + * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor; + */ + protected $_ruleProductProcessor; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry @@ -158,6 +163,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\CatalogRule\Helper\Data $catalogRuleData * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypesList * @param \Magento\Framework\Stdlib\DateTime $dateTime + * @param \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor $ruleProductProcessor * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $relatedCacheTypes @@ -179,6 +185,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\CatalogRule\Helper\Data $catalogRuleData, \Magento\Framework\App\Cache\TypeListInterface $cacheTypesList, \Magento\Framework\Stdlib\DateTime $dateTime, + \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor $ruleProductProcessor, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = [], @@ -195,6 +202,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel $this->_cacheTypesList = $cacheTypesList; $this->_relatedCacheTypes = $relatedCacheTypes; $this->dateTime = $dateTime; + $this->_ruleProductProcessor = $ruleProductProcessor; parent::__construct($context, $registry, $formFactory, $localeDate, $resource, $resourceCollection, $data); } @@ -445,4 +453,33 @@ class Rule extends \Magento\Rule\Model\AbstractModel } return $this; } + + /** + * {@inheritdoc} + * + * @return $this + */ + public function afterSave() + { + if ($this->isObjectNew()) { + $this->getMatchingProductIds(); + if (!empty($this->_productIds) && is_array($this->_productIds)) { + $this->_ruleProductProcessor->reindexList($this->_productIds); + } + } else { + $this->_ruleProductProcessor->getIndexer()->invalidate(); + } + return parent::afterSave(); + } + + /** + * {@inheritdoc} + * + * @return $this + */ + public function afterDelete() + { + $this->_ruleProductProcessor->getIndexer()->invalidate(); + return parent::afterDelete(); + } } diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/AbstractIndexerTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/AbstractIndexerTest.php index 526ea7786417882ee711161a4021d27b66fcf7e7..b9a21020e4120a7218a7af66fc9ba0d833a2ebc8 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/AbstractIndexerTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/AbstractIndexerTest.php @@ -18,16 +18,35 @@ class AbstractIndexerTest extends \PHPUnit_Framework_TestCase */ protected $indexer; + /** + * @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_eventManagerMock; + + /** + * Set up test + * + * @return void + */ protected function setUp() { + $this->_eventManagerMock = $this->getMock('\Magento\Framework\Event\ManagerInterface'); $this->indexBuilder = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false); $this->indexer = $this->getMockForAbstractClass( 'Magento\CatalogRule\Model\Indexer\AbstractIndexer', - [$this->indexBuilder] + [ + $this->indexBuilder, + $this->_eventManagerMock + ] ); } + /** + * Test execute + * + * @return void + */ public function testExecute() { $ids = [1, 2, 5]; @@ -36,9 +55,20 @@ class AbstractIndexerTest extends \PHPUnit_Framework_TestCase $this->indexer->execute($ids); } + /** + * Test execute full reindex action + * + * @return void + */ public function testExecuteFull() { $this->indexBuilder->expects($this->once())->method('reindexFull'); + $this->_eventManagerMock->expects($this->once()) + ->method('dispatch') + ->with( + 'clean_cache_by_tags', + ['object' => $this->indexer] + ); $this->indexer->executeFull(); } @@ -46,12 +76,19 @@ class AbstractIndexerTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Magento\CatalogRule\CatalogRuleException * @expectedExceptionMessage Could not rebuild index for empty products array + * + * @return void */ public function testExecuteListWithEmptyIds() { $this->indexer->executeList([]); } + /** + * @throws \Magento\CatalogRule\CatalogRuleException + * + * @return void + */ public function testExecuteList() { $ids = [1, 2, 5]; @@ -63,12 +100,19 @@ class AbstractIndexerTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Magento\CatalogRule\CatalogRuleException * @expectedExceptionMessage Could not rebuild index for undefined product + * + * @return void */ public function testExecuteRowWithEmptyId() { $this->indexer->executeRow(null); } + /** + * @throws \Magento\CatalogRule\CatalogRuleException + * + * @return void + */ public function testExecuteRow() { $id = 5; diff --git a/app/code/Magento/CatalogRule/Test/Unit/Model/RuleTest.php b/app/code/Magento/CatalogRule/Test/Unit/Model/RuleTest.php index 095ca9891a7405407df9b759950721b4d2676d40..4b3d8d2edd1875f00b0244b31f82a2796e6bc60e 100644 --- a/app/code/Magento/CatalogRule/Test/Unit/Model/RuleTest.php +++ b/app/code/Magento/CatalogRule/Test/Unit/Model/RuleTest.php @@ -31,6 +31,31 @@ class RuleTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Rule\Model\Condition\Combine|\PHPUnit_Framework_MockObject_MockObject */ protected $condition; + /** + * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_ruleProductProcessor; + + /** + * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_productCollectionFactory; + + /** + * @var \Magento\Framework\Model\Resource\Iterator|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_resourceIterator; + + /** + * @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject + */ + protected $productModel; + + /** + * Set up before test + * + * @return void + */ protected function setUp() { $this->storeManager = $this->getMock('Magento\Store\Model\StoreManagerInterface'); @@ -74,13 +99,39 @@ class RuleTest extends \PHPUnit_Framework_TestCase '', false ); + $this->_ruleProductProcessor = $this->getMock( + '\Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor', + [], + [], + '', + false + ); + + $this->_productCollectionFactory = $this->getMock( + '\Magento\Catalog\Model\Resource\Product\CollectionFactory', + ['create'], + [], + '', + false + ); + + $this->_resourceIterator = $this->getMock( + '\Magento\Framework\Model\Resource\Iterator', + ['walk'], + [], + '', + false + ); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->rule = $this->objectManagerHelper->getObject( 'Magento\CatalogRule\Model\Rule', [ 'storeManager' => $this->storeManager, - 'combineFactory' => $this->combineFactory + 'combineFactory' => $this->combineFactory, + 'ruleProductProcessor' => $this->_ruleProductProcessor, + 'productCollectionFactory' => $this->_productCollectionFactory, + 'resourceIterator' => $this->_resourceIterator, ] ); } @@ -88,6 +139,8 @@ class RuleTest extends \PHPUnit_Framework_TestCase /** * @dataProvider dataProviderCallbackValidateProduct * @param bool $validate + * + * @return void */ public function testCallbackValidateProduct($validate) { @@ -134,6 +187,11 @@ class RuleTest extends \PHPUnit_Framework_TestCase } } + /** + * Data provider for callbackValidateProduct test + * + * @return array + */ public function dataProviderCallbackValidateProduct() { return [ @@ -141,4 +199,31 @@ class RuleTest extends \PHPUnit_Framework_TestCase [true], ]; } + + /** + * Test after delete action + * + * @return void + */ + public function testAfterDelete() + { + $indexer = $this->getMock('\Magento\Indexer\Model\IndexerInterface'); + $indexer->expects($this->once())->method('invalidate'); + $this->_ruleProductProcessor->expects($this->once())->method('getIndexer')->will($this->returnValue($indexer)); + $this->rule->afterDelete(); + } + + /** + * Test after update action + * + * @return void + */ + public function testAfterUpdate() + { + $this->rule->isObjectNew(false); + $indexer = $this->getMock('\Magento\Indexer\Model\IndexerInterface'); + $indexer->expects($this->once())->method('invalidate'); + $this->_ruleProductProcessor->expects($this->once())->method('getIndexer')->will($this->returnValue($indexer)); + $this->rule->afterSave(); + } } diff --git a/app/code/Magento/CatalogSearch/etc/config.xml b/app/code/Magento/CatalogSearch/etc/config.xml index e6812e9c2629a7555da67222270e2f16db705ce1..a29db223f42df34564539bff7af30620bee812c4 100644 --- a/app/code/Magento/CatalogSearch/etc/config.xml +++ b/app/code/Magento/CatalogSearch/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <catalog> <seo> diff --git a/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml b/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml index 8aa580b0ef888b5b82d90e1909cd79139cb89f29..5f4367132ae9b7dd9ce2095e035c01302234fe3c 100644 --- a/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml +++ b/app/code/Magento/CatalogSearch/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="catalogsearch_advanced_index" label="Advanced Search Form"/> <type id="catalogsearch_advanced_result" label="Advanced Search Result"/> <type id="catalogsearch_result_index" label="Quick Search Form"/> diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php index f4e65e37189f0e21b5260ad0ff006e919ba390ab..1e71af266597a15bc4d580dffff8afb86ccf4e26 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/CanonicalUrlRewriteGenerator.php @@ -8,26 +8,26 @@ namespace Magento\CatalogUrlRewrite\Model\Category; use Magento\Catalog\Model\Category; use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator; use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; class CanonicalUrlRewriteGenerator { /** @var \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator */ protected $categoryUrlPathGenerator; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory */ + protected $urlRewriteFactory; /** * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator - * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder $urlRewriteBuilder + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory $urlRewriteFactory */ public function __construct( CategoryUrlPathGenerator $categoryUrlPathGenerator, - UrlRewriteBuilder $urlRewriteBuilder + UrlRewriteFactory $urlRewriteFactory ) { $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; - $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlRewriteFactory = $urlRewriteFactory; } /** @@ -39,13 +39,14 @@ class CanonicalUrlRewriteGenerator */ public function generate($storeId, Category $category) { - return [ - $this->urlRewriteBuilder->setStoreId($storeId) + $urlPath = $this->categoryUrlPathGenerator->getUrlPathWithSuffix($category, $storeId); + $result = [ + $urlPath . '_' . $storeId => $this->urlRewriteFactory->create()->setStoreId($storeId) ->setEntityType(CategoryUrlRewriteGenerator::ENTITY_TYPE) ->setEntityId($category->getId()) - ->setRequestPath($this->categoryUrlPathGenerator->getUrlPathWithSuffix($category, $storeId)) + ->setRequestPath($urlPath) ->setTargetPath($this->categoryUrlPathGenerator->getCanonicalUrlPath($category)) - ->create() ]; + return $result; } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php index f4f81c95acee54853ccfd571d1bc991069292fee..6f0cfdb2b5ccd65a3de26d869daab89465728498 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/CurrentUrlRewritesRegenerator.php @@ -11,15 +11,15 @@ use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; use Magento\UrlRewrite\Model\OptionProvider; use Magento\UrlRewrite\Model\UrlFinderInterface; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; class CurrentUrlRewritesRegenerator { /** @var \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator */ protected $categoryUrlPathGenerator; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory */ + protected $urlRewriteFactory; /** @var UrlFinderInterface */ protected $urlFinder; @@ -29,16 +29,16 @@ class CurrentUrlRewritesRegenerator /** * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator - * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder $urlRewriteBuilder + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory $urlRewriteFactory * @param UrlFinderInterface $urlFinder */ public function __construct( CategoryUrlPathGenerator $categoryUrlPathGenerator, - UrlRewriteBuilder $urlRewriteBuilder, + UrlRewriteFactory $urlRewriteFactory, UrlFinderInterface $urlFinder ) { $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; - $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlRewriteFactory = $urlRewriteFactory; $this->urlFinder = $urlFinder; } @@ -83,15 +83,14 @@ class CurrentUrlRewritesRegenerator if ($this->category->getData('save_rewrites_history')) { $targetPath = $this->categoryUrlPathGenerator->getUrlPathWithSuffix($this->category, $storeId); if ($url->getRequestPath() !== $targetPath) { - $urls[] = $this->urlRewriteBuilder + $urls[$url->getRequestPath() . '_' . $storeId] = $this->urlRewriteFactory->create() ->setEntityType(CategoryUrlRewriteGenerator::ENTITY_TYPE) ->setEntityId($this->category->getId()) ->setRequestPath($url->getRequestPath()) ->setTargetPath($targetPath) ->setRedirectType(OptionProvider::PERMANENT) ->setStoreId($storeId) - ->setIsAutogenerated(0) - ->create(); + ->setIsAutogenerated(0); } } return $urls; @@ -109,7 +108,7 @@ class CurrentUrlRewritesRegenerator ? $url->getTargetPath() : $this->categoryUrlPathGenerator->getUrlPathWithSuffix($this->category, $storeId); if ($url->getRequestPath() !== $targetPath) { - $urls[] = $this->urlRewriteBuilder + $urls[$url->getRequestPath() . '_' . $storeId] = $this->urlRewriteFactory->create() ->setEntityType(CategoryUrlRewriteGenerator::ENTITY_TYPE) ->setEntityId($this->category->getId()) ->setRequestPath($url->getRequestPath()) @@ -118,8 +117,7 @@ class CurrentUrlRewritesRegenerator ->setStoreId($storeId) ->setDescription($url->getDescription()) ->setIsAutogenerated(0) - ->setMetadata($url->getMetadata()) - ->create(); + ->setMetadata($url->getMetadata()); } return $urls; } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php index cea457ef62b3c129f3958f3c1db06fea3e3065b1..ba76c1451c50802f5d85ab19e880a69bec77eb4f 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php @@ -9,24 +9,24 @@ use Magento\Catalog\Model\Product; use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator; use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; class CanonicalUrlRewriteGenerator { /** @var ProductUrlPathGenerator */ protected $productUrlPathGenerator; - /** @var UrlRewriteBuilder */ - protected $urlRewriteBuilder; + /** @var UrlRewriteFactory */ + protected $urlRewriteFactory; /** * @param ProductUrlPathGenerator $productUrlPathGenerator - * @param UrlRewriteBuilder $urlRewriteBuilder + * @param UrlRewriteFactory $urlRewriteFactory */ - public function __construct(ProductUrlPathGenerator $productUrlPathGenerator, UrlRewriteBuilder $urlRewriteBuilder) + public function __construct(ProductUrlPathGenerator $productUrlPathGenerator, UrlRewriteFactory $urlRewriteFactory) { $this->productUrlPathGenerator = $productUrlPathGenerator; - $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlRewriteFactory = $urlRewriteFactory; } /** @@ -39,13 +39,12 @@ class CanonicalUrlRewriteGenerator public function generate($storeId, Product $product) { return [ - $this->urlRewriteBuilder + $this->urlRewriteFactory->create() ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) ->setEntityId($product->getId()) ->setRequestPath($this->productUrlPathGenerator->getUrlPathWithSuffix($product, $storeId)) ->setTargetPath($this->productUrlPathGenerator->getCanonicalUrlPath($product)) ->setStoreId($storeId) - ->create() ]; } } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php index cd0296aca6580fb03dd08e80c1c15e37a9e0fba9..872c94b1c4bc96384fda494525aacc27be005dbf 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php @@ -10,24 +10,24 @@ use Magento\CatalogUrlRewrite\Model\ObjectRegistry; use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator; use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; class CategoriesUrlRewriteGenerator { /** @var ProductUrlPathGenerator */ protected $productUrlPathGenerator; - /** @var UrlRewriteBuilder */ - protected $urlRewriteBuilder; + /** @var UrlRewriteFactory */ + protected $urlRewriteFactory; /** * @param ProductUrlPathGenerator $productUrlPathGenerator - * @param UrlRewriteBuilder $urlRewriteBuilder + * @param UrlRewriteFactory $urlRewriteFactory */ - public function __construct(ProductUrlPathGenerator $productUrlPathGenerator, UrlRewriteBuilder $urlRewriteBuilder) + public function __construct(ProductUrlPathGenerator $productUrlPathGenerator, UrlRewriteFactory $urlRewriteFactory) { $this->productUrlPathGenerator = $productUrlPathGenerator; - $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlRewriteFactory = $urlRewriteFactory; } /** @@ -42,14 +42,13 @@ class CategoriesUrlRewriteGenerator { $urls = []; foreach ($productCategories->getList() as $category) { - $urls[] = $this->urlRewriteBuilder + $urls[] = $this->urlRewriteFactory->create() ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) ->setEntityId($product->getId()) ->setRequestPath($this->productUrlPathGenerator->getUrlPathWithSuffix($product, $storeId, $category)) ->setTargetPath($this->productUrlPathGenerator->getCanonicalUrlPath($product, $category)) ->setStoreId($storeId) - ->setMetadata(['category_id' => $category->getId()]) - ->create(); + ->setMetadata(['category_id' => $category->getId()]); } return $urls; } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php index 1e6fac93ed6fdb3b16c89fd2b09980300518bbdb..bc62a07c63a3c8a485bb4fd4ad57e98e51f8fd78 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php @@ -13,7 +13,7 @@ use Magento\CatalogUrlRewrite\Model\ObjectRegistry; use Magento\UrlRewrite\Model\UrlFinderInterface; use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; use Magento\Store\Model\StoreManagerInterface; /** @@ -33,22 +33,22 @@ class CurrentUrlRewritesRegenerator /** @var ProductUrlPathGenerator */ protected $productUrlPathGenerator; - /** @var UrlRewriteBuilder */ - protected $urlRewriteBuilder; + /** @var UrlRewriteFactory */ + protected $urlRewriteFactory; /** * @param UrlFinderInterface $urlFinder * @param ProductUrlPathGenerator $productUrlPathGenerator - * @param UrlRewriteBuilder $urlRewriteBuilder + * @param UrlRewriteFactory $urlRewriteFactory */ public function __construct( UrlFinderInterface $urlFinder, ProductUrlPathGenerator $productUrlPathGenerator, - UrlRewriteBuilder $urlRewriteBuilder + UrlRewriteFactory $urlRewriteFactory ) { $this->urlFinder = $urlFinder; $this->productUrlPathGenerator = $productUrlPathGenerator; - $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlRewriteFactory = $urlRewriteFactory; } /** @@ -105,7 +105,7 @@ class CurrentUrlRewritesRegenerator return []; } return [ - $this->urlRewriteBuilder + $this->urlRewriteFactory->create() ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) ->setEntityId($this->product->getId()) ->setRequestPath($url->getRequestPath()) @@ -115,7 +115,6 @@ class CurrentUrlRewritesRegenerator ->setDescription($url->getDescription()) ->setIsAutogenerated(0) ->setMetadata($url->getMetadata()) - ->create() ]; } @@ -134,7 +133,7 @@ class CurrentUrlRewritesRegenerator return []; } return [ - $this->urlRewriteBuilder + $this->urlRewriteFactory->create() ->setEntityType(ProductUrlRewriteGenerator::ENTITY_TYPE) ->setEntityId($this->product->getId()) ->setRequestPath($url->getRequestPath()) @@ -144,7 +143,6 @@ class CurrentUrlRewritesRegenerator ->setDescription($url->getDescription()) ->setIsAutogenerated(0) ->setMetadata($url->getMetadata()) - ->create() ]; } diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php index a8661bfdc9eaa358ead6ad52b74989d4bf705794..74158ce4093d3be02799dba710e235bbbc305095 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductUrlRewriteGenerator.php @@ -137,13 +137,22 @@ class ProductUrlRewriteGenerator } } $this->productCategories = $this->objectRegistryFactory->create(['entities' => $categories]); + /** + * @var $urls \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[] + */ $urls = array_merge( $this->canonicalUrlRewriteGenerator->generate($storeId, $this->product), $this->categoriesUrlRewriteGenerator->generate($storeId, $this->product, $this->productCategories), $this->currentUrlRewritesRegenerator->generate($storeId, $this->product, $this->productCategories) ); + + /* Reduce duplicates. Last wins */ + $result = []; + foreach ($urls as $url) { + $result[$url->getTargetPath() . '-' . $url->getStoreId()] = $url; + } $this->productCategories = null; - return $urls; + return $result; } /** diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CanonicalUrlRewriteGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CanonicalUrlRewriteGeneratorTest.php index 768bfcdea8afe02a66da3093d7252a0077cd8844..80983cad9beeda486da557f9b373216fbb993c54 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CanonicalUrlRewriteGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CanonicalUrlRewriteGeneratorTest.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category; use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; @@ -19,15 +20,16 @@ class CanonicalUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject */ protected $category; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $urlRewriteFactory; /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|\PHPUnit_Framework_MockObject_MockObject */ protected $urlRewrite; protected function setUp() { - $this->urlRewriteBuilder = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder') + $this->urlRewriteFactory = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory') + ->setMethods(['create']) ->disableOriginalConstructor()->getMock(); $this->urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->disableOriginalConstructor()->getMock(); @@ -40,7 +42,7 @@ class CanonicalUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase 'Magento\CatalogUrlRewrite\Model\Category\CanonicalUrlRewriteGenerator', [ 'categoryUrlPathGenerator' => $this->categoryUrlPathGenerator, - 'urlRewriteBuilder' => $this->urlRewriteBuilder + 'urlRewriteFactory' => $this->urlRewriteFactory ] ); } @@ -57,19 +59,19 @@ class CanonicalUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($requestPath)); $this->categoryUrlPathGenerator->expects($this->any())->method('getCanonicalUrlPath') ->will($this->returnValue($targetPath)); - $this->urlRewriteBuilder->expects($this->any())->method('setStoreId')->with($storeId) + $this->urlRewrite->expects($this->any())->method('setStoreId')->with($storeId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityId')->with($categoryId) + $this->urlRewrite->expects($this->any())->method('setEntityId')->with($categoryId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityType') + $this->urlRewrite->expects($this->any())->method('setEntityType') ->with(CategoryUrlRewriteGenerator::ENTITY_TYPE)->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setRequestPath')->with($requestPath) + $this->urlRewrite->expects($this->any())->method('setRequestPath')->with($requestPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setTargetPath')->with($targetPath) + $this->urlRewrite->expects($this->any())->method('setTargetPath')->with($targetPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); + $this->urlRewriteFactory->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); $this->assertEquals( - [$this->urlRewrite], + ['category.html_store_id' => $this->urlRewrite], $this->canonicalUrlRewriteGenerator->generate($storeId, $this->category) ); } diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CurrentUrlRewritesRegeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CurrentUrlRewritesRegeneratorTest.php index 284d67132535fd70fe866f71a898a766c888fb14..4e1b56ce6eeb5c9c474b27606bda50a7c3e37456 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CurrentUrlRewritesRegeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/CurrentUrlRewritesRegeneratorTest.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category; use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; @@ -27,15 +28,16 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject */ protected $category; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $urlRewriteFactory; /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|\PHPUnit_Framework_MockObject_MockObject */ protected $urlRewrite; protected function setUp() { - $this->urlRewriteBuilder = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder') + $this->urlRewriteFactory = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory') + ->setMethods(['create']) ->disableOriginalConstructor()->getMock(); $this->urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->disableOriginalConstructor()->getMock(); @@ -55,7 +57,7 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase [ 'urlFinder' => $this->urlFinder, 'categoryUrlPathGenerator' => $this->categoryUrlPathGenerator, - 'urlRewriteBuilder' => $this->urlRewriteBuilder + 'urlRewriteFactory' => $this->urlRewriteFactory ] ); } @@ -127,7 +129,7 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase $this->prepareUrlRewriteMock($storeId, $categoryId, $requestPath, $targetPath, OptionProvider::PERMANENT); $this->assertEquals( - [$this->urlRewrite], + ['autogenerated.html_2' => $this->urlRewrite], $this->currentUrlRewritesRegenerator->generate($storeId, $this->category) ); } @@ -183,12 +185,14 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase ); $this->categoryUrlPathGenerator->expects($this->never())->method('getUrlPathWithSuffix'); $this->category->expects($this->any())->method('getId')->will($this->returnValue($categoryId)); - $this->urlRewriteBuilder->expects($this->once())->method('setDescription')->with($description) + $this->urlRewrite->expects($this->once())->method('setDescription')->with($description) ->will($this->returnSelf()); + $this->urlRewriteFactory->expects($this->once())->method('create') + ->willReturn($this->urlRewrite); $this->prepareUrlRewriteMock($storeId, $categoryId, $requestPath, $targetPath, 0); $this->assertEquals( - [$this->urlRewrite], + ['generate-for-custom-without-redirect-type.html_12' => $this->urlRewrite], $this->currentUrlRewritesRegenerator->generate($storeId, $this->category) ); } @@ -220,12 +224,14 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase $this->categoryUrlPathGenerator->expects($this->any())->method('getUrlPathWithSuffix') ->will($this->returnValue($targetPath)); $this->category->expects($this->any())->method('getId')->will($this->returnValue($categoryId)); - $this->urlRewriteBuilder->expects($this->once())->method('setDescription')->with($description) + $this->urlRewrite->expects($this->once())->method('setDescription')->with($description) ->will($this->returnSelf()); + $this->urlRewriteFactory->expects($this->once())->method('create') + ->willReturn($this->urlRewrite); $this->prepareUrlRewriteMock($storeId, $categoryId, $requestPath, $targetPath, 'code'); $this->assertEquals( - [$this->urlRewrite], + ['generate-for-custom-without-redirect-type.html_12' => $this->urlRewrite], $this->currentUrlRewritesRegenerator->generate($storeId, $this->category) ); } @@ -260,21 +266,21 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase */ protected function prepareUrlRewriteMock($storeId, $categoryId, $requestPath, $targetPath, $redirectType) { - $this->urlRewriteBuilder->expects($this->any())->method('setStoreId')->with($storeId) + $this->urlRewrite->expects($this->any())->method('setStoreId')->with($storeId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityId')->with($categoryId) + $this->urlRewrite->expects($this->any())->method('setEntityId')->with($categoryId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityType') + $this->urlRewrite->expects($this->any())->method('setEntityType') ->with(CategoryUrlRewriteGenerator::ENTITY_TYPE)->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setRequestPath')->with($requestPath) + $this->urlRewrite->expects($this->any())->method('setRequestPath')->with($requestPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setTargetPath')->with($targetPath) + $this->urlRewrite->expects($this->any())->method('setTargetPath')->with($targetPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setIsAutogenerated')->with(0) + $this->urlRewrite->expects($this->any())->method('setIsAutogenerated')->with(0) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setRedirectType')->with($redirectType) + $this->urlRewrite->expects($this->any())->method('setRedirectType')->with($redirectType) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setMetadata')->with([])->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); + $this->urlRewrite->expects($this->any())->method('setMetadata')->with([])->will($this->returnSelf()); + $this->urlRewriteFactory->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); } } diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlRewriteGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlRewriteGeneratorTest.php index 239dcffcbba3ee19b64ef4fe372e6eb1336a50a5..c435eda8c7bd345a5a0c9e700e097a8362ee28c6 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlRewriteGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlRewriteGeneratorTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\CatalogUrlRewrite\Test\Unit\Model; use Magento\Catalog\Model\Category; @@ -28,6 +31,9 @@ class CategoryUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject */ protected $category; + /** + * Test method + */ protected function setUp() { $this->currentUrlRewritesRegenerator = $this->getMockBuilder( @@ -54,39 +60,60 @@ class CategoryUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test method + */ public function testGenerationForGlobalScope() { $this->category->expects($this->any())->method('getStoreId')->will($this->returnValue(null)); $this->category->expects($this->any())->method('getStoreIds')->will($this->returnValue([1])); $this->storeViewService->expects($this->once())->method('doesEntityHaveOverriddenUrlKeyForStore') ->will($this->returnValue(false)); + $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $canonical->setTargetPath('category-1') + ->setStoreId(1); $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['canonical'])); + ->will($this->returnValue([$canonical])); + $children = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $children->setTargetPath('category-2') + ->setStoreId(2); $this->childrenUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['children'])); + ->will($this->returnValue([$children])); + $current = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $current->setTargetPath('category-3') + ->setStoreId(3); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['current'])); + ->will($this->returnValue([$current])); $this->assertEquals( - ['canonical', 'children', 'current'], + [$canonical, $children, $current], $this->categoryUrlRewriteGenerator->generate($this->category) ); } + /** + * Test method + */ public function testGenerationForSpecificStore() { $this->category->expects($this->any())->method('getStoreId')->will($this->returnValue(1)); $this->category->expects($this->never())->method('getStoreIds'); + $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $canonical->setTargetPath('category-1') + ->setStoreId(1); $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['canonical'])); + ->will($this->returnValue([$canonical])); $this->childrenUrlRewriteGenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); - $this->assertEquals(['canonical'], $this->categoryUrlRewriteGenerator->generate($this->category)); + $this->assertEquals([$canonical], $this->categoryUrlRewriteGenerator->generate($this->category)); } + /** + * Test method + */ public function testSkipGenerationForGlobalScope() { $this->category->expects($this->any())->method('getStoreIds')->will($this->returnValue([1, 2])); diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CanonicalUrlRewriteGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CanonicalUrlRewriteGeneratorTest.php index 6bf7b9b3753e41498e904f338270cec294cfaad4..eda2ea617c63a220b087f9fd0657fde94301f541 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CanonicalUrlRewriteGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CanonicalUrlRewriteGeneratorTest.php @@ -22,15 +22,16 @@ class CanonicalUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\CatalogUrlRewrite\Model\ObjectRegistry|\PHPUnit_Framework_MockObject_MockObject */ protected $categoryRegistry; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $urlRewriteFactory; /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|\PHPUnit_Framework_MockObject_MockObject */ protected $urlRewrite; protected function setUp() { - $this->urlRewriteBuilder = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder') + $this->urlRewriteFactory = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory') + ->setMethods(['create']) ->disableOriginalConstructor()->getMock(); $this->urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->disableOriginalConstructor()->getMock(); @@ -45,7 +46,7 @@ class CanonicalUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase 'Magento\CatalogUrlRewrite\Model\Product\CanonicalUrlRewriteGenerator', [ 'productUrlPathGenerator' => $this->productUrlPathGenerator, - 'urlRewriteBuilder' => $this->urlRewriteBuilder + 'urlRewriteFactory' => $this->urlRewriteFactory ] ); } @@ -64,17 +65,17 @@ class CanonicalUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($targetPath)); $this->categoryRegistry->expects($this->any())->method('getList')->will($this->returnValue([])); - $this->urlRewriteBuilder->expects($this->any())->method('setStoreId')->with($storeId) + $this->urlRewrite->expects($this->any())->method('setStoreId')->with($storeId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityId')->with($productId) + $this->urlRewrite->expects($this->any())->method('setEntityId')->with($productId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityType') + $this->urlRewrite->expects($this->any())->method('setEntityType') ->with(ProductUrlRewriteGenerator::ENTITY_TYPE)->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setRequestPath')->with($requestPath) + $this->urlRewrite->expects($this->any())->method('setRequestPath')->with($requestPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setTargetPath')->with($targetPath) + $this->urlRewrite->expects($this->any())->method('setTargetPath')->with($targetPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); + $this->urlRewriteFactory->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); $this->assertEquals( [ $this->urlRewrite, diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CategoriesUrlRewriteGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CategoriesUrlRewriteGeneratorTest.php index 04597a4e37b792d43652d0f1bda0c53d8e509ded..b72f47d04d06468e71b905d60b320ccfc0daac79 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CategoriesUrlRewriteGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CategoriesUrlRewriteGeneratorTest.php @@ -23,15 +23,16 @@ class CategoriesUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\CatalogUrlRewrite\Model\ObjectRegistry|\PHPUnit_Framework_MockObject_MockObject */ protected $categoryRegistry; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $urlRewriteFactory; /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|\PHPUnit_Framework_MockObject_MockObject */ protected $urlRewrite; protected function setUp() { - $this->urlRewriteBuilder = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder') + $this->urlRewriteFactory = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory') + ->setMethods(['create']) ->disableOriginalConstructor()->getMock(); $this->urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->disableOriginalConstructor()->getMock(); @@ -46,7 +47,7 @@ class CategoriesUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase 'Magento\CatalogUrlRewrite\Model\Product\CategoriesUrlRewriteGenerator', [ 'productUrlPathGenerator' => $this->productUrlPathGenerator, - 'urlRewriteBuilder' => $this->urlRewriteBuilder + 'urlRewriteFactory' => $this->urlRewriteFactory ] ); } @@ -79,19 +80,19 @@ class CategoriesUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase $this->categoryRegistry->expects($this->any())->method('getList') ->will($this->returnValue([$category])); - $this->urlRewriteBuilder->expects($this->any())->method('setStoreId')->with($storeId) + $this->urlRewrite->expects($this->any())->method('setStoreId')->with($storeId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityId')->with($productId) + $this->urlRewrite->expects($this->any())->method('setEntityId')->with($productId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityType') + $this->urlRewrite->expects($this->any())->method('setEntityType') ->with(ProductUrlRewriteGenerator::ENTITY_TYPE)->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setRequestPath')->with($urlPathWithCategory) + $this->urlRewrite->expects($this->any())->method('setRequestPath')->with($urlPathWithCategory) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setTargetPath')->with($canonicalUrlPathWithCategory) + $this->urlRewrite->expects($this->any())->method('setTargetPath')->with($canonicalUrlPathWithCategory) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setMetadata') + $this->urlRewrite->expects($this->any())->method('setMetadata') ->with(['category_id' => $categoryId])->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); + $this->urlRewriteFactory->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); $this->assertEquals( [ diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CurrentUrlRewritesRegeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CurrentUrlRewritesRegeneratorTest.php index b40de1acbb26822fa7bb2ed7c4e1ff56c2ad7e1d..05f28533c92c05062d690aa41a5fcfd7517185d0 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CurrentUrlRewritesRegeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Product/CurrentUrlRewritesRegeneratorTest.php @@ -33,15 +33,16 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\CatalogUrlRewrite\Model\ObjectRegistry|\PHPUnit_Framework_MockObject_MockObject */ protected $objectRegistry; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $urlRewriteFactory; /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|\PHPUnit_Framework_MockObject_MockObject */ protected $urlRewrite; protected function setUp() { - $this->urlRewriteBuilder = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder') + $this->urlRewriteFactory = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory') + ->setMethods(['create']) ->disableOriginalConstructor()->getMock(); $this->urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->disableOriginalConstructor()->getMock(); @@ -65,7 +66,7 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase [ 'urlFinder' => $this->urlFinder, 'productUrlPathGenerator' => $this->productUrlPathGenerator, - 'urlRewriteBuilder' => $this->urlRewriteBuilder + 'urlRewriteFactory' => $this->urlRewriteFactory ] ); } @@ -296,24 +297,24 @@ class CurrentUrlRewritesRegeneratorTest extends \PHPUnit_Framework_TestCase $metadata, $description ) { - $this->urlRewriteBuilder->expects($this->any())->method('setStoreId')->with($storeId) + $this->urlRewrite->expects($this->any())->method('setStoreId')->with($storeId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityId')->with($productId) + $this->urlRewrite->expects($this->any())->method('setEntityId')->with($productId) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setEntityType') + $this->urlRewrite->expects($this->any())->method('setEntityType') ->with(ProductUrlRewriteGenerator::ENTITY_TYPE)->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setRequestPath')->with($requestPath) + $this->urlRewrite->expects($this->any())->method('setRequestPath')->with($requestPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setTargetPath')->with($targetPath) + $this->urlRewrite->expects($this->any())->method('setTargetPath')->with($targetPath) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setIsAutogenerated')->with(0) + $this->urlRewrite->expects($this->any())->method('setIsAutogenerated')->with(0) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setRedirectType')->with($redirectType) + $this->urlRewrite->expects($this->any())->method('setRedirectType')->with($redirectType) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('setMetadata')->with($metadata) + $this->urlRewrite->expects($this->any())->method('setMetadata')->with($metadata) ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); - $this->urlRewriteBuilder->expects($this->once())->method('setDescription')->with($description) + $this->urlRewriteFactory->expects($this->any())->method('create')->will($this->returnValue($this->urlRewrite)); + $this->urlRewrite->expects($this->once())->method('setDescription')->with($description) ->will($this->returnSelf()); } } diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlRewriteGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlRewriteGeneratorTest.php index 0608f755137936d1c6b8c612f3bb97f0c55d546e..861516a338f1bc8c92f86d98815741f78ef899b5 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlRewriteGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductUrlRewriteGeneratorTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\CatalogUrlRewrite\Test\Unit\Model; use Magento\Catalog\Model\Category; @@ -37,6 +40,9 @@ class ProductUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Catalog\Model\Resource\Category\Collection|\PHPUnit_Framework_MockObject_MockObject */ protected $categoriesCollection; + /** + * Test method + */ protected function setUp() { $this->product = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); @@ -75,6 +81,9 @@ class ProductUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test method + */ public function testGenerationForGlobalScope() { $this->product->expects($this->any())->method('getStoreId')->will($this->returnValue(null)); @@ -84,19 +93,31 @@ class ProductUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase $this->categoriesCollection->expects($this->any())->method('getIterator') ->willReturn(new \ArrayIterator([])); $this->initObjectRegistryFactory([]); + $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $canonical->setTargetPath('category-1') + ->setStoreId(1); $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['canonical'])); + ->will($this->returnValue([$canonical])); + $categories = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $categories->setTargetPath('category-2') + ->setStoreId(2); $this->categoriesUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['categories'])); + ->will($this->returnValue([$categories])); + $current = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $current->setTargetPath('category-3') + ->setStoreId(3); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['current'])); + ->will($this->returnValue([$current])); $this->assertEquals( - ['canonical', 'categories', 'current'], + ['category-1-1' => $canonical, 'category-2-2' => $categories, 'category-3-3' => $current], $this->productUrlRewriteGenerator->generate($this->product) ); } + /** + * Test method + */ public function testGenerationForSpecificStore() { $this->product->expects($this->any())->method('getStoreId')->will($this->returnValue(1)); @@ -113,16 +134,22 @@ class ProductUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase $this->categoriesCollection->expects($this->any())->method('getIterator') ->willReturn(new \ArrayIterator([$category])); $this->initObjectRegistryFactory([$category]); + $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $canonical->setTargetPath('category-1') + ->setStoreId(1); $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['canonical'])); + ->will($this->returnValue([$canonical])); $this->categoriesUrlRewriteGenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); - $this->assertEquals(['canonical'], $this->productUrlRewriteGenerator->generate($this->product)); + $this->assertEquals(['category-1-1' => $canonical], $this->productUrlRewriteGenerator->generate($this->product)); } + /** + * Test method + */ public function testSkipRootCategoryForCategoriesGenerator() { $this->product->expects($this->any())->method('getStoreId')->will($this->returnValue(1)); @@ -136,16 +163,22 @@ class ProductUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase $this->categoriesCollection->expects($this->any())->method('getIterator') ->willReturn(new \ArrayIterator([$rootCategory])); $this->initObjectRegistryFactory([]); + $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $canonical->setTargetPath('category-1') + ->setStoreId(1); $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['canonical'])); + ->will($this->returnValue([$canonical])); $this->categoriesUrlRewriteGenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); - $this->assertEquals(['canonical'], $this->productUrlRewriteGenerator->generate($this->product)); + $this->assertEquals(['category-1-1' => $canonical], $this->productUrlRewriteGenerator->generate($this->product)); } + /** + * Test method + */ public function testSkipGenerationForNotStoreRootCategory() { $this->product->expects($this->any())->method('getStoreId')->will($this->returnValue(1)); @@ -159,16 +192,22 @@ class ProductUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase $this->categoriesCollection->expects($this->any())->method('getIterator') ->willReturn(new \ArrayIterator([$category])); $this->initObjectRegistryFactory([]); + $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite(); + $canonical->setTargetPath('category-1') + ->setStoreId(1); $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate') - ->will($this->returnValue(['canonical'])); + ->will($this->returnValue([$canonical])); $this->categoriesUrlRewriteGenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); - $this->assertEquals(['canonical'], $this->productUrlRewriteGenerator->generate($this->product)); + $this->assertEquals(['category-1-1' => $canonical], $this->productUrlRewriteGenerator->generate($this->product)); } + /** + * Test method + */ public function testSkipGenerationForGlobalScope() { $this->product->expects($this->any())->method('getStoreIds')->will($this->returnValue([1, 2])); diff --git a/app/code/Magento/Checkout/Block/Cart/EmptyCart.php b/app/code/Magento/Checkout/Block/Cart/EmptyCart.php new file mode 100644 index 0000000000000000000000000000000000000000..75928dc465489f8df30e1f465471ed0f5d30f0d0 --- /dev/null +++ b/app/code/Magento/Checkout/Block/Cart/EmptyCart.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Checkout\Block\Cart; + +class EmptyCart extends \Magento\Checkout\Block\Cart +{ + /** + * @param \Magento\Framework\View\Element\Template\Context $context + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Catalog\Model\Resource\Url $catalogUrlBuilder + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Framework\App\Http\Context $httpContext + * @param array $data + */ + public function __construct( + \Magento\Framework\View\Element\Template\Context $context, + \Magento\Customer\Model\Session $customerSession, + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Catalog\Model\Resource\Url $catalogUrlBuilder, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Framework\App\Http\Context $httpContext, + array $data = [] + ) { + parent::__construct( + $context, + $customerSession, + $checkoutSession, + $catalogUrlBuilder, + $cartHelper, + $httpContext, + $data + ); + $this->_isScopePrivate = false; + } +} diff --git a/app/code/Magento/Checkout/Block/Cart/ValidationMessages.php b/app/code/Magento/Checkout/Block/Cart/ValidationMessages.php new file mode 100644 index 0000000000000000000000000000000000000000..867be6583a61e8c17cdc5809dcf2d040a3c8cdfb --- /dev/null +++ b/app/code/Magento/Checkout/Block/Cart/ValidationMessages.php @@ -0,0 +1,107 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Checkout\Block\Cart; + +/** + * Shopping cart validation messages block + */ +class ValidationMessages extends \Magento\Framework\View\Element\Messages +{ + /** @var \Magento\Checkout\Helper\Cart */ + protected $cartHelper; + + /** @var \Magento\Framework\Locale\CurrencyInterface */ + protected $currency; + + /** + * @param \Magento\Framework\View\Element\Template\Context $context + * @param \Magento\Framework\Message\Factory $messageFactory + * @param \Magento\Framework\Message\CollectionFactory $collectionFactory + * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Framework\Locale\CurrencyInterface $currency + * @param array $data + */ + public function __construct( + \Magento\Framework\View\Element\Template\Context $context, + \Magento\Framework\Message\Factory $messageFactory, + \Magento\Framework\Message\CollectionFactory $collectionFactory, + \Magento\Framework\Message\ManagerInterface $messageManager, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Framework\Locale\CurrencyInterface $currency, + array $data = [] + ) { + parent::__construct( + $context, + $messageFactory, + $collectionFactory, + $messageManager, + $data + ); + $this->cartHelper = $cartHelper; + $this->currency = $currency; + $this->_isScopePrivate = true; + } + + /** + * @return $this + */ + protected function _prepareLayout() + { + if ($this->cartHelper->getItemsCount()) { + $this->validateMinimunAmount(); + $this->addQuoteMessages(); + return parent::_prepareLayout(); + } + return $this; + } + + /** + * Validate minimum amount and display notice in error + * + * @return void + */ + public function validateMinimunAmount() + { + if (!$this->cartHelper->getQuote()->validateMinimumAmount()) { + $warning = $this->_scopeConfig->getValue( + 'sales/minimum_order/description', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + if (!$warning) { + $currencyCode = $this->_storeManager->getStore()->getCurrentCurrencyCode(); + $minimumAmount = $this->currency->getCurrency($currencyCode)->toCurrency( + $this->_scopeConfig->getValue( + 'sales/minimum_order/amount', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ); + $warning = __('Minimum order amount is %1', $minimumAmount); + } + $this->messageManager->addNotice($warning); + } + } + + /** + * Add quote messages + * + * @return void + */ + public function addQuoteMessages() + { + // Compose array of messages to add + $messages = []; + /** @var \Magento\Framework\Message\MessageInterface $message */ + foreach ($this->cartHelper->getQuote()->getMessages() as $message) { + if ($message) { + // Escape HTML entities in quote message to prevent XSS + $message->setText($this->escapeHtml($message->getText())); + $messages[] = $message; + } + } + $this->messageManager->addUniqueMessages($messages); + } +} diff --git a/app/code/Magento/Checkout/Controller/Cart/Add.php b/app/code/Magento/Checkout/Controller/Cart/Add.php index d9cf864bd356fc02a1d18210cb4c451a523158da..69aa88b0b3dc81e75993c2e7fb99689b175b71a4 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Add.php +++ b/app/code/Magento/Checkout/Controller/Cart/Add.php @@ -108,8 +108,6 @@ class Add extends \Magento\Checkout\Controller\Cart $this->cart->save(); - $this->_checkoutSession->setCartWasUpdated(true); - /** * @todo remove wishlist observer processAddToCart */ diff --git a/app/code/Magento/Checkout/Controller/Cart/Addgroup.php b/app/code/Magento/Checkout/Controller/Cart/Addgroup.php index 3ee2d8c653078e84c9dd5b5beae9c844ccf4bb11..f3f8a349b6a80948ca037c6387c91c10aec3bf71 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Addgroup.php +++ b/app/code/Magento/Checkout/Controller/Cart/Addgroup.php @@ -36,7 +36,6 @@ class Addgroup extends \Magento\Checkout\Controller\Cart } } $this->cart->save(); - $this->_checkoutSession->setCartWasUpdated(true); } return $this->_goBack(); } diff --git a/app/code/Magento/Checkout/Controller/Cart/CouponPost.php b/app/code/Magento/Checkout/Controller/Cart/CouponPost.php index 92541c821e5162613938ceb03334e47cc89540fd..26225b39fa6f9732cb5562c4ffda4d28c0f7eacd 100644 --- a/app/code/Magento/Checkout/Controller/Cart/CouponPost.php +++ b/app/code/Magento/Checkout/Controller/Cart/CouponPost.php @@ -94,6 +94,7 @@ class CouponPost extends \Magento\Checkout\Controller\Cart $this->_objectManager->get('Magento\Framework\Escaper')->escapeHtml($couponCode) ) ); + $this->cart->save(); } } else { $this->messageManager->addSuccess(__('The coupon code was canceled.')); diff --git a/app/code/Magento/Checkout/Controller/Cart/EstimatePost.php b/app/code/Magento/Checkout/Controller/Cart/EstimatePost.php index 1a9f88450bf2ff1f047d518aaf80efa57513e9b5..88a1d46d971e69146a4b0f40ff2fb4fe19c3d9d3 100644 --- a/app/code/Magento/Checkout/Controller/Cart/EstimatePost.php +++ b/app/code/Magento/Checkout/Controller/Cart/EstimatePost.php @@ -68,6 +68,7 @@ class EstimatePost extends \Magento\Checkout\Controller\Cart ->setRegion($region) ->setCollectShippingRates(true); $this->quoteRepository->save($this->cart->getQuote()); + $this->cart->save(); return $this->_goBack(); } } diff --git a/app/code/Magento/Checkout/Controller/Cart/EstimateUpdatePost.php b/app/code/Magento/Checkout/Controller/Cart/EstimateUpdatePost.php index 4f873d1e10254ecbfeafbb8003dcf8f0438f2f2e..0dcd81a8e01856f4aa677f79362d4db96b732233 100644 --- a/app/code/Magento/Checkout/Controller/Cart/EstimateUpdatePost.php +++ b/app/code/Magento/Checkout/Controller/Cart/EstimateUpdatePost.php @@ -16,6 +16,7 @@ class EstimateUpdatePost extends \Magento\Checkout\Controller\Cart $code = (string)$this->getRequest()->getParam('estimate_method'); if (!empty($code)) { $this->cart->getQuote()->getShippingAddress()->setShippingMethod($code)->save(); + $this->cart->save(); } return $this->_goBack(); } diff --git a/app/code/Magento/Checkout/Controller/Cart/Index.php b/app/code/Magento/Checkout/Controller/Cart/Index.php index 46cd798d74e9d3d4a0e94692b6772c4f7e8056aa..8a29029fd18365c618a3c0f5fede9a0edfd7a0d1 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Index.php +++ b/app/code/Magento/Checkout/Controller/Cart/Index.php @@ -5,8 +5,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Checkout\Controller\Cart; class Index extends \Magento\Checkout\Controller\Cart @@ -55,63 +53,9 @@ class Index extends \Magento\Checkout\Controller\Cart */ public function execute() { - $this->_eventManager->dispatch('collect_totals_failed_items'); - if ($this->cart->getQuote()->getItemsCount()) { - $this->cart->init(); - $this->cart->save(); - - if (!$this->cart->getQuote()->validateMinimumAmount()) { - $currencyCode = $this->_objectManager->get('Magento\Store\Model\StoreManagerInterface') - ->getStore() - ->getCurrentCurrencyCode(); - $minimumAmount = $this->_objectManager->get('Magento\Framework\Locale\CurrencyInterface') - ->getCurrency($currencyCode) - ->toCurrency( - $this->_scopeConfig->getValue( - 'sales/minimum_order/amount', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ); - - $warning = $this->_scopeConfig->getValue( - 'sales/minimum_order/description', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) ? $this->_scopeConfig->getValue( - 'sales/minimum_order/description', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) : __( - 'Minimum order amount is %1', - $minimumAmount - ); - - $this->messageManager->addNotice($warning); - } - } - - // Compose array of messages to add - $messages = []; - /** @var \Magento\Framework\Message\MessageInterface $message */ - foreach ($this->cart->getQuote()->getMessages() as $message) { - if ($message) { - // Escape HTML entities in quote message to prevent XSS - $message->setText($this->_objectManager->get('Magento\Framework\Escaper')->escapeHtml($message->getText())); - $messages[] = $message; - } - } - $this->messageManager->addUniqueMessages($messages); - - /** - * if customer enteres shopping cart we should mark quote - * as modified bc he can has checkout page in another window. - */ - $this->_checkoutSession->setCartWasUpdated(true); - - \Magento\Framework\Profiler::start(__METHOD__ . 'cart_display'); - $resultPage = $this->resultPageFactory->create(); $resultPage->getLayout()->initMessages(); $resultPage->getConfig()->getTitle()->set(__('Shopping Cart')); - \Magento\Framework\Profiler::stop(__METHOD__ . 'cart_display'); return $resultPage; } } diff --git a/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php b/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php index 61be91b6a1e925178502254081decb8d0cc3112d..efb5d35dcca1e0fc8f54e20a2545187fe04a5a9c 100644 --- a/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php +++ b/app/code/Magento/Checkout/Controller/Cart/UpdateItemOptions.php @@ -54,8 +54,6 @@ class UpdateItemOptions extends \Magento\Checkout\Controller\Cart $this->cart->save(); - $this->_checkoutSession->setCartWasUpdated(true); - $this->_eventManager->dispatch( 'checkout_cart_update_item_complete', ['item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse()] diff --git a/app/code/Magento/Checkout/Controller/Cart/UpdatePost.php b/app/code/Magento/Checkout/Controller/Cart/UpdatePost.php index dc71ca01354e36206279c5a580c9a5f4be0b71c8..31d94cb623031c751834ec5e49b38259eaf820ed 100644 --- a/app/code/Magento/Checkout/Controller/Cart/UpdatePost.php +++ b/app/code/Magento/Checkout/Controller/Cart/UpdatePost.php @@ -20,7 +20,6 @@ class UpdatePost extends \Magento\Checkout\Controller\Cart { try { $this->cart->truncate()->save(); - $this->_checkoutSession->setCartWasUpdated(true); } catch (\Magento\Framework\Exception\LocalizedException $exception) { $this->messageManager->addError($exception->getMessage()); } catch (\Exception $exception) { @@ -53,7 +52,6 @@ class UpdatePost extends \Magento\Checkout\Controller\Cart $cartData = $this->cart->suggestItemsQty($cartData); $this->cart->updateItems($cartData)->save(); } - $this->_checkoutSession->setCartWasUpdated(true); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError( $this->_objectManager->get('Magento\Framework\Escaper')->escapeHtml($e->getMessage()) diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index b119b7744530a1f5f0bb15a38d6392d86e37c12f..39b276ce099f8c11dd88c748a3ed5f49d1bee05d 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -220,23 +220,19 @@ class Cart extends Object implements CartInterface } /** - * Initialize cart quote state to be able use it on cart page + * Reinitialize cart quote state * * @return $this */ - public function init() + protected function reinitializeState() { $quote = $this->getQuote()->setCheckoutMethod(''); - + $this->_checkoutSession->setCartWasUpdated(true); + // reset for multiple address checkout if ($this->_checkoutSession->getCheckoutState() !== Session::CHECKOUT_STATE_BEGIN) { $quote->removeAllAddresses()->removePayment(); $this->_checkoutSession->resetCheckout(); } - - if (!$quote->hasItems()) { - $quote->getShippingAddress()->setCollectShippingRates(false)->removeAllShippingRates(); - } - return $this; } @@ -562,6 +558,7 @@ class Cart extends Object implements CartInterface * Cart save usually called after changes with cart items. */ $this->_eventManager->dispatch('checkout_cart_save_after', ['cart' => $this]); + $this->reinitializeState(); return $this; } diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index f828cd023312f9933c72a4ae1a51ae20b67f6b02..3e746159a8dd0d041bc71f14326cb0a2fee9e810 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -585,7 +585,11 @@ class Onepage } $customer = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($customer, $customerData); + $this->dataObjectHelper->populateWithArray( + $customer, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) { // We always have $customerRequest here, otherwise we would have been kicked off the function several @@ -816,7 +820,11 @@ class Onepage $customer = $quote->getCustomer(); $customerBillingData = $billing->exportCustomerAddress(); $dataArray = $this->_objectCopyService->getDataFromFieldset('checkout_onepage_quote', 'to_customer', $quote); - $this->dataObjectHelper->populateWithArray($customer, $dataArray); + $this->dataObjectHelper->populateWithArray( + $customer, + $dataArray, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $quote->setCustomer($customer)->setCustomerId(true); $customerBillingData->setIsDefaultBilling(true); diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Cart/IndexTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Cart/IndexTest.php new file mode 100644 index 0000000000000000000000000000000000000000..43b5fb8657ded5fc413dc2aaa4f5a627d5af6183 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Cart/IndexTest.php @@ -0,0 +1,170 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Checkout\Test\Unit\Controller\Cart; + +use Magento\Checkout\Controller\Cart\Index; + +/** + * Class IndexTest + */ +class IndexTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Index + */ + protected $controller; + + /** + * @var \Magento\Checkout\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSession; + + /** + * @var \Magento\Framework\App\Request\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \Magento\Framework\App\Response\Http | \PHPUnit_Framework_MockObject_MockObject + */ + protected $response; + + /** + * @var \Magento\Quote\Model\Quote | \PHPUnit_Framework_MockObject_MockObject + */ + protected $quote; + + /** + * @var \Magento\Framework\Event\Manager | \PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + /** + * @var \Magento\Framework\Event\Manager | \PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $cart; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfig; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $messageManager; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $resultPageFactory; + + /** + * @return void + */ + public function setUp() + { + $this->request = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false); + $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); + $this->quote = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false); + $this->eventManager = $this->getMock('Magento\Framework\Event\Manager', [], [], '', false); + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + + $this->objectManagerMock = $this->getMock('Magento\Framework\ObjectManager\ObjectManager', [], [], '', false); + + $this->messageManager = $this->getMockBuilder('Magento\Framework\Message\ManagerInterface') + ->disableOriginalConstructor() + ->getMock(); + + $context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false); + $context->expects($this->once()) + ->method('getObjectManager') + ->willReturn($this->objectManagerMock); + $context->expects($this->once()) + ->method('getRequest') + ->willReturn($this->request); + $context->expects($this->once()) + ->method('getResponse') + ->willReturn($this->response); + $context->expects($this->once()) + ->method('getEventManager') + ->willReturn($this->eventManager); + $context->expects($this->once()) + ->method('getMessageManager') + ->willReturn($this->messageManager); + + $this->cart = $this->getMockBuilder('Magento\Checkout\Model\Cart') + ->disableOriginalConstructor() + ->getMock(); + $this->scopeConfig = $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface') + ->disableOriginalConstructor() + ->getMock(); + $this->resultPageFactory = $this->getMockBuilder('Magento\Framework\View\Result\PageFactory') + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->controller = $objectManagerHelper->getObject( + 'Magento\Checkout\Controller\Cart\Index', + [ + 'context' => $context, + 'checkoutSession' => $this->checkoutSession, + 'cart' => $this->cart, + 'scopeConfig' => $this->scopeConfig, + 'resultPageFactory' => $this->resultPageFactory + ] + ); + } + + /** + * @return void + */ + public function testExecuteWithMessages() + { + $layout = $this->getMockBuilder('Magento\Framework\View\Layout') + ->disableOriginalConstructor() + ->getMock(); + $layout->expects($this->once()) + ->method('initMessages'); + + $title = $this->getMockBuilder('Magento\Framework\View\Page\Title') + ->disableOriginalConstructor() + ->getMock(); + $title->expects($this->once()) + ->method('set') + ->with('Shopping Cart'); + + $config = $this->getMockBuilder('Magento\Framework\View\Page\Config') + ->disableOriginalConstructor() + ->getMock(); + $config->expects($this->once()) + ->method('getTitle') + ->willReturn($title); + + $page = $this->getMockBuilder('Magento\Framework\View\Result\Page') + ->disableOriginalConstructor() + ->getMock(); + $page->expects($this->once()) + ->method('getLayout') + ->willReturn($layout); + $page->expects($this->once()) + ->method('getConfig') + ->willReturn($config); + + $this->resultPageFactory->expects($this->once()) + ->method('create') + ->willReturn($page); + $result = $this->controller->execute(); + $this->assertInstanceOf('Magento\Framework\View\Result\Page', $result); + } +} diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php index d9cb30e55e34905336d7155b3bd75d23a40c30f5..9bf66e02a93d7b92d7f81ee1e67f6e4762c35886 100644 --- a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php @@ -144,6 +144,7 @@ class SaveBillingTest extends \PHPUnit_Framework_TestCase $this->resultJson = $this->getMockBuilder('Magento\Framework\Controller\Result\JSON') ->disableOriginalConstructor() + ->setMethods(['setData']) ->getMock(); $resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JSONFactory') ->disableOriginalConstructor() diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveShippingTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveShippingTest.php index e2cd55295d11e9c12cfd1eda8c20fe1501920319..480e9fe957d808908c970bbca413aec2cf515c06 100644 --- a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveShippingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveShippingTest.php @@ -144,6 +144,7 @@ class SaveShippingTest extends \PHPUnit_Framework_TestCase $this->resultJson = $this->getMockBuilder('Magento\Framework\Controller\Result\Json') ->disableOriginalConstructor() + ->setMethods(['setData']) ->getMock(); $resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JsonFactory') ->disableOriginalConstructor() diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 6a4b0255686f84d78b71a80df174311f155b9999..ed8f574a7005d5cf7aa498cff6670c9cf6027f40 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -6,7 +6,7 @@ "magento/module-store": "0.42.0-beta11", "magento/module-sales": "0.42.0-beta11", "magento/module-catalog-inventory": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", + "magento/module-config": "0.42.0-beta11", "magento/module-customer": "0.42.0-beta11", "magento/module-catalog": "0.42.0-beta11", "magento/module-payment": "0.42.0-beta11", diff --git a/app/code/Magento/Checkout/etc/config.xml b/app/code/Magento/Checkout/etc/config.xml index 5d709676cb3b6ceedd9b7d25109914f1900a0a8f..31f59f6d891c5af880e55ec5d2dda30c5d26ab28 100644 --- a/app/code/Magento/Checkout/etc/config.xml +++ b/app/code/Magento/Checkout/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <checkout> <options> diff --git a/app/code/Magento/Checkout/etc/frontend/page_types.xml b/app/code/Magento/Checkout/etc/frontend/page_types.xml index 10c6563f3e27306d7d44cd691fe0c359c35e7bc3..dc770ab1d1bb794e1de7d404ce9ea6a132badb4f 100644 --- a/app/code/Magento/Checkout/etc/frontend/page_types.xml +++ b/app/code/Magento/Checkout/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="checkout_cart_configure" label="Configure Cart Item (Any)"/> <type id="checkout_cart_index" label="Shopping Cart"/> <type id="checkout_onepage_failure" label="One Page Checkout Failure"/> 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 b794a949e28849ff8795677e6458ea29a2ca00dd..9b690c5b43fbd0ccee106decb8ea17b9a2d8dca5 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 @@ -9,6 +9,9 @@ <update handle="checkout_cart_item_renderers"/> <update handle="checkout_shipping_price_renderer"/> <body> + <referenceContainer name="page.messages"> + <block class="Magento\Checkout\Block\Cart\ValidationMessages" name="checkout.cart.validationmessages"/> + </referenceContainer> <referenceContainer name="content"> <block class="Magento\Checkout\Block\Cart" name="checkout.cart" template="cart.phtml"> <container name="checkout.cart.items" as="with-items"> @@ -35,7 +38,7 @@ </block> </container> <container name="checkout.cart.noitems" as="no-items"> - <block class="Magento\Checkout\Block\Cart" name="checkout.cart.empty" before="-" template="cart/noItems.phtml"/> + <block class="Magento\Checkout\Block\Cart\EmptyCart" name="checkout.cart.empty" before="-" template="cart/noItems.phtml"/> <container name="checkout.cart.empty.widget" as="checkout_cart_empty_widget" label="Empty Shopping Cart Content Before"/> </container> </block> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml index 9fe14c75f86a8eda4d403233b02c2f8c9f5cee93..b3e8bcd4d6792b189fd0df5bb7b00ad97babacc6 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -/** @var $block \Magento\Checkout\Block\Cart */ +/** @var $block \Magento\Checkout\Block\Cart\EmptyCart */ ?> <div class="cart-empty"> <?php echo $block->getChildHtml('checkout_cart_empty_widget'); ?> diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml index b2f1360d69d4f01e6f8eb88da2622fc166f52bec..7585ca9388f9034e59d9b0a3e3d17434acbb258a 100644 --- a/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml +++ b/app/code/Magento/Checkout/view/frontend/templates/cart/shipping.phtml @@ -77,7 +77,7 @@ } </script> <?php if (($_shippingRateGroups = $block->getEstimateRates())): ?> - <form id="co-shipping-method-form" action="<?php echo $block->getUrl('checkout/cart/estimateUpdatePost') ?>"> + <form id="co-shipping-method-form" action="<?php echo $block->getUrl('checkout/cart/estimateUpdatePost') ?>" method="post"> <fieldset class="fieldset rates"> <dl class="items methods"> <?php foreach ($_shippingRateGroups as $code => $_rates): ?> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js index 21b896ecf549ab69eebdc51606ab470afdfa7aa1..bdc635d337b1bd760aa82fa043ec8074b25236e1 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js @@ -234,11 +234,9 @@ define([ if (msg) { if (Array.isArray(msg)) { msg = msg.reduce(function (str, chunk) { - str += '\n' + $.mage.__(chunk); + str += '\n' + chunk; return str; }, ''); - } else { - msg = $.mage.__(msg); } $(this.options.countrySelector).trigger('change'); diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js b/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js index d8ccb7eecc89cffc5a06899d03e43795c139740d..ac833eb7df2a1ab41c4cf827fa36ccc6b4458de8 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js @@ -198,9 +198,9 @@ define([ $(this.options.countrySelector).trigger('change'); - alert($.mage.__(msg)); + alert(msg); } else { - alert($.mage.__(response.error)); + alert(response.error); } return; diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index 167d0a749699392f8baac0d29161655ee63bee2c..d48975806a79664906a1ff1ab6954f37ba23f536 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -15,8 +15,8 @@ define([ $.widget('mage.regionUpdater', { options: { regionTemplate: - '<option value="<%= data.value %>" title="<%= data.title %>" <% if (data.isSelected) { %>selected="selected"<% } %>>' + - '<%= data.title %>' + + '<option value="<%- data.value %>" title="<%- data.title %>" <% if (data.isSelected) { %>selected="selected"<% } %>>' + + '<%- data.title %>' + '</option>', isRegionRequired: true, isZipRequired: true, diff --git a/app/code/Magento/CheckoutAgreements/Model/Agreement.php b/app/code/Magento/CheckoutAgreements/Model/Agreement.php index ceca39fa477ea584e4a8531fd08c7a6baab76dc2..6f951c12d5b629bc304cb0d80933030654598d1b 100644 --- a/app/code/Magento/CheckoutAgreements/Model/Agreement.php +++ b/app/code/Magento/CheckoutAgreements/Model/Agreement.php @@ -6,9 +6,9 @@ namespace Magento\CheckoutAgreements\Model; use Magento\CheckoutAgreements\Api\Data\AgreementInterface; -use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Framework\Model\AbstractModel; -class Agreement extends AbstractExtensibleModel implements AgreementInterface +class Agreement extends AbstractModel implements AgreementInterface { /** * Allowed CSS units for height field diff --git a/app/code/Magento/CheckoutAgreements/etc/module.xml b/app/code/Magento/CheckoutAgreements/etc/module.xml index 36bad32ebf304277292947dd3b01f54704cc0b7b..249c7b190e363da6ada252358dc4e4f8f4ca3c29 100644 --- a/app/code/Magento/CheckoutAgreements/etc/module.xml +++ b/app/code/Magento/CheckoutAgreements/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_CheckoutAgreements" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/EditTest.php b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/EditTest.php index 421989782a9634fb21747e9d99828763185cfe98..3b0d1837ed3b1dd99d33f5dc0bfe2bb7a3121e4d 100644 --- a/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/EditTest.php +++ b/app/code/Magento/Cms/Test/Unit/Block/Adminhtml/Block/EditTest.php @@ -53,7 +53,7 @@ class EditTest extends \PHPUnit_Framework_TestCase 'Magento\Cms\Block\Adminhtml\Block\Edit', [ 'registry' => $this->registryMock, - 'escaper' => $this->escaperMock + 'escaper' => $this->escaperMock, ] ); } @@ -91,7 +91,7 @@ class EditTest extends \PHPUnit_Framework_TestCase { return [ 'modelBlockId NOT EMPTY' => ['modelBlockId' => 1], - 'modelBlockId IS EMPTY' => ['modelBlockId' => null] + 'modelBlockId IS EMPTY' => ['modelBlockId' => null], ]; } } diff --git a/app/code/Magento/Cms/etc/config.xml b/app/code/Magento/Cms/etc/config.xml index 159fffe75e0734b6f1186375afda5460a90d5852..5b25edb764f4d8e03ddb79a8c404d3475707c2fb 100644 --- a/app/code/Magento/Cms/etc/config.xml +++ b/app/code/Magento/Cms/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <web> <default> diff --git a/app/code/Magento/Cms/etc/frontend/page_types.xml b/app/code/Magento/Cms/etc/frontend/page_types.xml index ac2f917542bcc6bddaa28fa8de7701d5fa6b9aa1..a6284ce44454b14ce4a256d0fa0db37d49cb0999 100644 --- a/app/code/Magento/Cms/etc/frontend/page_types.xml +++ b/app/code/Magento/Cms/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="cms_index_defaultindex" label="CMS Home Default Page"/> <type id="cms_index_defaultnoroute" label="CMS No-Route Default Page"/> <type id="cms_index_index" label="CMS Home Page"/> diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index e083de84b5d1cde2788572eeca66dc552fbbb8c1..9103575c3a6b146e2e8fa1559ac1eeb91fd4625c 100644 --- a/app/code/Magento/Cms/etc/module.xml +++ b/app/code/Magento/Cms/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Cms" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> <module name="Magento_Theme"/> </sequence> diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index 64cfe877c7891b413db49bb43ae2294fc91096f6..f381b09b570eb7e51175a13144d94738d385051e 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -16,8 +16,8 @@ </span> <div class="clear"></div> <script type="text/x-magento-template" id="<?php echo $block->getHtmlId() ?>-template"> - <div id="<%= data.id %>" class="file-row"> - <span class="file-info"><%= data.name %> (<%= data.size %>)</span> + <div id="<%- data.id %>" class="file-row"> + <span class="file-info"><%- data.name %> (<%- data.size %>)</span> <div class="progressbar-container"> <div class="progressbar upload-progress" style="width: 0%;"></div> </div> diff --git a/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlRewriteGenerator.php b/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlRewriteGenerator.php index 41fd268b4dd686430c602dfb8fe65c00cfd13b76..11d78b2722eab6742c65f7c0dc27dcd9cba12c58 100644 --- a/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlRewriteGenerator.php +++ b/app/code/Magento/CmsUrlRewrite/Model/CmsPageUrlRewriteGenerator.php @@ -6,7 +6,7 @@ namespace Magento\CmsUrlRewrite\Model; use Magento\Store\Model\StoreManagerInterface; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; class CmsPageUrlRewriteGenerator { @@ -15,8 +15,8 @@ class CmsPageUrlRewriteGenerator */ const ENTITY_TYPE = 'cms-page'; - /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder */ - protected $urlRewriteBuilder; + /** @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory */ + protected $urlRewriteFactory; /** @var \Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator */ protected $cmsPageUrlPathGenerator; @@ -34,16 +34,16 @@ class CmsPageUrlRewriteGenerator protected $cmsPage; /** - * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder $urlRewriteBuilder + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory $urlRewriteFactory * @param \Magento\CmsUrlRewrite\Model\CmsPageUrlPathGenerator $cmsPageUrlPathGenerator * @param StoreManagerInterface $storeManager */ public function __construct( - UrlRewriteBuilder $urlRewriteBuilder, + UrlRewriteFactory $urlRewriteFactory, CmsPageUrlPathGenerator $cmsPageUrlPathGenerator, StoreManagerInterface $storeManager ) { - $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlRewriteFactory = $urlRewriteFactory; $this->storeManager = $storeManager; $this->cmsPageUrlPathGenerator = $cmsPageUrlPathGenerator; } @@ -104,13 +104,12 @@ class CmsPageUrlRewriteGenerator */ protected function createUrlRewrite($storeId, $redirectType = 0) { - return $this->urlRewriteBuilder->setStoreId($storeId) + return $this->urlRewriteFactory->create()->setStoreId($storeId) ->setEntityType(self::ENTITY_TYPE) ->setEntityId($this->cmsPage->getId()) ->setRequestPath($this->cmsPage->getIdentifier()) ->setTargetPath($this->cmsPageUrlPathGenerator->getCanonicalUrlPath($this->cmsPage)) ->setIsAutogenerated(1) - ->setRedirectType($redirectType) - ->create(); + ->setRedirectType($redirectType); } } diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Source/Email/TemplateTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Source/Email/TemplateTest.php index 12a6aaa4103648be57f326ea5190e834ce51e8f0..03dd7a71d0c22c9534beca8babb44334b0ce446b 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Source/Email/TemplateTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Source/Email/TemplateTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Config\Test\Unit\Model\Config\Source\Email; class TemplateTest extends \PHPUnit_Framework_TestCase @@ -23,7 +26,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase protected $_emailConfig; /** - * @var /Magento\Core\Model\Resource\Email\Template\CollectionFactory + * @var \Magento\Email\Model\Resource\Email\Template\CollectionFactory */ protected $_templatesFactory; diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php index 900ec273d690e6853f528c8a2d92e70a64c0b444..c9457d003b374eae3006746308c56aac7709e7a6 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Structure/Element/FieldTest.php @@ -5,6 +5,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Config\Test\Unit\Model\Config\Structure\Element; class FieldTest extends \PHPUnit_Framework_TestCase @@ -171,7 +174,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase public function testGetTooltipCreatesTooltipBlock() { - $this->_model->setData(['tooltip_block' => 'Magento\Core\Block\Tooltip'], 'scope'); + $this->_model->setData(['tooltip_block' => 'Magento\Config\Block\Tooltip'], 'scope'); $tooltipBlock = $this->getMock('Magento\Framework\View\Element\BlockInterface'); $tooltipBlock->expects($this->once())->method('toHtml')->will($this->returnValue('tooltip block')); $this->_blockFactoryMock->expects( @@ -179,7 +182,7 @@ class FieldTest extends \PHPUnit_Framework_TestCase )->method( 'createBlock' )->with( - 'Magento\Core\Block\Tooltip' + 'Magento\Config\Block\Tooltip' )->will( $this->returnValue($tooltipBlock) ); diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json index 34ebbca138848ab22af73c0dd1f39fb0deadcebf..9fdfc97389801480818889a96c47d96ce1b2dd11 100644 --- a/app/code/Magento/Config/composer.json +++ b/app/code/Magento/Config/composer.json @@ -4,7 +4,6 @@ "require": { "php": "~5.5.0|~5.6.0", "magento/framework": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-store": "0.42.0-beta11", "magento/module-cron": "0.42.0-beta11", "magento/module-email": "0.42.0-beta11", diff --git a/app/code/Magento/Config/i18n/de_DE.csv b/app/code/Magento/Config/i18n/de_DE.csv new file mode 100644 index 0000000000000000000000000000000000000000..0aa412938948174cc2ccbb853f05ff5f6de51522 --- /dev/null +++ b/app/code/Magento/Config/i18n/de_DE.csv @@ -0,0 +1 @@ +Configuration,Configuration diff --git a/app/code/Magento/Config/i18n/en_US.csv b/app/code/Magento/Config/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..0aa412938948174cc2ccbb853f05ff5f6de51522 --- /dev/null +++ b/app/code/Magento/Config/i18n/en_US.csv @@ -0,0 +1 @@ +Configuration,Configuration diff --git a/app/code/Magento/Config/i18n/es_ES.csv b/app/code/Magento/Config/i18n/es_ES.csv new file mode 100644 index 0000000000000000000000000000000000000000..0aa412938948174cc2ccbb853f05ff5f6de51522 --- /dev/null +++ b/app/code/Magento/Config/i18n/es_ES.csv @@ -0,0 +1 @@ +Configuration,Configuration diff --git a/app/code/Magento/Config/i18n/fr_FR.csv b/app/code/Magento/Config/i18n/fr_FR.csv new file mode 100644 index 0000000000000000000000000000000000000000..0aa412938948174cc2ccbb853f05ff5f6de51522 --- /dev/null +++ b/app/code/Magento/Config/i18n/fr_FR.csv @@ -0,0 +1 @@ +Configuration,Configuration diff --git a/app/code/Magento/Config/i18n/nl_NL.csv b/app/code/Magento/Config/i18n/nl_NL.csv new file mode 100644 index 0000000000000000000000000000000000000000..0aa412938948174cc2ccbb853f05ff5f6de51522 --- /dev/null +++ b/app/code/Magento/Config/i18n/nl_NL.csv @@ -0,0 +1 @@ +Configuration,Configuration diff --git a/app/code/Magento/Config/i18n/pt_BR.csv b/app/code/Magento/Config/i18n/pt_BR.csv new file mode 100644 index 0000000000000000000000000000000000000000..0aa412938948174cc2ccbb853f05ff5f6de51522 --- /dev/null +++ b/app/code/Magento/Config/i18n/pt_BR.csv @@ -0,0 +1 @@ +Configuration,Configuration diff --git a/app/code/Magento/Config/i18n/zh_CN.csv b/app/code/Magento/Config/i18n/zh_CN.csv new file mode 100644 index 0000000000000000000000000000000000000000..0aa412938948174cc2ccbb853f05ff5f6de51522 --- /dev/null +++ b/app/code/Magento/Config/i18n/zh_CN.csv @@ -0,0 +1 @@ +Configuration,Configuration diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml index e70c8b95364a8b66912e26bbf77bcdb4518ba14a..bda103c5bd600b6fc93c6459d922988fd8a300ef 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml @@ -46,7 +46,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1; // define row prototypeJS template template: mageTemplate( - '<tr id="<%= _id %>">' + '<tr id="<%- _id %>">' <?php foreach ($block->getColumns() as $columnName => $column): ?> + '<td>' + '<?php echo $block->renderCellTemplate($columnName)?>' @@ -54,10 +54,10 @@ $_colspan = $block->isAddAfter() ? 2 : 1; <?php endforeach; ?> <?php if ($block->isAddAfter()): ?> - + '<td><button class="action- add" type="button" id="addAfterBtn<%= _id %>"><span><?php echo __('Add after'); ?><\/span><\/button><\/td>' + + '<td><button class="action- add" type="button" id="addAfterBtn<%- _id %>"><span><?php echo __('Add after'); ?><\/span><\/button><\/td>' <?php endif; ?> - + '<td class="col-actions"><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'<%= _id %>\')" class="action- delete" type="button"><span><?php echo __('Delete'); ?><\/span><\/button><\/td>' + + '<td class="col-actions"><button onclick="arrayRow<?php echo $_htmlId ?>.del(\'<%- _id %>\')" class="action- delete" type="button"><span><?php echo __('Delete'); ?><\/span><\/button><\/td>' +'<\/tr>' ), diff --git a/app/code/Magento/ConfigurableProduct/Api/Data/OptionInterface.php b/app/code/Magento/ConfigurableProduct/Api/Data/OptionInterface.php index 8f4bbba818b2cbef6eddadca0c2a357e0a32139b..82e73fe8686e268e1b3701c216fe3bb8a2d4ee95 100644 --- a/app/code/Magento/ConfigurableProduct/Api/Data/OptionInterface.php +++ b/app/code/Magento/ConfigurableProduct/Api/Data/OptionInterface.php @@ -84,4 +84,21 @@ interface OptionInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setValues(array $values = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\ConfigurableProduct\Api\Data\OptionExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\ConfigurableProduct\Api\Data\OptionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\ConfigurableProduct\Api\Data\OptionExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/ConfigurableProduct/Api/Data/OptionValueInterface.php b/app/code/Magento/ConfigurableProduct/Api/Data/OptionValueInterface.php index b24f4702da96fd9a496c709cf2523e53b3f86840..a6838c3b72d8d31f43457ecb7c356cefc0ed82be 100644 --- a/app/code/Magento/ConfigurableProduct/Api/Data/OptionValueInterface.php +++ b/app/code/Magento/ConfigurableProduct/Api/Data/OptionValueInterface.php @@ -40,4 +40,21 @@ interface OptionValueInterface extends \Magento\Framework\Api\ExtensibleDataInte * @return $this */ public function setValueIndex($valueIndex); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\ConfigurableProduct\Api\Data\OptionValueExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\ConfigurableProduct\Api\Data\OptionValueExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\ConfigurableProduct\Api\Data\OptionValueExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/ConfigurableProduct/Api/LinkManagementInterface.php b/app/code/Magento/ConfigurableProduct/Api/LinkManagementInterface.php index 92d408658636e4e6f58de24865b406f4de1a69a6..2b62e7c3e73eb31cfaf79d42dbef93c2a6e48914 100644 --- a/app/code/Magento/ConfigurableProduct/Api/LinkManagementInterface.php +++ b/app/code/Magento/ConfigurableProduct/Api/LinkManagementInterface.php @@ -11,26 +11,26 @@ interface LinkManagementInterface /** * Get all children for Bundle product * - * @param string $productSku + * @param string $sku * @return \Magento\Catalog\Api\Data\ProductInterface[] */ - public function getChildren($productSku); + public function getChildren($sku); /** - * @param string $productSku + * @param string $sku * @param string $childSku * @return bool */ - public function addChild($productSku, $childSku); + public function addChild($sku, $childSku); /** * Remove configurable product option * - * @param string $productSku + * @param string $sku * @param string $childSku * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException * @return bool */ - public function removeChild($productSku, $childSku); + public function removeChild($sku, $childSku); } diff --git a/app/code/Magento/ConfigurableProduct/Api/OptionRepositoryInterface.php b/app/code/Magento/ConfigurableProduct/Api/OptionRepositoryInterface.php index 0c27db8c4fa4c67d4542294f2823c569e40adf38..990d8fd6dcaf8f64c36c43127a4dd8b763cdc2b1 100644 --- a/app/code/Magento/ConfigurableProduct/Api/OptionRepositoryInterface.php +++ b/app/code/Magento/ConfigurableProduct/Api/OptionRepositoryInterface.php @@ -11,23 +11,23 @@ interface OptionRepositoryInterface /** * Get option for configurable product * - * @param string $productSku - * @param int $optionId + * @param string $sku + * @param int $id * @return \Magento\ConfigurableProduct\Api\Data\OptionInterface * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException */ - public function get($productSku, $optionId); + public function get($sku, $id); /** * Get all options for configurable product * - * @param string $productSku + * @param string $sku * @return \Magento\ConfigurableProduct\Api\Data\OptionInterface[] * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException */ - public function getList($productSku); + public function getList($sku); /** * Remove option from configurable product @@ -40,23 +40,23 @@ interface OptionRepositoryInterface /** * Remove option from configurable product * - * @param string $productSku - * @param int $optionId + * @param string $sku + * @param int $id * @return bool * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException */ - public function deleteById($productSku, $optionId); + public function deleteById($sku, $id); /** * Save option * - * @param string $productSku + * @param string $sku * @param \Magento\ConfigurableProduct\Api\Data\OptionInterface $option * @return int * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \InvalidArgumentException */ - public function save($productSku, \Magento\ConfigurableProduct\Api\Data\OptionInterface $option); + public function save($sku, \Magento\ConfigurableProduct\Api\Data\OptionInterface $option); } diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index 99a287c10bc9f3918422d8b114638725cb71506f..4862ac145fbba2a2944d20d2169e19146b053d30 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -177,7 +177,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView $config = [ 'attributes' => $attributes['priceOptions'], - 'template' => str_replace('%s', '<%= data.price %>', $store->getCurrentCurrency()->getOutputFormat()), + 'template' => str_replace('%s', '<%- data.price %>', $store->getCurrentCurrency()->getOutputFormat()), 'prices' => [ 'oldPrice' => [ 'amount' => $this->_registerJsPrice($this->_convertPrice($regularPrice->getAmount()->getValue())), diff --git a/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php b/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php index 7f57b5e9b2dc7a2594bb0b17599b04d849e74623..1980a0228614bfaf192001f4cc560d1846af6a87 100644 --- a/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php +++ b/app/code/Magento/ConfigurableProduct/Model/LinkManagement.php @@ -53,10 +53,10 @@ class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementI /** * {@inheritdoc} */ - public function getChildren($productSku) + public function getChildren($sku) { /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); if ($product->getTypeId() != \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) { return []; } @@ -92,9 +92,9 @@ class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementI /** * {@inheritdoc} */ - public function addChild($productSku, $childSku) + public function addChild($sku, $childSku) { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); $child = $this->productRepository->get($childSku); $childrenIds = array_values($this->configurableType->getChildrenIds($product->getId())[0]); @@ -111,13 +111,13 @@ class LinkManagement implements \Magento\ConfigurableProduct\Api\LinkManagementI /** * {@inheritdoc} */ - public function removeChild($productSku, $childSku) + public function removeChild($sku, $childSku) { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); if ($product->getTypeId() != \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) { throw new InputException( - sprintf('Product with specified sku: %s is not a configurable product', $productSku) + sprintf('Product with specified sku: %s is not a configurable product', $sku) ); } diff --git a/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php b/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php index 6de09a43ddd59eba1fb5b46ceb00680abf08afe5..0106b5292d5c70827b0811e95d367b873cb2ad58 100644 --- a/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php +++ b/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php @@ -84,15 +84,15 @@ class OptionRepository implements \Magento\ConfigurableProduct\Api\OptionReposit /** * {@inheritdoc} */ - public function get($productSku, $optionId) + public function get($sku, $id) { - $product = $this->getProduct($productSku); + $product = $this->getProduct($sku); $collection = $this->getConfigurableAttributesCollection($product); - $collection->addFieldToFilter($collection->getResource()->getIdFieldName(), $optionId); + $collection->addFieldToFilter($collection->getResource()->getIdFieldName(), $id); /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $configurableAttribute */ $configurableAttribute = $collection->getFirstItem(); if (!$configurableAttribute->getId()) { - throw new NoSuchEntityException(sprintf('Requested option doesn\'t exist: %s', $optionId)); + throw new NoSuchEntityException(sprintf('Requested option doesn\'t exist: %s', $id)); } $prices = $configurableAttribute->getPrices(); if (is_array($prices)) { @@ -112,10 +112,10 @@ class OptionRepository implements \Magento\ConfigurableProduct\Api\OptionReposit /** * {@inheritdoc} */ - public function getList($productSku) + public function getList($sku) { $options = []; - $product = $this->getProduct($productSku); + $product = $this->getProduct($sku); foreach ($this->getConfigurableAttributesCollection($product) as $option) { $values = []; $prices = $option->getPrices(); @@ -153,12 +153,12 @@ class OptionRepository implements \Magento\ConfigurableProduct\Api\OptionReposit /** * {@inheritdoc} */ - public function deleteById($productSku, $optionId) + public function deleteById($sku, $id) { - $product = $this->getProduct($productSku); + $product = $this->getProduct($sku); $attributeCollection = $this->configurableType->getConfigurableAttributeCollection($product); /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $option */ - $option = $attributeCollection->getItemById($optionId); + $option = $attributeCollection->getItemById($id); if ($option === null) { throw new NoSuchEntityException('Requested option doesn\'t exist'); } @@ -169,13 +169,13 @@ class OptionRepository implements \Magento\ConfigurableProduct\Api\OptionReposit * {@inheritdoc} * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function save($productSku, \Magento\ConfigurableProduct\Api\Data\OptionInterface $option) + public function save($sku, \Magento\ConfigurableProduct\Api\Data\OptionInterface $option) { /** @var $configurableAttribute \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute */ $configurableAttribute = $this->configurableAttributeFactory->create(); if ($option->getId()) { /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->getProduct($productSku); + $product = $this->getProduct($sku); $configurableAttribute->load($option->getId()); if (!$configurableAttribute->getId() || $configurableAttribute->getProductId() != $product->getId()) { throw new NoSuchEntityException( @@ -199,7 +199,7 @@ class OptionRepository implements \Magento\ConfigurableProduct\Api\OptionReposit } else { $this->validateNewOptionData($option); /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); $allowedTypes = [ProductType::TYPE_SIMPLE, ProductType::TYPE_VIRTUAL, ConfigurableType::TYPE_CODE]; if (!in_array($product->getTypeId(), $allowedTypes)) { throw new \InvalidArgumentException('Incompatible product type'); @@ -240,16 +240,16 @@ class OptionRepository implements \Magento\ConfigurableProduct\Api\OptionReposit /** * Retrieve product instance by sku * - * @param string $productSku + * @param string $sku * @return \Magento\Catalog\Model\Product * @throws InputException */ - private function getProduct($productSku) + private function getProduct($sku) { - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); if (\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE !== $product->getTypeId()) { throw new InputException( - sprintf('Only implemented for configurable product: %s', $productSku) + sprintf('Only implemented for configurable product: %s', $sku) ); } return $product; diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php index d2e9954bd1cfa4fab7cb11016829042ebf36eb94..73c029fe5db46074da69204e5a48c6e90ea7959d 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php @@ -209,5 +209,27 @@ class Attribute extends \Magento\Framework\Model\AbstractExtensibleModel impleme { return $this->setData(self::KEY_VALUES, $values); } + + /** + * {@inheritdoc} + * + * @return \Magento\ConfigurableProduct\Api\Data\OptionExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\ConfigurableProduct\Api\Data\OptionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\ConfigurableProduct\Api\Data\OptionExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/OptionValue.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/OptionValue.php index 7acd37f43cab707da519717e3788d4cd4156f0ee..8a551ed9e5f362d998da7e1504c178be0a1cd88b 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/OptionValue.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/OptionValue.php @@ -9,6 +9,10 @@ namespace Magento\ConfigurableProduct\Model\Product\Type\Configurable; use Magento\ConfigurableProduct\Api\Data\OptionValueInterface; +/** + * Class OptionValue + * + */ class OptionValue extends \Magento\Framework\Model\AbstractExtensibleModel implements \Magento\ConfigurableProduct\Api\Data\OptionValueInterface { @@ -44,6 +48,7 @@ class OptionValue extends \Magento\Framework\Model\AbstractExtensibleModel imple { return $this->getData(self::KEY_VALUE_INDEX); } + /** * @param float $pricingValue * @return $this @@ -70,5 +75,27 @@ class OptionValue extends \Magento\Framework\Model\AbstractExtensibleModel imple { return $this->setData(self::KEY_VALUE_INDEX, $valueIndex); } + + /** + * {@inheritdoc} + * + * @return \Magento\ConfigurableProduct\Api\Data\OptionValueExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\ConfigurableProduct\Api\Data\OptionValueExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\ConfigurableProduct\Api\Data\OptionValueExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php index c5fcd0eed8f45f2dcd99255b7c3017e30a69fdde..7b9feeb1d1a64269354d2ca21ba3774e0f218e4b 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Validator/Plugin.php @@ -8,7 +8,6 @@ namespace Magento\ConfigurableProduct\Model\Product\Validator; use Closure; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\ProductFactory; -use Magento\Core\Helper; use Magento\Framework\App\RequestInterface; use Magento\Framework\Event\Manager; use Magento\Framework\Json\Helper\Data; diff --git a/app/code/Magento/ConfigurableProduct/Model/ProductVariationsBuilder.php b/app/code/Magento/ConfigurableProduct/Model/ProductVariationsBuilder.php index 7c67a9ed644a1d0c3f0a5dc8159756758d6454f1..2227d9c97b2cb11c42cda8d739a48ccf33ca3afa 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ProductVariationsBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Model/ProductVariationsBuilder.php @@ -9,9 +9,9 @@ namespace Magento\ConfigurableProduct\Model; class ProductVariationsBuilder { /** - * @var \Magento\Framework\Api\AttributeDataBuilder + * @var \Magento\Framework\Api\AttributeValueFactory */ - private $customAttributeBuilder; + private $customAttributeFactory; /** * @var \Magento\Catalog\Model\ProductFactory @@ -25,16 +25,16 @@ class ProductVariationsBuilder /** * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Framework\Api\AttributeDataBuilder $customAttributeBuilder + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param Product\Type\VariationMatrix $variationMatrix */ public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Framework\Api\AttributeDataBuilder $customAttributeBuilder, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\ConfigurableProduct\Model\Product\Type\VariationMatrix $variationMatrix ) { $this->productFactory = $productFactory; - $this->customAttributeBuilder = $customAttributeBuilder; + $this->customAttributeFactory = $customAttributeFactory; $this->variationMatrix = $variationMatrix; } @@ -58,10 +58,9 @@ class ProductVariationsBuilder $suffix = ''; foreach ($variation as $attributeId => $valueInfo) { $suffix .= '-' . $valueInfo['value']; - $customAttribute = $this->customAttributeBuilder + $customAttribute = $this->customAttributeFactory->create() ->setAttributeCode($attributes[$attributeId]['attribute_code']) - ->setValue($valueInfo['value']) - ->create(); + ->setValue($valueInfo['value']); $customAttributes = array_merge( $item->getCustomAttributes(), [ diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ProductVariationsBuilderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ProductVariationsBuilderTest.php index 49d42a1000cc9f1f6f1c4d0aca3c053713bb173b..e67edfb8a0347d843ba354db1f69976030d9ede0 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ProductVariationsBuilderTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ProductVariationsBuilderTest.php @@ -17,7 +17,7 @@ class ProductVariationsBuilderTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - private $customAttributeBuilder; + private $customAttributeFactory; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -36,8 +36,8 @@ class ProductVariationsBuilderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->customAttributeBuilder = $this->getMock( - '\Magento\Framework\Api\AttributeDataBuilder', + $this->customAttributeFactory = $this->getMock( + '\Magento\Framework\Api\AttributeValueFactory', [], [], '', @@ -64,7 +64,7 @@ class ProductVariationsBuilderTest extends \PHPUnit_Framework_TestCase $this->model = new \Magento\ConfigurableProduct\Model\ProductVariationsBuilder( $this->productFactory, - $this->customAttributeBuilder, + $this->customAttributeFactory, $this->variationMatrix ); } @@ -96,17 +96,17 @@ class ProductVariationsBuilderTest extends \PHPUnit_Framework_TestCase $output->expects($this->at(0))->method('setData')->with($productData); $attribute = $this->getMock('\Magento\Framework\Api\AttributeInterface'); - $this->customAttributeBuilder->expects($this->once()) + $attribute->expects($this->once()) ->method('setAttributeCode') ->with('sort_order') ->willReturnSelf(); - $this->customAttributeBuilder->expects($this->once()) + $attribute->expects($this->once()) ->method('setValue') ->with(15) ->willReturnSelf(); - $this->customAttributeBuilder->expects($this->once()) + $this->customAttributeFactory->expects($this->once()) ->method('create') ->willReturn($attribute); diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index d893a9a579d497a9ffb1e24a944cdf351bc37447..8e5ed6d41420f3511ea04f64c73aae01705a0d98 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -7,7 +7,6 @@ "magento/module-catalog": "0.42.0-beta11", "magento/module-catalog-inventory": "0.42.0-beta11", "magento/module-sales": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-checkout": "0.42.0-beta11", "magento/module-backend": "0.42.0-beta11", "magento/module-eav": "0.42.0-beta11", diff --git a/app/code/Magento/ConfigurableProduct/etc/config.xml b/app/code/Magento/ConfigurableProduct/etc/config.xml index f634fdfd21a81a63bf7c4c072c1450b1c4f30898..9cbd5d1e351f252168756cac3dd03ade2e3cc296 100644 --- a/app/code/Magento/ConfigurableProduct/etc/config.xml +++ b/app/code/Magento/ConfigurableProduct/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <checkout> <cart> diff --git a/app/code/Magento/ConfigurableProduct/etc/webapi.xml b/app/code/Magento/ConfigurableProduct/etc/webapi.xml index d48569ce61b337753067bd160f1627a84dd261f2..9c68aa71869f44782120dda382eb7de6c34e9f2d 100644 --- a/app/code/Magento/ConfigurableProduct/etc/webapi.xml +++ b/app/code/Magento/ConfigurableProduct/etc/webapi.xml @@ -7,13 +7,13 @@ --> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> - <route url="/V1/configurable-products/:productSku/children" method="GET"> + <route url="/V1/configurable-products/:sku/children" method="GET"> <service class="Magento\ConfigurableProduct\Api\LinkManagementInterface" method="getChildren"/> <resources> <resource ref="Magento_Catalog::products"/> </resources> </route> - <route url="/V1/configurable-products/:productSku/child/:childSku" method="DELETE"> + <route url="/V1/configurable-products/:sku/children/:childSku" method="DELETE"> <service class="Magento\ConfigurableProduct\Api\LinkManagementInterface" method="removeChild"/> <resources> <resource ref="Magento_Catalog::products"/> @@ -25,19 +25,19 @@ <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/configurable-products/:productSku/child" method="POST"> + <route url="/V1/configurable-products/:sku/child" method="POST"> <service class="Magento\ConfigurableProduct\Api\LinkManagementInterface" method="addChild"/> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/configurable-products/:productSku/options/:optionId" method="GET"> + <route url="/V1/configurable-products/:sku/options/:id" method="GET"> <service class="Magento\ConfigurableProduct\Api\OptionRepositoryInterface" method="get"/> <resources> <resource ref="Magento_Catalog::products"/> </resources> </route> - <route url="/V1/configurable-products/:productSku/options/all" method="GET"> + <route url="/V1/configurable-products/:sku/options/all" method="GET"> <service class="Magento\ConfigurableProduct\Api\OptionRepositoryInterface" method="getList"/> <resources> <resource ref="Magento_Catalog::products"/> @@ -49,19 +49,19 @@ <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/configurable-products/:productSku/options" method="POST"> + <route url="/V1/configurable-products/:sku/options" method="POST"> <service class="Magento\ConfigurableProduct\Api\OptionRepositoryInterface" method="save" /> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/configurable-products/:productSku/options/:id" method="PUT"> + <route url="/V1/configurable-products/:sku/options/:id" method="PUT"> <service class="Magento\ConfigurableProduct\Api\OptionRepositoryInterface" method="save" /> <resources> <resource ref="Magento_Catalog::products" /> </resources> </route> - <route url="/V1/configurable-products/:productSku/options/:optionId" method="DELETE"> + <route url="/V1/configurable-products/:sku/options/:id" method="DELETE"> <service class="Magento\ConfigurableProduct\Api\OptionRepositoryInterface" method="deleteById" /> <resources> <resource ref="Magento_Catalog::products" /> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml index ffb0246382d04a4b777f46a05a4ffd3d544d7365..253b53dca5986a49edcd2863b564773e1b873fb6 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/attribute-js-template.phtml @@ -10,21 +10,21 @@ ?> <script data-template-for="configurable-attribute" type="text/x-magento-template"> <div class="entry-edit" data-role="configurable-attribute" data-attribute="<%- JSON.stringify(data.attribute) %>"> - <input name="attributes[]" id="configurable_attribute_<%= data.attribute.id %>" - value="<%= data.attribute.id %>" type="hidden"> + <input name="attributes[]" id="configurable_attribute_<%- data.attribute.id %>" + value="<%- data.attribute.id %>" type="hidden"> <input value="new" type="hidden" - name="product[configurable_attributes_data][<%= data.attribute.id %>]][id]"/> - <input value="<%= data.attribute.id %>" type="hidden" - name="product[configurable_attributes_data][<%= data.attribute.id %>][attribute_id]"/> + name="product[configurable_attributes_data][<%- data.attribute.id %>]][id]"/> + <input value="<%- data.attribute.id %>" type="hidden" + name="product[configurable_attributes_data][<%- data.attribute.id %>][attribute_id]"/> <input value="" type="hidden" - name="product[configurable_attributes_data][<%= data.attribute.id %>][position]"/> - <input value="<%= data.attribute.code %>" type="hidden" - name="product[configurable_attributes_data][<%= data.attribute.id %>][code]"/> + name="product[configurable_attributes_data][<%- data.attribute.id %>][position]"/> + <input value="<%- data.attribute.code %>" type="hidden" + name="product[configurable_attributes_data][<%- data.attribute.id %>][code]"/> - <div class="fieldset-wrapper collapsable-wrapper" id="<%= data.attribute.id %>-wrapper"> + <div class="fieldset-wrapper collapsable-wrapper" id="<%- data.attribute.id %>-wrapper"> <div class="fieldset-wrapper-title"> - <strong class="title" data-toggle="collapse" data-target="#<%= data.attribute.id %>-content"> - <span><%= data.attribute.label %></span> + <strong class="title" data-toggle="collapse" data-target="#<%- data.attribute.id %>-content"> + <span><%- data.attribute.label %></span> </strong> <div class="actions"> <button type="button" title="<?php echo __('Delete Variations Group')?>" class="action-delete"> @@ -33,23 +33,23 @@ </div> <div class="draggable-handle" title="<?php echo __('Sort Variations')?>"></div> </div> - <div class="fieldset-wrapper-content collapse" id="<%= data.attribute.id %>-content" data-attribute-id="<%= data.attribute.id %>"> + <div class="fieldset-wrapper-content collapse" id="<%- data.attribute.id %>-content" data-attribute-id="<%- data.attribute.id %>"> <fieldset class="fieldset"> <div class="field field-variation"> <label class="label"><span><?php echo __('Variation Label'); ?></span></label> <div class="control"> - <input type="text" value="<%= data.attribute.label %>" - name="product[configurable_attributes_data][<%= data.attribute.id %>][label]" - data-store-label="<%= data.attribute.label %>" + <input type="text" value="<%- data.attribute.label %>" + name="product[configurable_attributes_data][<%- data.attribute.id %>][label]" + data-store-label="<%- data.attribute.label %>" class="store-label required-entry"/> </div> <div class="field-service"> - <label for="attribute-<%= data.attribute.id %>" class="use-default"> + <label for="attribute-<%- data.attribute.id %>" class="use-default"> <input value="1" type="checkbox" class="use-default-control" - name="product[configurable_attributes_data][<%= data.attribute.id %>][use_default]" - id="attribute-<%= data.attribute.id %>"/> + name="product[configurable_attributes_data][<%- data.attribute.id %>][use_default]" + id="attribute-<%- data.attribute.id %>"/> <span class="use-default-label"><?php echo __('Use Default')?></span> </label> </div> @@ -68,11 +68,11 @@ <tbody data-role="options"> <% _.each(data.attribute.options, function(option) { %> <tr data-role="option-container"> - <td class="col-name" data-column="name"><%= option.label %></td> + <td class="col-name" data-column="name"><%- option.label %></td> <td class="col-change-price" data-column="change-price"> <input type="hidden" - name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= option.value %>][value_index]" - value="<%= option.value %>"/> + name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- option.value %>][value_index]" + value="<%- option.value %>"/> <div class="field field-change-pricing"> <div class="control"> @@ -80,13 +80,13 @@ <div class="field field-pricing-value"> <div class="control"> <input type="text" class="pricing-value validate-number" - name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= option.value %>][pricing_value]" + name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- option.value %>][pricing_value]" value=""/> </div> </div> <div class="field field-pricing-measure"> <div class="actions dropdown actions-select"> - <input name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= option.value %>][is_percent]" type="hidden" value="0"/> + <input name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- option.value %>][is_percent]" type="hidden" value="0"/> <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> <span><?php echo $block->getBaseCurrency()->getSymbol() ?></span> </button> @@ -103,10 +103,10 @@ <td class="col-include" data-column="include"> <div class="field choice"> <input type="hidden" - name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= option.value %>][include]" + name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- option.value %>][include]" value="0"/> <input type="checkbox" class="include" - name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= option.value %>][include]" + name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- option.value %>][include]" value="1" checked="checked"/> </div> </td> @@ -137,7 +137,7 @@ <td class="col-name" data-column="name"> <div class="field"> <div class="control"> - <input name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= data.option.id %>][label]" + <input name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- data.option.id %>][label]" class="required-entry" type="text" placeholder="<?php echo __('begin typing to add value'); ?>" /> </div> @@ -150,12 +150,12 @@ <div class="field field-pricing-value"> <div class="control"> <input type="text" class="pricing-value validate-number" - name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= data.option.id %>][pricing_value]" /> + name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- data.option.id %>][pricing_value]" /> </div> </div> <div class="field field-pricing-measure"> <div class="actions dropdown actions-select"> - <input type="hidden" value="0" name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= data.option.id %>][is_percent]"/> + <input type="hidden" value="0" name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- data.option.id %>][is_percent]"/> <button type="button" class="action toggle" data-toggle="dropdown" data-mage-init='{"dropdown":{}}'> <span><?php echo $block->getBaseCurrency()->getSymbol() ?></span> </button> @@ -172,10 +172,10 @@ <td class="col-include" data-column="include"> <div class="field choice"> <input type="hidden" - name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= data.option.id %>][include]" + name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- data.option.id %>][include]" value="0"/> <input type="checkbox" class="include" - name="product[configurable_attributes_data][<%= data.attribute.id %>][values][<%= data.option.id %>][include]" + name="product[configurable_attributes_data][<%- data.attribute.id %>][values][<%- data.option.id %>][include]" value="1" checked="checked"/> </div> </td> diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml index 84f9dcccf3032cdc7b5b35b2baa6c68d37bf768a..8f4713df58ef5b5a2b597434c1a031b9c5880c31 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml @@ -255,7 +255,7 @@ $productByUsedAttributes = $block->getAssociatedProducts(); </div> </div> <script data-template-for="variation-image" type="text/x-magento-template"> - <img src="<%= data.url %>" class="variation" data-role="image"/> + <img src="<%- data.url %>" class="variation" data-role="image"/> </script> <script> require([ diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml index c430e91be2cc8ab9ac2134ff68bd9785ec284a29..ed335b6babce89860d2af06041a59957ce9dcea5 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/ConfigurableProduct/view/frontend/layout/checkout_cart_item_renderers.xml @@ -8,7 +8,7 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="checkout.cart.item.renderers"> - <block class="Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable" as="configurable" template="Magento_Checkout::cart/item/default.phtml" cacheable="false"/> + <block class="Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable" as="configurable" template="Magento_Checkout::cart/item/default.phtml"/> </referenceBlock> </body> </page> diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js index c9dfa4e472f785c7d3e130f2e0b4def23bb20c6e..b14c117584290f347854a621ca7394bb7072c909 100644 --- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js +++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js @@ -34,9 +34,9 @@ define([ priceHolderSelector: '.price-box', state: {}, priceFormat: {}, - optionTemplate: '<%= data.label %>' + + optionTemplate: '<%- data.label %>' + '<% if (data.finalPrice.value) { %>' + - ' <%= data.finalPrice.formatted %>' + + ' <%- data.finalPrice.formatted %>' + '<% } %>', mediaGallerySelector: '[data-role=media-gallery]' }, diff --git a/app/code/Magento/Contact/etc/config.xml b/app/code/Magento/Contact/etc/config.xml index f075a4e53a954f1aedaa8bbf705921857eac6dc2..fb2a17aa0100cbc9524c4692881ac265f7fe2275 100644 --- a/app/code/Magento/Contact/etc/config.xml +++ b/app/code/Magento/Contact/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <contact> <contact> diff --git a/app/code/Magento/Contact/etc/frontend/page_types.xml b/app/code/Magento/Contact/etc/frontend/page_types.xml index 9bcf7e9ca9774e395810ebab93590bea9ef4c401..9e85e85522a1557017ebbb649332049502d381fb 100644 --- a/app/code/Magento/Contact/etc/frontend/page_types.xml +++ b/app/code/Magento/Contact/etc/frontend/page_types.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="contact_index_index" label="Contact Us Form"/> </page_types> diff --git a/app/code/Magento/Contact/etc/module.xml b/app/code/Magento/Contact/etc/module.xml index 9962113cf348f736f2f61a98ac2e1b54761b3625..96f06a6c555a729a02b8643f7e01b3987e5a9bf0 100644 --- a/app/code/Magento/Contact/etc/module.xml +++ b/app/code/Magento/Contact/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Contact" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Cookie/etc/config.xml b/app/code/Magento/Cookie/etc/config.xml index cdeb99d4195ea29343fec69aaf2b69fcfd9ed508..7ebaec497d7bfd166822f31eb274c3e2feeb3692 100644 --- a/app/code/Magento/Cookie/etc/config.xml +++ b/app/code/Magento/Cookie/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <web> <cookie> diff --git a/app/code/Magento/Core/Controller/Index/NotFound.php b/app/code/Magento/Core/Controller/Index/NotFound.php deleted file mode 100644 index 3e0a46abf199a8ac1da81af408f8940d170d09fa..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Controller/Index/NotFound.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Core\Controller\Index; - -class NotFound extends \Magento\Framework\App\Action\Action -{ - /** - * 404 not found action - * - * @return void - */ - public function execute() - { - $this->getResponse()->setStatusHeader(404, '1.1', 'Not Found'); - $this->getResponse()->setBody(__('Requested resource not found')); - } -} diff --git a/app/code/Magento/Core/Setup/InstallData.php b/app/code/Magento/Core/Setup/InstallData.php deleted file mode 100755 index 52d8e6bea687733db2bd6fb477bcc1f11a9ed24e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Setup/InstallData.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Core\Setup; - -use Magento\Framework\Module\Setup\Migration; -use Magento\Framework\Setup\InstallDataInterface; -use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\ModuleDataSetupInterface; - -/** - * @codeCoverageIgnore - */ -class InstallData implements InstallDataInterface -{ - /** - * {@inheritdoc} - */ - public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) - { - $setup->startSetup(); - - /** - * Delete rows by condition from authorization_rule - */ - $tableName = $setup->getTable('authorization_rule'); - if ($tableName) { - $setup->getConnection()->delete($tableName, ['resource_id = ?' => 'admin/system/tools/compiler']); - } - - $setup->endSetup(); - - } -} diff --git a/app/code/Magento/Core/Setup/InstallSchema.php b/app/code/Magento/Core/Setup/InstallSchema.php deleted file mode 100644 index 5a9c92b58b1e6fcaf355c817a34c16f74d5c46c5..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Setup/InstallSchema.php +++ /dev/null @@ -1,231 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Core\Setup; - -use Magento\Framework\Setup\InstallSchemaInterface; -use Magento\Framework\Setup\ModuleContextInterface; -use Magento\Framework\Setup\SchemaSetupInterface; - -/** - * @codeCoverageIgnore - */ -class InstallSchema implements InstallSchemaInterface -{ - /** - * {@inheritdoc} - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) - { - $installer = $setup; - - /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ - $connection = $installer->getConnection(); - - $installer->startSetup(); - - /** - * Create table 'core_session' - */ - $table = $connection->newTable( - $installer->getTable('core_session') - )->addColumn( - 'session_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false, 'primary' => true], - 'Session Id' - )->addColumn( - 'session_expires', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Date of Session Expiration' - )->addColumn( - 'session_data', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '2M', - ['nullable' => false], - 'Session Data' - )->setComment( - 'Database Sessions Storage' - ); - $connection->createTable($table); - - /** - * Create table 'design_change' - */ - $table = $connection->newTable( - $installer->getTable('design_change') - )->addColumn( - 'design_change_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'nullable' => false, 'primary' => true], - 'Design Change Id' - )->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Store Id' - )->addColumn( - 'design', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Design' - )->addColumn( - 'date_from', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'First Date of Design Activity' - )->addColumn( - 'date_to', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - [], - 'Last Date of Design Activity' - )->addIndex( - $installer->getIdxName('design_change', ['store_id']), - ['store_id'] - )->addForeignKey( - $installer->getFkName('design_change', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE - )->setComment( - 'Design Changes' - ); - $connection->createTable($table); - - /** - * Create table 'core_cache' - */ - $table = $connection->newTable( - $installer->getTable('core_cache') - )->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false, 'primary' => true], - 'Cache Id' - )->addColumn( - 'data', - \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, - '2M', - [], - 'Cache Data' - )->addColumn( - 'create_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Cache Creation Time' - )->addColumn( - 'update_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Time of Cache Updating' - )->addColumn( - 'expire_time', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Cache Expiration Time' - )->addIndex( - $installer->getIdxName('core_cache', ['expire_time']), - ['expire_time'] - )->setComment( - 'Caches' - ); - $connection->createTable($table); - - /** - * Create table 'core_cache_tag' - */ - $table = $connection->newTable( - $installer->getTable('core_cache_tag') - )->addColumn( - 'tag', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 100, - ['nullable' => false, 'primary' => true], - 'Tag' - )->addColumn( - 'cache_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 200, - ['nullable' => false, 'primary' => true], - 'Cache Id' - )->addIndex( - $installer->getIdxName('core_cache_tag', ['cache_id']), - ['cache_id'] - )->setComment( - 'Tag Caches' - ); - $connection->createTable($table); - - /** - * Create table 'core_flag' - */ - $table = $connection->newTable( - $installer->getTable('core_flag') - )->addColumn( - 'flag_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], - 'Flag Id' - )->addColumn( - 'flag_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Flag Code' - )->addColumn( - 'state', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => '0'], - 'Flag State' - )->addColumn( - 'flag_data', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - [], - 'Flag Data' - )->addColumn( - 'last_update', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], - 'Date of Last Flag Update' - )->addIndex( - $installer->getIdxName('core_flag', ['last_update']), - ['last_update'] - )->setComment( - 'Flag' - ); - $connection->createTable($table); - - /** - * Drop Foreign Key on core_cache_tag.cache_id - */ - $connection->dropForeignKey( - $installer->getTable('core_cache_tag'), - $installer->getFkName('core_cache_tag', 'cache_id', 'core_cache', 'id') - ); - - $installer->endSetup(); - - } -} diff --git a/app/code/Magento/Core/Test/Unit/Controller/Index/NotFoundTest.php b/app/code/Magento/Core/Test/Unit/Controller/Index/NotFoundTest.php deleted file mode 100644 index e8ceda3d3a5bbed2558b98f823443f0e9201002e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Test/Unit/Controller/Index/NotFoundTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Core\Test\Unit\Controller\Index; - -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; - -class NotFoundTest extends \PHPUnit_Framework_TestCase -{ - public function testExecute() - { - /** - * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\App\Response\Http - */ - $responseMock = $this->getMockBuilder('Magento\Framework\App\Response\Http') - ->disableOriginalConstructor() - ->getMock(); - - $responseMock->expects($this->once())->method('setStatusHeader')->with(404, '1.1', 'Not Found'); - $responseMock->expects($this->once())->method('setBody')->with('Requested resource not found'); - - $objectManager = new ObjectManager($this); - - /** - * @var \Magento\Core\Controller\Index\NotFound - */ - $controller = $objectManager->getObject( - 'Magento\Core\Controller\Index\NotFound', - ['response' => $responseMock] - ); - - // Make the call to test - $controller->execute(); - } -} diff --git a/app/code/Magento/Core/Test/Unit/Model/App/StateTest.php b/app/code/Magento/Core/Test/Unit/Model/App/StateTest.php deleted file mode 100644 index 70a30989405ff292ca66ed649979877b267d1c75..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Test/Unit/Model/App/StateTest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Core\Test\Unit\Model\App; - -use Magento\Framework\App\State; - -class StateTest extends \PHPUnit_Framework_TestCase -{ - /** - * @param string $mode - * @dataProvider constructorDataProvider - */ - public function testConstructor($mode) - { - $model = new \Magento\Framework\App\State( - $this->getMockForAbstractClass('Magento\Framework\Config\ScopeInterface', [], '', false), - $mode - ); - $this->assertEquals($mode, $model->getMode()); - } - - /** - * @return array - */ - public static function constructorDataProvider() - { - return [ - 'default mode' => [\Magento\Framework\App\State::MODE_DEFAULT], - 'production mode' => [\Magento\Framework\App\State::MODE_PRODUCTION], - 'developer mode' => [\Magento\Framework\App\State::MODE_DEVELOPER] - ]; - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage Unknown application mode: unknown mode - */ - public function testConstructorException() - { - new \Magento\Framework\App\State( - $this->getMockForAbstractClass('Magento\Framework\Config\ScopeInterface', [], '', false), - "unknown mode" - ); - } -} diff --git a/app/code/Magento/Core/Test/Unit/Model/EntryPoint/_files/config.xml b/app/code/Magento/Core/Test/Unit/Model/EntryPoint/_files/config.xml deleted file mode 100644 index b1c3bbd854f56ddf4ce0d12f797ecc123bfe0e45..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Test/Unit/Model/EntryPoint/_files/config.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> - <default> - <resources> - <fixture_module_setup> - <setup/> - </fixture_module_setup> - </resources> - </default> -</config> diff --git a/app/code/Magento/Core/Test/Unit/Model/Resource/SessionTest.php b/app/code/Magento/Core/Test/Unit/Model/Resource/SessionTest.php deleted file mode 100644 index 9e871c965e466f00111ec8a993d0a83e89972b5c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Test/Unit/Model/Resource/SessionTest.php +++ /dev/null @@ -1,267 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Core\Test\Unit\Model\Resource; - -class SessionTest extends \PHPUnit_Framework_TestCase -{ - /** - * Session table name - */ - const SESSION_TABLE = 'session_table_name'; - - /**#@+ - * Table column names - */ - const COLUMN_SESSION_ID = 'session_id'; - - const COLUMN_SESSION_DATA = 'session_data'; - - const COLUMN_SESSION_EXPIRES = 'session_expires'; - - /**#@-*/ - - /** - * Test select object - */ - const SELECT_OBJECT = 'select_object'; - - /**#@+ - * Test session data - */ - const SESSION_ID = 'custom_session_id'; - - const SESSION_DATA = 'custom_session_data'; - - /**#@-*/ - - /** - * Model under test - * - * @var \Magento\Framework\Session\SaveHandler\DbTable - */ - protected $_model; - - protected function tearDown() - { - unset($this->_model); - } - - /** - * Data provider for testRead - * - * @return array - */ - public function readDataProvider() - { - return [ - 'session_encoded' => ['$dataEncoded' => true], - 'session_not_encoded' => ['$dataEncoded' => false] - ]; - } - - /** - * @param bool $isDataEncoded - * - * @dataProvider readDataProvider - */ - public function testRead($isDataEncoded) - { - $this->_prepareMockForRead($isDataEncoded); - $result = $this->_model->read(self::SESSION_ID); - $this->assertEquals(self::SESSION_DATA, $result); - } - - /** - * Prepares mock for test model with specified connections - * - * @param \PHPUnit_Framework_MockObject_MockObject $connection - */ - protected function _prepareResourceMock($connection) - { - $resource = $this->getMock( - 'Magento\Framework\App\Resource', - [], - [], - '', - false, - false - ); - $resource->expects($this->once())->method('getTableName')->will($this->returnValue(self::SESSION_TABLE)); - $resource->expects($this->once())->method('getConnection')->will($this->returnValue($connection)); - - $this->_model = new \Magento\Framework\Session\SaveHandler\DbTable($resource); - } - - /** - * Prepare mocks for testRead - * - * @param bool $isDataEncoded - */ - protected function _prepareMockForRead($isDataEncoded) - { - $connection = $this->getMock( - 'Magento\Framework\DB\Adapter\Pdo\Mysql', - ['select', 'from', 'where', 'fetchOne', 'isTableExists'], - [], - '', - false - ); - $connection->expects($this->atLeastOnce())->method('isTableExists')->will($this->returnValue(true)); - $connection->expects($this->once())->method('select')->will($this->returnSelf()); - $connection->expects( - $this->once() - )->method( - 'from' - )->with( - self::SESSION_TABLE, - [self::COLUMN_SESSION_DATA] - )->will( - $this->returnSelf() - ); - $connection->expects( - $this->once() - )->method( - 'where' - )->with( - self::COLUMN_SESSION_ID . ' = :' . self::COLUMN_SESSION_ID - )->will( - $this->returnValue(self::SELECT_OBJECT) - ); - - $sessionData = self::SESSION_DATA; - if ($isDataEncoded) { - $sessionData = base64_encode($sessionData); - } - $connection->expects( - $this->once() - )->method( - 'fetchOne' - )->with( - self::SELECT_OBJECT, - [self::COLUMN_SESSION_ID => self::SESSION_ID] - )->will( - $this->returnValue($sessionData) - ); - - $this->_prepareResourceMock($connection); - } - - /** - * Data provider for testWrite - * - * @return array - */ - public function writeDataProvider() - { - return [ - 'session_exists' => ['$sessionExists' => true], - 'session_not_exists' => ['$sessionExists' => false] - ]; - } - - /** - * @param bool $sessionExists - * - * @dataProvider writeDataProvider - */ - public function testWrite($sessionExists) - { - $this->_prepareMockForWrite($sessionExists); - $this->assertTrue($this->_model->write(self::SESSION_ID, self::SESSION_DATA)); - } - - /** - * Prepare mocks for testWrite - * - * @param bool $sessionExists - */ - protected function _prepareMockForWrite($sessionExists) - { - $connection = $this->getMock( - 'Magento\Framework\DB\Adapter\Pdo\Mysql', - ['select', 'from', 'where', 'fetchOne', 'update', 'insert', 'isTableExists'], - [], - '', - false - ); - $connection->expects($this->atLeastOnce())->method('isTableExists')->will($this->returnValue(true)); - $connection->expects($this->once())->method('select')->will($this->returnSelf()); - $connection->expects($this->once())->method('from')->with(self::SESSION_TABLE)->will($this->returnSelf()); - $connection->expects( - $this->once() - )->method( - 'where' - )->with( - self::COLUMN_SESSION_ID . ' = :' . self::COLUMN_SESSION_ID - )->will( - $this->returnValue(self::SELECT_OBJECT) - ); - $connection->expects( - $this->once() - )->method( - 'fetchOne' - )->with( - self::SELECT_OBJECT, - [self::COLUMN_SESSION_ID => self::SESSION_ID] - )->will( - $this->returnValue($sessionExists) - ); - - if ($sessionExists) { - $connection->expects($this->never())->method('insert'); - $connection->expects( - $this->once() - )->method( - 'update' - )->will( - $this->returnCallback([$this, 'verifyUpdate']) - ); - } else { - $connection->expects( - $this->once() - )->method( - 'insert' - )->will( - $this->returnCallback([$this, 'verifyInsert']) - ); - $connection->expects($this->never())->method('update'); - } - - $this->_prepareResourceMock($connection); - } - - /** - * Verify arguments of insert method - * - * @param string $table - * @param array $bind - */ - public function verifyInsert($table, array $bind) - { - $this->assertEquals(self::SESSION_TABLE, $table); - - $this->assertInternalType('int', $bind[self::COLUMN_SESSION_EXPIRES]); - $this->assertEquals(base64_encode(self::SESSION_DATA), $bind[self::COLUMN_SESSION_DATA]); - $this->assertEquals(self::SESSION_ID, $bind[self::COLUMN_SESSION_ID]); - } - - /** - * Verify arguments of update method - * - * @param string $table - * @param array $bind - * @param array $where - */ - public function verifyUpdate($table, array $bind, array $where) - { - $this->assertEquals(self::SESSION_TABLE, $table); - - $this->assertInternalType('int', $bind[self::COLUMN_SESSION_EXPIRES]); - $this->assertEquals(base64_encode(self::SESSION_DATA), $bind[self::COLUMN_SESSION_DATA]); - - $this->assertEquals([self::COLUMN_SESSION_ID . '=?' => self::SESSION_ID], $where); - } -} diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json deleted file mode 100644 index f32ffb2a52f0fb36d5621b638074afd2626acf2f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "magento/module-core", - "description": "N/A", - "require": { - "php": "~5.5.0|~5.6.0", - "magento/module-authorization": "0.42.0-beta11", - "magento/module-store": "0.42.0-beta11", - "magento/framework": "0.42.0-beta11", - "lib-libxml": "*", - "magento/magento-composer-installer": "*" - }, - "type": "magento2-module", - "version": "0.42.0-beta11", - "license": [ - "OSL-3.0", - "AFL-3.0" - ], - "extra": { - "map": [ - [ - "*", - "Magento/Core" - ] - ] - } -} diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml deleted file mode 100644 index 7c0da9d131ee661dffc057d94b4c413292dfd8c5..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/etc/di.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> - <type name="Magento\Framework\App\Config\Initial\SchemaLocator"> - <arguments> - <argument name="moduleName" xsi:type="string">Magento_Core</argument> - </arguments> - </type> - <type name="Magento\Framework\App\Router\Base"> - <arguments> - <argument name="routerId" xsi:type="string">standard</argument> - </arguments> - </type> - <type name="Magento\Framework\DB\Helper"> - <arguments> - <argument name="modulePrefix" xsi:type="string">core</argument> - </arguments> - </type> - <type name="Magento\Framework\Module\Setup\Migration"> - <arguments> - <argument name="confPathToMapFile" xsi:type="string">app/etc/aliases_to_classes_map.json</argument> - <argument name="resourceName" xsi:type="string">core_setup</argument> - <argument name="moduleName" xsi:type="string">Magento_Core</argument> - <argument name="connectionName" xsi:type="string">\Magento\Framework\Setup\ModuleDataResourceInterface::DEFAULT_SETUP_CONNECTION</argument> - </arguments> - </type> - <virtualType name="Magento\Core\Model\Session\Storage" type="Magento\Framework\Session\Storage"> - <arguments> - <argument name="namespace" xsi:type="string">core</argument> - </arguments> - </virtualType> - <type name="Magento\Framework\Session\Generic"> - <arguments> - <argument name="storage" xsi:type="object">Magento\Core\Model\Session\Storage</argument> - </arguments> - </type> - <type name="Magento\Framework\Stdlib\DateTime\Timezone"> - <arguments> - <argument name="defaultTimezonePath" xsi:type="const">Magento\Directory\Helper\Data::XML_PATH_DEFAULT_TIMEZONE</argument> - <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> - </arguments> - </type> - <type name="Magento\Framework\Locale\Resolver"> - <plugin name="initLocale" type="Magento\Framework\Translate\Locale\Resolver\Plugin" sortOrder="10"/> - <arguments> - <argument name="defaultLocalePath" xsi:type="const">Magento\Directory\Helper\Data::XML_PATH_DEFAULT_LOCALE</argument> - <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> - </arguments> - </type> -</config> diff --git a/app/code/Magento/Core/etc/frontend/di.xml b/app/code/Magento/Core/etc/frontend/di.xml deleted file mode 100644 index a86435f16a24a2380745cfe6fdb78b11c277768d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/etc/frontend/di.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> - <type name="Magento\Framework\App\FrontController"> - <plugin name="requestPreprocessor" type="Magento\Store\App\FrontController\Plugin\RequestPreprocessor" sortOrder="50"/> - </type> -</config> diff --git a/app/code/Magento/Core/etc/frontend/routes.xml b/app/code/Magento/Core/etc/frontend/routes.xml deleted file mode 100644 index 6fbeceb9b8ede1d5932b14e330a7a0be8aaba488..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/etc/frontend/routes.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd"> - <router id="standard"> - <route id="core" frontName="core"> - <module name="Magento_Core" /> - </route> - </router> -</config> \ No newline at end of file diff --git a/app/code/Magento/Core/etc/module.xml b/app/code/Magento/Core/etc/module.xml deleted file mode 100644 index 665171f5a6ad8f1f6fe9e10384cb1cfd0e2d9b8c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/etc/module.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> - <module name="Magento_Core" setup_version="2.0.1"> - </module> -</config> diff --git a/app/code/Magento/Core/etc/resources.xml b/app/code/Magento/Core/etc/resources.xml deleted file mode 100644 index 067547b086c152f7b83474548961e1dbff9e3e75..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/etc/resources.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/App/etc/resources.xsd"> - <resource name="core_setup" extends="default_setup" /> -</config> diff --git a/app/code/Magento/Core/i18n/de_DE.csv b/app/code/Magento/Core/i18n/de_DE.csv deleted file mode 100644 index 7299a44c88475bd6e9038603984d8f9f7ad3d47b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/i18n/de_DE.csv +++ /dev/null @@ -1,42 +0,0 @@ -Configuration,Configuration -"-- Please Select --","-- Bitte auswählen --" -"Custom Variables","Angepasste Variablen" -"Requested resource not found","Requested resource not found" -"File %1 does not exist","File %1 does not exist" -"File %1 is not readable","File %1 is not readable" -"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." -"database ""%1""","database ""%1""" -"Parent directory does not exist: %1","Parent directory does not exist: %1" -"File system",Dateisystem -"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" -"Wrong file info format","Falsches Format Dateiinfo" -"Path ""%value%"" is protected and cannot be used.","Der Pfad ""%value%"" ist geschützt und kann nicht verwendet werden." -"Path ""%value%"" is not available and cannot be used.","Der Pfad ""%value%"" ist nicht verfügbar und kann nicht verwendet werden." -"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Der Pfad ""%value%"" darf keinen Verweis auf das übergeordnete Verzeichnis enthalten (""../"", ""..\")." -"Please set available and/or protected paths list(s) before validation.","Bitte stellen Sie vor der Bestätigung die Liste(n) der verfügbaren und/oder geschützten Pfade ein." -"File with an extension ""%value%"" is protected and cannot be uploaded","Dateien mit der Endung ""%value%"" sind geschützt und können nicht hochgeladen werden" -"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." -"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." -"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" -"Start date cannot be greater than end date.","Das Anfangsdatum darf nicht nach dem Enddatum liegen." -"Your design change for the specified store intersects with another one, please specify another date range.","Ihre Design-Änderung für den ausgewählten Store überschneidet sich mit einer anderen, bitte wählen Sie einen anderen Zeitraum." -"Unable to create directory: %1","Unable to create directory: %1" -"Unable to save file: %1","Unable to save file: %1" -Copy,Copy -"Theme isn't deletable.","Theme isn't deletable." -"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" -"Variable Code must be unique.","Variabler Code muß eindeutig sein." -"Validation has failed.","Prüfung fehlgeschlagen." -%1,%1 -"Insert Variable...","Insert Variable..." -"System(config.xml, local.xml) and modules configuration files(config.xml).","System(config.xml, local.xml) and modules configuration files(config.xml)." -Layouts,Layouts -"Layout building instructions.","Layout building instructions." -"Blocks HTML output","Blocks HTML output" -"Page blocks HTML.","Page blocks HTML." -"View files fallback","View files fallback" -"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." -"View files pre-processing","View files pre-processing" -"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." -"Collections Data","Collections Data" -"Collection data files.","Collection data files." diff --git a/app/code/Magento/Core/i18n/en_US.csv b/app/code/Magento/Core/i18n/en_US.csv deleted file mode 100644 index 1505afedfcd4b501b6b295521c78d29a73a86ea2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/i18n/en_US.csv +++ /dev/null @@ -1,42 +0,0 @@ -Configuration,Configuration -"-- Please Select --","-- Please Select --" -"Custom Variables","Custom Variables" -"Requested resource not found","Requested resource not found" -"File %1 does not exist","File %1 does not exist" -"File %1 is not readable","File %1 is not readable" -"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." -"database ""%1""","database ""%1""" -"Parent directory does not exist: %1","Parent directory does not exist: %1" -"File system","File system" -"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" -"Wrong file info format","Wrong file info format" -"Path ""%value%"" is protected and cannot be used.","Path ""%value%"" is protected and cannot be used." -"Path ""%value%"" is not available and cannot be used.","Path ""%value%"" is not available and cannot be used." -"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Path ""%value%"" may not include parent directory traversal (""../"", ""..\")." -"Please set available and/or protected paths list(s) before validation.","Please set available and/or protected paths list(s) before validation." -"File with an extension ""%value%"" is protected and cannot be uploaded","File with an extension ""%value%"" is protected and cannot be uploaded" -"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." -"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." -"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" -"Start date cannot be greater than end date.","Start date cannot be greater than end date." -"Your design change for the specified store intersects with another one, please specify another date range.","Your design change for the specified store intersects with another one, please specify another date range." -"Unable to create directory: %1","Unable to create directory: %1" -"Unable to save file: %1","Unable to save file: %1" -Copy,Copy -"Theme isn't deletable.","Theme isn't deletable." -"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" -"Variable Code must be unique.","Variable Code must be unique." -"Validation has failed.","Validation has failed." -%1,%1 -"Insert Variable...","Insert Variable..." -"System(config.xml, local.xml) and modules configuration files(config.xml).","System(config.xml, local.xml) and modules configuration files(config.xml)." -Layouts,Layouts -"Layout building instructions.","Layout building instructions." -"Blocks HTML output","Blocks HTML output" -"Page blocks HTML.","Page blocks HTML." -"View files fallback","View files fallback" -"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." -"View files pre-processing","View files pre-processing" -"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." -"Collections Data","Collections Data" -"Collection data files.","Collection data files." diff --git a/app/code/Magento/Core/i18n/es_ES.csv b/app/code/Magento/Core/i18n/es_ES.csv deleted file mode 100644 index eb11b11e933fbe7ccd774b0c82482028a0eb4769..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/i18n/es_ES.csv +++ /dev/null @@ -1,42 +0,0 @@ -Configuration,Configuration -"-- Please Select --","-- Seleccionar, por favor --" -"Custom Variables","Variables personalizadas" -"Requested resource not found","Requested resource not found" -"File %1 does not exist","File %1 does not exist" -"File %1 is not readable","File %1 is not readable" -"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." -"database ""%1""","database ""%1""" -"Parent directory does not exist: %1","Parent directory does not exist: %1" -"File system","Sistema de archivos" -"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" -"Wrong file info format","Formato de información del archivo incorrecto" -"Path ""%value%"" is protected and cannot be used.","La ruta ""%value%"" está protegida y no se puede utilizar." -"Path ""%value%"" is not available and cannot be used.","La ruta ""%value%"" no está disponible y no puede usarse." -"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","La ruta ""%value%"" no puede incluir accesos de ejecución transversal (""../"", ""..\")." -"Please set available and/or protected paths list(s) before validation.","Por favor, indique la(s) lista(s) de rutas disponibles y/o protegidas antes de la validación." -"File with an extension ""%value%"" is protected and cannot be uploaded","El archivo con extensión ""%value%"" está protegido y no se puede subir" -"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." -"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." -"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" -"Start date cannot be greater than end date.","La fecha de inicio no puede ser mayor que la de fin." -"Your design change for the specified store intersects with another one, please specify another date range.","Su cambio de diseño para la tienda especificada se superpone con otro. Especifique otro rango de fecha." -"Unable to create directory: %1","Unable to create directory: %1" -"Unable to save file: %1","Unable to save file: %1" -Copy,Copy -"Theme isn't deletable.","Theme isn't deletable." -"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" -"Variable Code must be unique.","El código de variable debe ser único." -"Validation has failed.","Falló la validación." -%1,%1 -"Insert Variable...","Insert Variable..." -"System(config.xml, local.xml) and modules configuration files(config.xml).","System(config.xml, local.xml) and modules configuration files(config.xml)." -Layouts,Layouts -"Layout building instructions.","Layout building instructions." -"Blocks HTML output","Blocks HTML output" -"Page blocks HTML.","Page blocks HTML." -"View files fallback","View files fallback" -"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." -"View files pre-processing","View files pre-processing" -"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." -"Collections Data","Collections Data" -"Collection data files.","Collection data files." diff --git a/app/code/Magento/Core/i18n/fr_FR.csv b/app/code/Magento/Core/i18n/fr_FR.csv deleted file mode 100644 index 7afba82f7fea613c31c1d5403e634c92e2354c19..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/i18n/fr_FR.csv +++ /dev/null @@ -1,42 +0,0 @@ -Configuration,Configuration -"-- Please Select --","-- Veuillez sélectionner --" -"Custom Variables","Variables sur mesure" -"Requested resource not found","Requested resource not found" -"File %1 does not exist","File %1 does not exist" -"File %1 is not readable","File %1 is not readable" -"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." -"database ""%1""","database ""%1""" -"Parent directory does not exist: %1","Parent directory does not exist: %1" -"File system","Système de fichiers" -"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" -"Wrong file info format","Informations du format de fichiers incorrectes" -"Path ""%value%"" is protected and cannot be used.","Le chemin ""%value%"" est protégé et ne peut pas être utilisé." -"Path ""%value%"" is not available and cannot be used.","Le chemin ""%value%"" est indisponible et ne peut être utilisé." -"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Il se peut que le chemin ""%value%"" ne contienne pas de traversée de répertoire parent (""../"", ""..\")." -"Please set available and/or protected paths list(s) before validation.","Veuillez définir la/les liste(s) de chemins disponibles et/ou protégés avant la validation." -"File with an extension ""%value%"" is protected and cannot be uploaded","Le fichier avec une ""%valeur%"" d'extension est protégé et ne peut être téléchargé." -"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." -"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." -"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" -"Start date cannot be greater than end date.","La date de début ne peut pas être après la date de fin." -"Your design change for the specified store intersects with another one, please specify another date range.","Votre changement de dessin pour la boutique spécifiée se mélange à une autre, veuillez spécifier une autre fourchette de dates." -"Unable to create directory: %1","Unable to create directory: %1" -"Unable to save file: %1","Unable to save file: %1" -Copy,Copy -"Theme isn't deletable.","Theme isn't deletable." -"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" -"Variable Code must be unique.","La variable code doit être unique." -"Validation has failed.","Validation a échouée" -%1,%1 -"Insert Variable...","Insert Variable..." -"System(config.xml, local.xml) and modules configuration files(config.xml).","System(config.xml, local.xml) and modules configuration files(config.xml)." -Layouts,Layouts -"Layout building instructions.","Layout building instructions." -"Blocks HTML output","Blocks HTML output" -"Page blocks HTML.","Page blocks HTML." -"View files fallback","View files fallback" -"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." -"View files pre-processing","View files pre-processing" -"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." -"Collections Data","Collections Data" -"Collection data files.","Collection data files." diff --git a/app/code/Magento/Core/i18n/nl_NL.csv b/app/code/Magento/Core/i18n/nl_NL.csv deleted file mode 100644 index 7b321e76f829245e6e1a05eed30ed0f7556590b4..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/i18n/nl_NL.csv +++ /dev/null @@ -1,42 +0,0 @@ -Configuration,Configuration -"-- Please Select --","-- Selecteer a.u.b.--" -"Custom Variables","Aangepaste variabelen" -"Requested resource not found","Requested resource not found" -"File %1 does not exist","File %1 does not exist" -"File %1 is not readable","File %1 is not readable" -"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." -"database ""%1""","database ""%1""" -"Parent directory does not exist: %1","Parent directory does not exist: %1" -"File system",Bestandssysteem -"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" -"Wrong file info format","Verkeerde bestandsinformatiebestand" -"Path ""%value%"" is protected and cannot be used.","Pad ""%value%"" is beschermd en kan niet worden gebruikt." -"Path ""%value%"" is not available and cannot be used.","Pad ""%value%"" is niet beschikbaar en kan niet gebruikt worden." -"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Pad ""%value%"" mag geen parent directory traversal bevatten (""../"", ""..\")." -"Please set available and/or protected paths list(s) before validation.","Stel beschikbare en/of beschermde pad lijst(en) in voor validatie." -"File with an extension ""%value%"" is protected and cannot be uploaded","Bestand met de uitgang ""%value%"" is beschermd en kan niet worden geüpload." -"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." -"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." -"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" -"Start date cannot be greater than end date.","Begin datum kan niet later zijn dan eind datum." -"Your design change for the specified store intersects with another one, please specify another date range.","Uw ontwerp verandering voor de gespecificeerde store komt in conflict met een andere, specificeer a.u.b. een andere datumrange." -"Unable to create directory: %1","Unable to create directory: %1" -"Unable to save file: %1","Unable to save file: %1" -Copy,Copy -"Theme isn't deletable.","Theme isn't deletable." -"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" -"Variable Code must be unique.","Variabele Code moet uniek zijn." -"Validation has failed.","Validatie is mislukt." -%1,%1 -"Insert Variable...","Insert Variable..." -"System(config.xml, local.xml) and modules configuration files(config.xml).","System(config.xml, local.xml) and modules configuration files(config.xml)." -Layouts,Layouts -"Layout building instructions.","Layout building instructions." -"Blocks HTML output","Blocks HTML output" -"Page blocks HTML.","Page blocks HTML." -"View files fallback","View files fallback" -"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." -"View files pre-processing","View files pre-processing" -"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." -"Collections Data","Collections Data" -"Collection data files.","Collection data files." diff --git a/app/code/Magento/Core/i18n/pt_BR.csv b/app/code/Magento/Core/i18n/pt_BR.csv deleted file mode 100644 index cd8f160c2165c578e9847a6224bb5da8a0699c35..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/i18n/pt_BR.csv +++ /dev/null @@ -1,42 +0,0 @@ -Configuration,Configuration -"-- Please Select --","- Por Favor Selecione -" -"Custom Variables","Variáveis de Personalização." -"Requested resource not found","Requested resource not found" -"File %1 does not exist","File %1 does not exist" -"File %1 is not readable","File %1 is not readable" -"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." -"database ""%1""","database ""%1""" -"Parent directory does not exist: %1","Parent directory does not exist: %1" -"File system","Sistema de arquivo" -"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" -"Wrong file info format","Formato de arquivo de informação errado" -"Path ""%value%"" is protected and cannot be used.","Caminho ""%valor%"" é protegido e não pode ser usado." -"Path ""%value%"" is not available and cannot be used.","Caminho ""%valor%"" não está disponÃvel e não pode ser usado." -"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","Caminho ""%valor%"" não pode incluir passagem pelo diretório principal (""../"", ""..\")." -"Please set available and/or protected paths list(s) before validation.","Por favor defina lista(s) de caminhos disponÃveis e/ou protegidos antes da validação." -"File with an extension ""%value%"" is protected and cannot be uploaded","O arquivo de extensão ""%value%"" está protegido, e seu upload não pode ser feito" -"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." -"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." -"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" -"Start date cannot be greater than end date.","Data de inÃcio não pode ser maior que a data do término." -"Your design change for the specified store intersects with another one, please specify another date range.","Sua mudança de design para a loja especificada cruza com outra, por favor especifique outro intervalo de datas." -"Unable to create directory: %1","Unable to create directory: %1" -"Unable to save file: %1","Unable to save file: %1" -Copy,Copy -"Theme isn't deletable.","Theme isn't deletable." -"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" -"Variable Code must be unique.","Código da Variável deve ser único." -"Validation has failed.","Validação falhou." -%1,%1 -"Insert Variable...","Insert Variable..." -"System(config.xml, local.xml) and modules configuration files(config.xml).","System(config.xml, local.xml) and modules configuration files(config.xml)." -Layouts,Layouts -"Layout building instructions.","Layout building instructions." -"Blocks HTML output","Blocks HTML output" -"Page blocks HTML.","Page blocks HTML." -"View files fallback","View files fallback" -"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." -"View files pre-processing","View files pre-processing" -"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." -"Collections Data","Collections Data" -"Collection data files.","Collection data files." diff --git a/app/code/Magento/Core/i18n/zh_CN.csv b/app/code/Magento/Core/i18n/zh_CN.csv deleted file mode 100644 index b1066712eddd06607c3442aee3372575c4efc924..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/i18n/zh_CN.csv +++ /dev/null @@ -1,42 +0,0 @@ -Configuration,Configuration -"-- Please Select --","-- 请选择 --" -"Custom Variables",自定义å˜é‡ -"Requested resource not found","Requested resource not found" -"File %1 does not exist","File %1 does not exist" -"File %1 is not readable","File %1 is not readable" -"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." -"database ""%1""","database ""%1""" -"Parent directory does not exist: %1","Parent directory does not exist: %1" -"File system",文件系统 -"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" -"Wrong file info format",é”™è¯¯çš„æ–‡ä»¶ä¿¡æ¯æ ¼å¼ -"Path ""%value%"" is protected and cannot be used.","路径 ""%value%"" å—ä¿æŠ¤ï¼Œæ— æ³•ä½¿ç”¨ã€‚" -"Path ""%value%"" is not available and cannot be used.","路径 ""%value%"" ä¸å¯ç”¨ï¼Œå› æ¤æ— 法使用。" -"Path ""%value%"" may not include parent directory traversal (""../"", ""..\").","路径 ""%value%"" å¯èƒ½ä¸åŒ…å«çˆ¶ç›®å½•é历 (""../"", ""..\")." -"Please set available and/or protected paths list(s) before validation.",请设置有效并/或å—ä¿æŠ¤çš„è·¯å¾„åˆ—è¡¨ï¼ŒéšåŽå†éªŒè¯ã€‚ -"File with an extension ""%value%"" is protected and cannot be uploaded","扩展为 ""%value%"" 的文件å—åˆ°ä¿æŠ¤ï¼Œæ— æ³•ä¸Šä¼ " -"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." -"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." -"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" -"Start date cannot be greater than end date.",开始日期ä¸èƒ½å¤§äºŽç»“æŸæ—¥æœŸã€‚ -"Your design change for the specified store intersects with another one, please specify another date range.",您对指定商店设计的更改和å¦ä¸€ä¸ªæœ‰äº¤å‰ï¼Œè¯·é‡æ–°æŒ‡å®šæ—¥æœŸèŒƒå›´ã€‚ -"Unable to create directory: %1","Unable to create directory: %1" -"Unable to save file: %1","Unable to save file: %1" -Copy,Copy -"Theme isn't deletable.","Theme isn't deletable." -"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" -"Variable Code must be unique.",å˜é‡ä»£ç 必须是唯一的。 -"Validation has failed.",验è¯å¤±è´¥ã€‚ -%1,%1 -"Insert Variable...","Insert Variable..." -"System(config.xml, local.xml) and modules configuration files(config.xml).","System(config.xml, local.xml) and modules configuration files(config.xml)." -Layouts,Layouts -"Layout building instructions.","Layout building instructions." -"Blocks HTML output","Blocks HTML output" -"Page blocks HTML.","Page blocks HTML." -"View files fallback","View files fallback" -"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." -"View files pre-processing","View files pre-processing" -"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." -"Collections Data","Collections Data" -"Collection data files.","Collection data files." diff --git a/app/code/Magento/Customer/Api/Data/AddressInterface.php b/app/code/Magento/Customer/Api/Data/AddressInterface.php index f1180ce71bb59440c7e10b08c0d848d903449ab4..d4828f5abc8e67580ca9abcfb338bffb8b172cdf 100644 --- a/app/code/Magento/Customer/Api/Data/AddressInterface.php +++ b/app/code/Magento/Customer/Api/Data/AddressInterface.php @@ -7,12 +7,10 @@ namespace Magento\Customer\Api\Data; -use Magento\Framework\Api\ExtensibleDataInterface; - /** * Customer address interface. */ -interface AddressInterface extends ExtensibleDataInterface +interface AddressInterface extends \Magento\Framework\Api\CustomAttributesDataInterface { /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case @@ -306,4 +304,19 @@ interface AddressInterface extends ExtensibleDataInterface * @return $this */ public function setIsDefaultBilling($isDefaultBilling); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Customer\Api\Data\AddressExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Customer\Api\Data\AddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\AddressExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php b/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php index f7275b87eb5126801215915906bd3873c66a4729..ab08ea9e87b298b8641bd714742834da1976efe0 100644 --- a/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php +++ b/app/code/Magento/Customer/Api/Data/AddressSearchResultsInterface.php @@ -17,4 +17,12 @@ interface AddressSearchResultsInterface extends \Magento\Framework\Api\SearchRes * @return \Magento\Customer\Api\Data\AddressInterface[] */ public function getItems(); + + /** + * Set customer addresses list. + * + * @param \Magento\Customer\Api\Data\AddressInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Customer/Api/Data/AttributeMetadataInterface.php b/app/code/Magento/Customer/Api/Data/AttributeMetadataInterface.php index 5db373c70a3ca8c662c0243ebe154209a553ad2b..d5af12db20d6176e3621b0b155eb083f704b0bba 100644 --- a/app/code/Magento/Customer/Api/Data/AttributeMetadataInterface.php +++ b/app/code/Magento/Customer/Api/Data/AttributeMetadataInterface.php @@ -9,7 +9,7 @@ namespace Magento\Customer\Api\Data; /** * Customer attribute metadata interface. */ -interface AttributeMetadataInterface +interface AttributeMetadataInterface extends \Magento\Framework\Api\MetadataObjectInterface { /**#@+ * Constants used as keys of data array @@ -33,21 +33,6 @@ interface AttributeMetadataInterface const BACKEND_TYPE = 'backend_type'; /**#@-*/ - /** - * Retrieve code of the attribute. - * - * @return string - */ - public function getAttributeCode(); - - /** - * Set attribute code - * - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode); - /** * Frontend HTML for input element. * diff --git a/app/code/Magento/Customer/Api/Data/CustomerInterface.php b/app/code/Magento/Customer/Api/Data/CustomerInterface.php index a5b781439ae1b600a7e0495f35667be9d38a3031..78be9d556014ac871eff29a9053153033690a736 100644 --- a/app/code/Magento/Customer/Api/Data/CustomerInterface.php +++ b/app/code/Magento/Customer/Api/Data/CustomerInterface.php @@ -5,12 +5,10 @@ */ namespace Magento\Customer\Api\Data; -use Magento\Framework\Api\ExtensibleDataInterface; - /** * Customer interface. */ -interface CustomerInterface extends ExtensibleDataInterface +interface CustomerInterface extends \Magento\Framework\Api\CustomAttributesDataInterface { /**#@+ * Constants defined for keys of the data array. Identical to the name of the getter in snake case @@ -320,4 +318,19 @@ interface CustomerInterface extends ExtensibleDataInterface * @return $this */ public function setAddresses(array $addresses = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Customer\Api\Data\CustomerExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Customer\Api\Data\CustomerExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\CustomerExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php b/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php index c5721cb56fe6d3c36bfda6f1906f0682cab42678..2a020f9deeb09503817655494eaa0d2a57208dee 100644 --- a/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php +++ b/app/code/Magento/Customer/Api/Data/CustomerSearchResultsInterface.php @@ -17,4 +17,12 @@ interface CustomerSearchResultsInterface extends \Magento\Framework\Api\SearchRe * @return \Magento\Customer\Api\Data\CustomerInterface[] */ public function getItems(); + + /** + * Set customers list. + * + * @param \Magento\Customer\Api\Data\CustomerInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Customer/Api/Data/GroupInterface.php b/app/code/Magento/Customer/Api/Data/GroupInterface.php index 9062e8f4732de593e20ccb813c333772e76b65a5..7bb583d433a33e3ad16129038c9c03d7abf95cb9 100644 --- a/app/code/Magento/Customer/Api/Data/GroupInterface.php +++ b/app/code/Magento/Customer/Api/Data/GroupInterface.php @@ -85,4 +85,19 @@ interface GroupInterface extends ExtensibleDataInterface * @return string|null */ public function setTaxClassName($taxClassName); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Customer\Api\Data\GroupExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Customer\Api\Data\GroupExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\GroupExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php b/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php index bf5d9dacab210d47ff10bdbdaa05dbb1f8b3f191..953c2f2381498b6534652defd89065e69c71cdf0 100644 --- a/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php +++ b/app/code/Magento/Customer/Api/Data/GroupSearchResultsInterface.php @@ -17,4 +17,12 @@ interface GroupSearchResultsInterface extends \Magento\Framework\Api\SearchResul * @return \Magento\Customer\Api\Data\GroupInterface[] */ public function getItems(); + + /** + * Set customer groups list. + * + * @param \Magento\Customer\Api\Data\GroupInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Customer/Api/Data/RegionInterface.php b/app/code/Magento/Customer/Api/Data/RegionInterface.php index 2d698fefc473039ce85c4990262d074bee0a1c28..808274c02f051b2decca7e39a2f7d0b614ca22a6 100644 --- a/app/code/Magento/Customer/Api/Data/RegionInterface.php +++ b/app/code/Magento/Customer/Api/Data/RegionInterface.php @@ -65,4 +65,19 @@ interface RegionInterface extends ExtensibleDataInterface * @return $this */ public function setRegionId($regionId); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Customer\Api\Data\RegionExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Customer\Api\Data\RegionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\RegionExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Info.php b/app/code/Magento/Customer/Block/Account/Dashboard/Info.php index 26cf7b0f6fc2b278202b2246d015009100b2abde..8244f9f253ab3e92ed44cea29e148835c702ff79 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Info.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Info.php @@ -84,7 +84,7 @@ class Info extends \Magento\Framework\View\Element\Template */ public function getChangePasswordUrl() { - return $this->_urlBuilder->getUrl('*/account/edit/changepass/1'); + return $this->_urlBuilder->getUrl('customer/account/edit/changepass/1'); } /** @@ -133,4 +133,12 @@ class Info extends \Magento\Framework\View\Element\Template { return $this->_subscriberFactory->create(); } + + /** + * @return string + */ + protected function _toHtml() + { + return $this->currentCustomer->getCustomerId() ? parent::_toHtml() : ''; + } } diff --git a/app/code/Magento/Customer/Block/Account/Link.php b/app/code/Magento/Customer/Block/Account/Link.php index e6d3898b4836b2eca372b850665ef4b682cabc96..ae7f7b6831bdc099efa3fc377bee629bb989163e 100644 --- a/app/code/Magento/Customer/Block/Account/Link.php +++ b/app/code/Magento/Customer/Block/Account/Link.php @@ -29,7 +29,6 @@ class Link extends \Magento\Framework\View\Element\Html\Link ) { $this->_customerUrl = $customerUrl; parent::__construct($context, $data); - $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Account/RegisterLink.php b/app/code/Magento/Customer/Block/Account/RegisterLink.php index a286b05fb17d8f2395f65f0d2825242f184b1b4d..a9496c3c4784c4f1f5434680a93b2c990d18099c 100644 --- a/app/code/Magento/Customer/Block/Account/RegisterLink.php +++ b/app/code/Magento/Customer/Block/Account/RegisterLink.php @@ -49,7 +49,6 @@ class RegisterLink extends \Magento\Framework\View\Element\Html\Link $this->httpContext = $httpContext; $this->_registration = $registration; $this->_customerUrl = $customerUrl; - $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Address/Edit.php b/app/code/Magento/Customer/Block/Address/Edit.php index d66cd086e5590ff5174a4ef1fbb48366246e9d38..cd0076a93ebfeb9638f4ba990505f83fee885795 100644 --- a/app/code/Magento/Customer/Block/Address/Edit.php +++ b/app/code/Magento/Customer/Block/Address/Edit.php @@ -135,7 +135,11 @@ class Edit extends \Magento\Directory\Block\Data 'region' => $postedData['region'], ]; } - $this->dataObjectHelper->populateWithArray($this->_address, $postedData); + $this->dataObjectHelper->populateWithArray( + $this->_address, + $postedData, + '\Magento\Customer\Api\Data\AddressInterface' + ); } return $this; diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index eff04d6e3d725842551df57e3d37b86db0a0bff1..1db7f1964955a8e524eba4c4125aefb9beae7e33 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -47,7 +47,7 @@ class DefaultRenderer extends AbstractBlock implements RendererInterface * * @param \Magento\Framework\View\Element\Context $context * @param ElementFactory $elementFactory - * @param \Magento\Directory\Model\CountryFactory $countryFactory , + * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Customer\Api\AddressMetadataInterface $metadataService * @param Mapper $addressMapper * @param array $data diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php index 090b8d358e0cec305e55c81c1003dfa396259e4c..c7d7bafa60bb60e9c77e6a181e73b8ea23df14d5 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Account.php @@ -245,7 +245,11 @@ class Account extends GenericMetadata $customerData = $this->_backendSession->getCustomerData(); $accountData = isset($customerData['account']) ? $customerData['account'] : []; $this->_customerDataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($this->_customerDataObject, $accountData); + $this->dataObjectHelper->populateWithArray( + $this->_customerDataObject, + $accountData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); } return $this->_customerDataObject; } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php index ecbb711a685f0db625e97e14b9ec5fb3794d4114..d44d33db5673dd215f48ff0f8349243efc55aa23 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Addresses.php @@ -317,12 +317,20 @@ class Addresses extends GenericMetadata } $customerDataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($customerDataObject, $account); + $this->dataObjectHelper->populateWithArray( + $customerDataObject, + $account, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $this->assign('customer', $customerDataObject); $addressCollection = []; foreach ($customerData['address'] as $key => $addressData) { $addressDataObject = $this->addressDataFactory->create(); - $this->dataObjectHelper->populateWithArray($addressDataObject, $addressData); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $addressData, + '\Magento\Customer\Api\Data\AddressInterface' + ); $addressCollection[$key] = $addressDataObject; } $this->assign('addressCollection', $addressCollection); diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php index 1d02cf14c5600c204d6fcc9a7cdca5fc87443480..092fe5c4c487e3bd5690bd533445e7ffd9b7658c 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Carts.php @@ -87,7 +87,8 @@ class Carts extends \Magento\Backend\Block\Template $customerDataObject = $this->customerDataFactory->create(); $this->dataObjectHelper->populateWithArray( $customerDataObject, - $this->_backendSession->getCustomerData()['account'] + $this->_backendSession->getCustomerData()['account'], + '\Magento\Customer\Api\Data\CustomerInterface' ); return $customerDataObject; } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php index 891ba0e5fcad0cfd8153c0600ed705583a5b92a6..dfd4fcce3fd7b34aad809a63f249975896741d9a 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php @@ -7,43 +7,76 @@ namespace Magento\Customer\Block\Adminhtml\Edit\Tab\View; use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Controller\RegistryConstants; -use Magento\Customer\Model\AccountManagement; use Magento\Customer\Model\Address\Mapper; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Stdlib\DateTime\TimezoneInterface; /** - * Adminhtml customer view personal information sales block + * Adminhtml customer view personal information sales block. + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class PersonalInfo extends \Magento\Backend\Block\Template { /** + * Interval in minutes that shows how long customer will be marked 'Online' + * since his last activity. Used only if it's impossible to get such setting + * from configuration. + */ + const DEFAULT_ONLINE_MINUTES_INTERVAL = 15; + + /** + * Customer + * * @var \Magento\Customer\Api\Data\CustomerInterface */ protected $customer; /** + * Customer log + * + * @var \Magento\Customer\Model\Log + */ + protected $customerLog; + + /** + * Customer logger + * + * @var \Magento\Customer\Model\Logger + */ + protected $customerLogger; + + /** + * Account management + * * @var AccountManagementInterface */ protected $accountManagement; /** + * Customer group repository + * * @var \Magento\Customer\Api\GroupRepositoryInterface */ protected $groupRepository; /** + * Customer data factory + * * @var \Magento\Customer\Api\Data\CustomerInterfaceFactory */ protected $customerDataFactory; /** + * Address helper + * * @var \Magento\Customer\Helper\Address */ protected $addressHelper; /** + * Date time + * * @var \Magento\Framework\Stdlib\DateTime */ protected $dateTime; @@ -56,11 +89,15 @@ class PersonalInfo extends \Magento\Backend\Block\Template protected $coreRegistry; /** + * Address mapper + * * @var Mapper */ protected $addressMapper; /** + * Data object helper + * * @var \Magento\Framework\Api\DataObjectHelper */ protected $dataObjectHelper; @@ -75,6 +112,7 @@ class PersonalInfo extends \Magento\Backend\Block\Template * @param \Magento\Framework\Registry $registry * @param Mapper $addressMapper * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper + * @param \Magento\Customer\Model\Logger $customerLogger * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -88,6 +126,7 @@ class PersonalInfo extends \Magento\Backend\Block\Template \Magento\Framework\Registry $registry, Mapper $addressMapper, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, + \Magento\Customer\Model\Logger $customerLogger, array $data = [] ) { $this->coreRegistry = $registry; @@ -98,10 +137,14 @@ class PersonalInfo extends \Magento\Backend\Block\Template $this->dateTime = $dateTime; $this->addressMapper = $addressMapper; $this->dataObjectHelper = $dataObjectHelper; + $this->customerLogger = $customerLogger; + parent::__construct($context, $data); } /** + * Retrieve customer object + * * @return \Magento\Customer\Api\Data\CustomerInterface */ public function getCustomer() @@ -110,13 +153,16 @@ class PersonalInfo extends \Magento\Backend\Block\Template $this->customer = $this->customerDataFactory->create(); $this->dataObjectHelper->populateWithArray( $this->customer, - $this->_backendSession->getCustomerData()['account'] + $this->_backendSession->getCustomerData()['account'], + '\Magento\Customer\Api\Data\CustomerInterface' ); } return $this->customer; } /** + * Retrieve customer id + * * @return string|null */ public function getCustomerId() @@ -124,6 +170,22 @@ class PersonalInfo extends \Magento\Backend\Block\Template return $this->coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); } + /** + * Retrieves customer log model + * + * @return \Magento\Customer\Model\Log + */ + protected function getCustomerLog() + { + if (!$this->customerLog) { + $this->customerLog = $this->customerLogger->get( + $this->getCustomer()->getId() + ); + } + + return $this->customerLog; + } + /** * Returns customer's created date in the assigned store * @@ -142,6 +204,8 @@ class PersonalInfo extends \Magento\Backend\Block\Template } /** + * Retrieve store default timezone from configuration + * * @return string */ public function getStoreCreateDateTimezone() @@ -168,6 +232,8 @@ class PersonalInfo extends \Magento\Backend\Block\Template } /** + * Check if account is confirmed + * * @return \Magento\Framework\Phrase */ public function getIsConfirmedStatus() @@ -185,6 +251,8 @@ class PersonalInfo extends \Magento\Backend\Block\Template } /** + * Retrieve store + * * @return null|string */ public function getCreatedInStore() @@ -195,6 +263,8 @@ class PersonalInfo extends \Magento\Backend\Block\Template } /** + * Retrieve billing address html + * * @return \Magento\Framework\Phrase|string */ public function getBillingAddressHtml() @@ -217,6 +287,8 @@ class PersonalInfo extends \Magento\Backend\Block\Template } /** + * Retrieve group name + * * @return string|null */ public function getGroupName() @@ -232,6 +304,8 @@ class PersonalInfo extends \Magento\Backend\Block\Template } /** + * Retrieve customer group by id + * * @param int $groupId * @return \Magento\Customer\Api\Data\GroupInterface|null */ @@ -244,4 +318,106 @@ class PersonalInfo extends \Magento\Backend\Block\Template } return $group; } + + /** + * Returns timezone of the store to which customer assigned. + * + * @return string + */ + public function getStoreLastLoginDateTimezone() + { + return $this->_scopeConfig->getValue( + $this->_localeDate->getDefaultTimezonePath(), + \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + $this->getCustomer()->getStoreId() + ); + } + + /** + * Get customer's current status. + * + * Customer considered 'Offline' in the next cases: + * + * - customer has never been logged in; + * - customer clicked 'Log Out' link\button; + * - predefined interval has passed since customer's last activity. + * + * In all other cases customer considered 'Online'. + * + * @return \Magento\Framework\Phrase + */ + public function getCurrentStatus() + { + $lastLoginTime = $this->getCustomerLog()->getLastLoginAt(); + + // Customer has never been logged in. + if (!$lastLoginTime) { + return __('Offline'); + } + + $lastLogoutTime = $this->getCustomerLog()->getLastLogoutAt(); + + // Customer clicked 'Log Out' link\button. + if ($lastLogoutTime && strtotime($lastLogoutTime) > strtotime($lastLoginTime)) { + return __('Offline'); + } + + // Predefined interval has passed since customer's last activity. + $interval = $this->getOnlineMinutesInterval(); + $currentTimestamp = (new \DateTime())->getTimestamp(); + $lastVisitTime = $this->getCustomerLog()->getLastVisitAt(); + + if ($lastVisitTime && $currentTimestamp - strtotime($lastVisitTime) > $interval * 60) { + return __('Offline'); + } + + return __('Online'); + } + + /** + * Get customer last login date. + * + * @return \Magento\Framework\Phrase|string + */ + public function getLastLoginDate() + { + $date = $this->getCustomerLog()->getLastLoginAt(); + + if ($date) { + return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true); + } + + return __('Never'); + } + + /** + * Returns customer last login date in store's timezone. + * + * @return \Magento\Framework\Phrase|string + */ + public function getStoreLastLoginDate() + { + $date = strtotime($this->getCustomerLog()->getLastLoginAt()); + + if ($date) { + $date = $this->_localeDate->scopeDate($this->getCustomer()->getStoreId(), $date, true); + return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true); + } + + return __('Never'); + } + + /** + * Returns interval that shows how long customer will be considered 'Online'. + * + * @return int Interval in minutes + */ + protected function getOnlineMinutesInterval() + { + $configValue = $this->_scopeConfig->getValue( + 'customer/online_customers/online_minutes_interval', + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + return intval($configValue) > 0 ? intval($configValue) : self::DEFAULT_ONLINE_MINUTES_INTERVAL; + } } diff --git a/app/code/Magento/Customer/Block/Form/Login.php b/app/code/Magento/Customer/Block/Form/Login.php index cd10974d943c75e37b5659be9e51a95ec6be6d87..256b49c9e931d19ce47957bccc1320830f19764e 100644 --- a/app/code/Magento/Customer/Block/Form/Login.php +++ b/app/code/Magento/Customer/Block/Form/Login.php @@ -27,53 +27,22 @@ class Login extends \Magento\Framework\View\Element\Template */ protected $_customerUrl; - /** - * Checkout data - * - * @var \Magento\Checkout\Helper\Data - */ - protected $checkoutData; - - /** - * Core url - * - * @var \Magento\Framework\Url\Helper\Data - */ - protected $coreUrl; - - /** - * Registration - * - * @var \Magento\Customer\Model\Registration - */ - protected $registration; - /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Customer\Model\Registration $registration * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\Url $customerUrl - * @param \Magento\Checkout\Helper\Data $checkoutData - * @param \Magento\Framework\Url\Helper\Data $coreUrl * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Customer\Model\Registration $registration, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Url $customerUrl, - \Magento\Checkout\Helper\Data $checkoutData, - \Magento\Framework\Url\Helper\Data $coreUrl, array $data = [] ) { - $this->registration = $registration; - $this->_customerUrl = $customerUrl; - $this->_customerSession = $customerSession; - $this->checkoutData = $checkoutData; - $this->coreUrl = $coreUrl; - parent::__construct($context, $data); $this->_isScopePrivate = true; + $this->_customerUrl = $customerUrl; + $this->_customerSession = $customerSession; } /** @@ -85,16 +54,6 @@ class Login extends \Magento\Framework\View\Element\Template return parent::_prepareLayout(); } - /** - * Return registration - * - * @return \Magento\Customer\Model\Registration - */ - public function getRegistration() - { - return $this->registration; - } - /** * Retrieve form posting url * @@ -105,23 +64,6 @@ class Login extends \Magento\Framework\View\Element\Template return $this->_customerUrl->getLoginPostUrl(); } - /** - * Retrieve create new account url - * - * @return string - */ - public function getCreateAccountUrl() - { - $url = $this->getData('create_account_url'); - if (is_null($url)) { - $url = $this->_customerUrl->getRegisterUrl(); - } - if ($this->checkoutData->isContextCheckout()) { - $url = $this->coreUrl->addRequestParam($url, ['context' => 'checkout']); - } - return $url; - } - /** * Retrieve password forgotten url * diff --git a/app/code/Magento/Customer/Block/Form/Login/Info.php b/app/code/Magento/Customer/Block/Form/Login/Info.php new file mode 100644 index 0000000000000000000000000000000000000000..1cfb3afac43663e0c0caabdc06a8c6450ff6480c --- /dev/null +++ b/app/code/Magento/Customer/Block/Form/Login/Info.php @@ -0,0 +1,88 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Block\Form\Login; + +/** + * Customer login info block + */ +class Info extends \Magento\Framework\View\Element\Template +{ + /** + * @var \Magento\Customer\Model\Url + */ + protected $_customerUrl; + + /** + * Checkout data + * + * @var \Magento\Checkout\Helper\Data + */ + protected $checkoutData; + + /** + * Core url + * + * @var \Magento\Framework\Url\Helper\Data + */ + protected $coreUrl; + + /** + * Registration + * + * @var \Magento\Customer\Model\Registration + */ + protected $registration; + + /** + * @param \Magento\Framework\View\Element\Template\Context $context + * @param \Magento\Customer\Model\Registration $registration + * @param \Magento\Customer\Model\Url $customerUrl + * @param \Magento\Checkout\Helper\Data $checkoutData + * @param \Magento\Framework\Url\Helper\Data $coreUrl + * @param array $data + */ + public function __construct( + \Magento\Framework\View\Element\Template\Context $context, + \Magento\Customer\Model\Registration $registration, + \Magento\Customer\Model\Url $customerUrl, + \Magento\Checkout\Helper\Data $checkoutData, + \Magento\Framework\Url\Helper\Data $coreUrl, + array $data = [] + ) { + parent::__construct($context, $data); + $this->registration = $registration; + $this->_customerUrl = $customerUrl; + $this->checkoutData = $checkoutData; + $this->coreUrl = $coreUrl; + } + + /** + * Return registration + * + * @return \Magento\Customer\Model\Registration + */ + public function getRegistration() + { + return $this->registration; + } + + /** + * Retrieve create new account url + * + * @return string + */ + public function getCreateAccountUrl() + { + $url = $this->getData('create_account_url'); + if (is_null($url)) { + $url = $this->_customerUrl->getRegisterUrl(); + } + if ($this->checkoutData->isContextCheckout()) { + $url = $this->coreUrl->addRequestParam($url, ['context' => 'checkout']); + } + return $url; + } +} diff --git a/app/code/Magento/Customer/Controller/Account/CreatePost.php b/app/code/Magento/Customer/Controller/Account/CreatePost.php index f9eb6b26b800301e93ff364ded353a685eb2e4cc..55d7bf4c4a11535abe6f9220af2a3f69e68b3b6e 100644 --- a/app/code/Magento/Customer/Controller/Account/CreatePost.php +++ b/app/code/Magento/Customer/Controller/Account/CreatePost.php @@ -179,7 +179,11 @@ class CreatePost extends \Magento\Customer\Controller\Account } } $addressDataObject = $this->addressDataFactory->create(); - $this->dataObjectHelper->populateWithArray($addressDataObject, $addressData); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $addressData, + '\Magento\Customer\Api\Data\AddressInterface' + ); $addressDataObject->setRegion($regionDataObject); $addressDataObject->setIsDefaultBilling( diff --git a/app/code/Magento/Customer/Controller/Account/Edit.php b/app/code/Magento/Customer/Controller/Account/Edit.php index ca761f1b11ec4e24519f1ebc98588e5ae9ac10ee..b4de05f17140b8be1acb91b7fc070fe38400c0e7 100644 --- a/app/code/Magento/Customer/Controller/Account/Edit.php +++ b/app/code/Magento/Customer/Controller/Account/Edit.php @@ -62,7 +62,11 @@ class Edit extends \Magento\Customer\Controller\Account $customerId = $this->_getSession()->getCustomerId(); $customerDataObject = $this->customerRepository->getById($customerId); if (!empty($data)) { - $this->dataObjectHelper->populateWithArray($customerDataObject, $data); + $this->dataObjectHelper->populateWithArray( + $customerDataObject, + $data, + '\Magento\Customer\Api\Data\CustomerInterface' + ); } $this->_getSession()->setCustomerData($customerDataObject); $this->_getSession()->setChangePassword($this->getRequest()->getParam('changepass') == 1); diff --git a/app/code/Magento/Customer/Controller/Address/FormPost.php b/app/code/Magento/Customer/Controller/Address/FormPost.php index 7e2c46aa164c083cb39cd960130c029e0d89d099..86af07c52935b87ffde0dbac2cf428896b9c693b 100644 --- a/app/code/Magento/Customer/Controller/Address/FormPost.php +++ b/app/code/Magento/Customer/Controller/Address/FormPost.php @@ -46,7 +46,11 @@ class FormPost extends \Magento\Customer\Controller\Address ]; $region = $this->regionDataFactory->create(); - $this->dataObjectHelper->populateWithArray($region, $regionData); + $this->dataObjectHelper->populateWithArray( + $region, + $regionData, + '\Magento\Customer\Api\Data\RegionInterface' + ); unset($attributeValues['region'], $attributeValues['region_id']); $attributeValues['region'] = $region; @@ -54,7 +58,8 @@ class FormPost extends \Magento\Customer\Controller\Address $addressDataObject = $this->addressDataFactory->create(); $this->dataObjectHelper->populateWithArray( $addressDataObject, - array_merge($existingAddressData, $attributeValues) + array_merge($existingAddressData, $attributeValues), + '\Magento\Customer\Api\Data\AddressInterface' ); $addressDataObject->setCustomerId($this->_getSession()->getCustomerId()) ->setRegion($region) diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php index 2949af84dbcc902bbb8999a9130715ba4f62c791..cc024c507011aa41f6258ff83748fd9e06840e61 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Edit.php @@ -73,7 +73,11 @@ class Edit extends \Magento\Customer\Controller\Adminhtml\Index $formData = $customerForm->extractData($request, 'account'); $customerData['account'] = $customerForm->restoreData($formData); $customer = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($customer, $customerData['account']); + $this->dataObjectHelper->populateWithArray( + $customer, + $customerData['account'], + '\Magento\Customer\Api\Data\CustomerInterface' + ); } if (isset($data['address']) && is_array($data['address'])) { diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php index 269c29e076bf6d546ea10474d18fd7c3b09e86d7..3c2b02d7a7f06dd356600bb33420202d3792fec6 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php @@ -196,7 +196,11 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index $customerData['id'] = $customerId; } - $this->dataObjectHelper->populateWithArray($customer, $customerData); + $this->dataObjectHelper->populateWithArray( + $customer, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $addresses = []; foreach ($addressesData as $addressData) { $region = isset($addressData['region']) ? $addressData['region'] : null; @@ -206,7 +210,11 @@ class Save extends \Magento\Customer\Controller\Adminhtml\Index 'region_id' => $regionId, ]; $addressDataObject = $this->addressDataFactory->create(); - $this->dataObjectHelper->populateWithArray($addressDataObject, $addressData); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $addressData, + '\Magento\Customer\Api\Data\AddressInterface' + ); $addresses[] = $addressDataObject; } diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php index a053e798ece1008e7b2ce15519c6effcd81ac25a..3f925ba579e8f9c72a271b03677ee49d7fd2626f 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Validate.php @@ -43,7 +43,11 @@ class Validate extends \Magento\Customer\Controller\Adminhtml\Index unset($data['website_id']); } - $this->dataObjectHelper->populateWithArray($customer, $data); + $this->dataObjectHelper->populateWithArray( + $customer, + $data, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $errors = $this->customerAccountManagement->validate($customer); } catch (\Magento\Framework\Validator\ValidatorException $exception) { /* @var $error Error */ diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index 7fb85ee1caf5ab41cce6309d8843ccacd43f070b..1b9c851c5c3ef0bbb8610ebfb5265bef1b1eeb60 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -30,7 +30,7 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\State\ExpiredException; use Magento\Framework\Exception\State\InputMismatchException; use Magento\Framework\Exception\State\InvalidTransitionException; -use Psr\Log\LoggerInterface as Logger; +use Psr\Log\LoggerInterface as PsrLogger; use Magento\Framework\Mail\Exception as MailException; use Magento\Framework\Mail\Template\TransportBuilder; use Magento\Framework\Math\Random; @@ -132,7 +132,7 @@ class AccountManagement implements AccountManagementInterface private $url; /** - * @var Logger + * @var PsrLogger */ protected $logger; @@ -215,7 +215,7 @@ class AccountManagement implements AccountManagementInterface * @param CustomerMetadataInterface $customerMetadataService * @param CustomerRegistry $customerRegistry * @param \Magento\Framework\Url $url - * @param Logger $logger + * @param PsrLogger $logger * @param Encryptor $encryptor * @param ConfigShare $configShare * @param StringHelper $stringHelper @@ -243,7 +243,7 @@ class AccountManagement implements AccountManagementInterface CustomerMetadataInterface $customerMetadataService, CustomerRegistry $customerRegistry, \Magento\Framework\Url $url, - Logger $logger, + PsrLogger $logger, Encryptor $encryptor, ConfigShare $configShare, StringHelper $stringHelper, diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php index 3aa89244fbefdb7886e674cd7e021a5d4575b984..9a66ec376f5641136eb146ddd9aae9ba66249013 100644 --- a/app/code/Magento/Customer/Model/Address.php +++ b/app/code/Magento/Customer/Model/Address.php @@ -9,7 +9,6 @@ use Magento\Customer\Api\AddressMetadataInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\RegionInterfaceFactory; -use Magento\Framework\Api\AttributeValueFactory; /** * Customer address model @@ -45,14 +44,14 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Eav\Model\Config $eavConfig * @param Address\Config $addressConfig * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param AddressMetadataInterface $addressMetadataService + * @param AddressMetadataInterface $metadataService * @param AddressInterfaceFactory $addressDataFactory * @param RegionInterfaceFactory $regionDataFactory * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper @@ -66,14 +65,14 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Directory\Helper\Data $directoryData, \Magento\Eav\Model\Config $eavConfig, \Magento\Customer\Model\Address\Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - AddressMetadataInterface $addressMetadataService, + AddressMetadataInterface $metadataService, AddressInterfaceFactory $addressDataFactory, RegionInterfaceFactory $regionDataFactory, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, @@ -88,14 +87,14 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $directoryData, $eavConfig, $addressConfig, $regionFactory, $countryFactory, - $addressMetadataService, + $metadataService, $addressDataFactory, $regionDataFactory, $dataObjectHelper, diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 8b11022ba92c115e052f3ca0b99ddb28337fa0a0..d6be608bea7a70cb267c91f215523f9e5d2a691a 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -12,7 +12,7 @@ use Magento\Customer\Api\Data\AddressInterface; use Magento\Customer\Api\Data\RegionInterfaceFactory; use Magento\Customer\Api\Data\RegionInterface; use Magento\Customer\Model\Data\Address as AddressData; -use Magento\Framework\Api\AttributeValueFactory; +use Magento\Framework\Model\AbstractExtensibleModel; /** * Address abstract model @@ -29,7 +29,7 @@ use Magento\Framework\Api\AttributeValueFactory; * @method bool getShouldIgnoreValidation() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class AbstractAddress extends \Magento\Framework\Model\AbstractExtensibleModel +class AbstractAddress extends AbstractExtensibleModel { /** * Possible customer address types @@ -96,7 +96,7 @@ class AbstractAddress extends \Magento\Framework\Model\AbstractExtensibleModel /** * @var AddressMetadataInterface */ - protected $_addressMetadataService; + protected $metadataService; /** * @var AddressInterfaceFactory @@ -116,14 +116,14 @@ class AbstractAddress extends \Magento\Framework\Model\AbstractExtensibleModel /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Eav\Model\Config $eavConfig * @param Config $addressConfig * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param AddressMetadataInterface $addressMetadataService + * @param AddressMetadataInterface $metadataService * @param AddressInterfaceFactory $addressDataFactory * @param RegionInterfaceFactory $regionDataFactory * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper @@ -135,14 +135,14 @@ class AbstractAddress extends \Magento\Framework\Model\AbstractExtensibleModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Directory\Helper\Data $directoryData, \Magento\Eav\Model\Config $eavConfig, Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - AddressMetadataInterface $addressMetadataService, + AddressMetadataInterface $metadataService, AddressInterfaceFactory $addressDataFactory, RegionInterfaceFactory $regionDataFactory, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, @@ -156,14 +156,14 @@ class AbstractAddress extends \Magento\Framework\Model\AbstractExtensibleModel $this->_addressConfig = $addressConfig; $this->_regionFactory = $regionFactory; $this->_countryFactory = $countryFactory; - $this->_addressMetadataService = $addressMetadataService; + $this->metadataService = $metadataService; $this->addressDataFactory = $addressDataFactory; $this->regionDataFactory = $regionDataFactory; $this->dataObjectHelper = $dataObjectHelper; parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -488,7 +488,7 @@ class AbstractAddress extends \Magento\Framework\Model\AbstractExtensibleModel { $addressId = $this->getId(); - $attributes = $this->_addressMetadataService->getAllAttributesMetadata(); + $attributes = $this->metadataService->getAllAttributesMetadata(); $addressData = []; foreach ($attributes as $attribute) { $code = $attribute->getAttributeCode(); @@ -510,7 +510,11 @@ class AbstractAddress extends \Magento\Framework\Model\AbstractExtensibleModel $addressData[AddressData::REGION] = $region; $addressDataObject = $this->addressDataFactory->create(); - $this->dataObjectHelper->populateWithArray($addressDataObject, $addressData); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $addressData, + '\Magento\Customer\Api\Data\AddressInterface' + ); if ($addressId) { $addressDataObject->setId($addressId); } diff --git a/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php b/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php index dfab0a4e277e5280e96c0e2a3df6209393b7682b..247ce01208341bebd1dfbbe7088034771a0be672 100644 --- a/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php +++ b/app/code/Magento/Customer/Model/Attribute/Data/Postcode.php @@ -9,7 +9,7 @@ use Magento\Directory\Helper\Data as DirectoryHelper; use Magento\Eav\Model\AttributeDataFactory; use Magento\Framework\App\RequestInterface; use Magento\Framework\Locale\ResolverInterface; -use Psr\Log\LoggerInterface as Logger; +use Psr\Log\LoggerInterface as PsrLogger; use Magento\Framework\Stdlib\DateTime\TimezoneInterface as MagentoTimezone; /** @@ -25,13 +25,13 @@ class Postcode extends \Magento\Eav\Model\Attribute\Data\AbstractData /** * @param MagentoTimezone $localeDate - * @param Logger $logger + * @param PsrLogger $logger * @param ResolverInterface $localeResolver * @param DirectoryHelper $directoryHelper */ public function __construct( MagentoTimezone $localeDate, - Logger $logger, + PsrLogger $logger, ResolverInterface $localeResolver, DirectoryHelper $directoryHelper ) { @@ -108,6 +108,7 @@ class Postcode extends \Magento\Eav\Model\Attribute\Data\AbstractData * * @param string $format * @return string|array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function outputValue($format = AttributeDataFactory::OUTPUT_FORMAT_TEXT) { diff --git a/app/code/Magento/Customer/Model/AttributeMetadataConverter.php b/app/code/Magento/Customer/Model/AttributeMetadataConverter.php index d27f4657c1c1745735dbdbb2c39ec51625bee2b3..a9fc1eb30fd224344967d1f18245ef37a3d14116 100644 --- a/app/code/Magento/Customer/Model/AttributeMetadataConverter.php +++ b/app/code/Magento/Customer/Model/AttributeMetadataConverter.php @@ -71,7 +71,11 @@ class AttributeMetadataConverter $optionArray = []; foreach ($option['value'] as $optionArrayValues) { $optionObject = $this->optionFactory->create(); - $this->dataObjectHelper->populateWithArray($optionObject, $optionArrayValues); + $this->dataObjectHelper->populateWithArray( + $optionObject, + $optionArrayValues, + '\Magento\Customer\Api\Data\OptionInterface' + ); $optionArray[] = $optionObject; } $optionDataObject->setOptions($optionArray); diff --git a/app/code/Magento/Customer/Model/AttributeMetadataDataBuilder.php b/app/code/Magento/Customer/Model/AttributeMetadataDataBuilder.php deleted file mode 100644 index cf08de198532abb741be9c6fa8f79f59cb1c4ee2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Customer/Model/AttributeMetadataDataBuilder.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Customer\Model; - -use Magento\Framework\Api\AttributeMetadataBuilderInterface; - -/** - * DataBuilder class for \Magento\Customer\Api\Data\AttributeMetadataInterface - */ -class AttributeMetadataDataBuilder extends \Magento\Framework\Api\Builder implements AttributeMetadataBuilderInterface -{ - /** - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode) - { - $this->_set('attribute_code', $attributeCode); - return $this; - } - - /** - * @param string $frontendInput - * @return $this - */ - public function setFrontendInput($frontendInput) - { - $this->_set('frontend_input', $frontendInput); - return $this; - } - - /** - * @param string $inputFilter - * @return $this - */ - public function setInputFilter($inputFilter) - { - $this->_set('input_filter', $inputFilter); - return $this; - } - - /** - * @param string $storeLabel - * @return $this - */ - public function setStoreLabel($storeLabel) - { - $this->_set('store_label', $storeLabel); - return $this; - } - - /** - * @param \Magento\Customer\Api\Data\ValidationRuleInterface[] $validationRules - * @return $this - */ - public function setValidationRules($validationRules) - { - $this->_set('validation_rules', $validationRules); - return $this; - } - - /** - * @param int $multilineCount - * @return $this - */ - public function setMultilineCount($multilineCount) - { - $this->_set('multiline_count', $multilineCount); - return $this; - } - - /** - * @param bool $visible - * @return $this - */ - public function setVisible($visible) - { - $this->_set('visible', $visible); - return $this; - } - - /** - * @param bool $required - * @return $this - */ - public function setRequired($required) - { - $this->_set('required', $required); - return $this; - } - - /** - * @param string $dataModel - * @return $this - */ - public function setDataModel($dataModel) - { - $this->_set('data_model', $dataModel); - return $this; - } - - /** - * @param \Magento\Customer\Api\Data\OptionInterface[] $options - * @return $this - */ - public function setOptions($options) - { - $this->_set('options', $options); - return $this; - } - - /** - * @param string $frontendClass - * @return $this - */ - public function setFrontendClass($frontendClass) - { - $this->_set('frontend_class', $frontendClass); - return $this; - } - - /** - * @param bool $userDefined - * @return $this - */ - public function setUserDefined($userDefined) - { - $this->_set('user_defined', $userDefined); - return $this; - } - - /** - * @param int $sortOrder - * @return $this - */ - public function setSortOrder($sortOrder) - { - $this->_set('sort_order', $sortOrder); - return $this; - } - - /** - * @param string $frontendLabel - * @return $this - */ - public function setFrontendLabel($frontendLabel) - { - $this->_set('frontend_label', $frontendLabel); - return $this; - } - - /** - * @param string $note - * @return $this - */ - public function setNote($note) - { - $this->_set('note', $note); - return $this; - } - - /** - * @param bool $system - * @return $this - */ - public function setSystem($system) - { - $this->_set('system', $system); - return $this; - } - - /** - * @param string $backendType - * @return $this - */ - public function setBackendType($backendType) - { - $this->_set('backend_type', $backendType); - return $this; - } - - /** - * Initialize the builder - * - * @param \Magento\Framework\Api\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string|null $modelClassInterface - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function __construct( - \Magento\Framework\Api\ObjectFactory $objectFactory, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = null - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - 'Magento\Customer\Api\Data\AttributeMetadataInterface' - ); - } -} diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 49917e246c52a0f90991a8d4e5c27897a9ee9f04..cefc5f867f66f30274cbf6007f18d13856189979 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -13,7 +13,6 @@ use Magento\Customer\Model\Resource\Customer as ResourceCustomer; use Magento\Customer\Api\Data\CustomerInterfaceFactory; use Magento\Customer\Model\Data\Customer as CustomerData; use Magento\Framework\Reflection\DataObjectProcessor; -use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Exception\EmailNotConfirmedException; use Magento\Framework\Exception\InvalidEmailOrPasswordException; use Magento\Framework\Exception\AuthenticationException; @@ -39,7 +38,7 @@ use Magento\Framework\Exception\AuthenticationException; * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Customer extends \Magento\Framework\Model\AbstractExtensibleModel +class Customer extends \Magento\Framework\Model\AbstractModel { /** * Configuration paths for email templates and identities @@ -194,18 +193,21 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel */ protected $dataObjectHelper; + /** + * @var \Magento\Customer\Api\CustomerMetadataInterface + */ + protected $metadataService; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Config $config * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param Resource\Customer $resource - * @param Config\Share $configShare + * @param ResourceCustomer $resource + * @param Share $configShare * @param AddressFactory $addressFactory - * @param Resource\Address\CollectionFactory $addressesFactory + * @param CollectionFactory $addressesFactory * @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder * @param GroupRepositoryInterface $groupRepository * @param AttributeFactory $attributeFactory @@ -214,6 +216,7 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel * @param CustomerInterfaceFactory $customerDataFactory * @param DataObjectProcessor $dataObjectProcessor * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper + * @param CustomerMetadataInterface $metadataService * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -221,8 +224,6 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Config $config, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, @@ -237,9 +238,11 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel CustomerInterfaceFactory $customerDataFactory, DataObjectProcessor $dataObjectProcessor, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, + \Magento\Customer\Api\CustomerMetadataInterface $metadataService, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = [] ) { + $this->metadataService = $metadataService; $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->_config = $config; @@ -256,8 +259,6 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel parent::__construct( $context, $registry, - $metadataService, - $customAttributeFactory, $resource, $resourceCollection, $data @@ -288,7 +289,11 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel $addressesData[] = $address->getDataModel(); } $customerDataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($customerDataObject, $customerData); + $this->dataObjectHelper->populateWithArray( + $customerDataObject, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $customerDataObject->setAddresses($addressesData) ->setId($this->getId()); return $customerDataObject; @@ -414,11 +419,19 @@ class Customer extends \Magento\Framework\Model\AbstractExtensibleModel $customerData = (array)$this->getData(); $customerData[CustomerData::ID] = $this->getId(); $dataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($dataObject, $customerData); + $this->dataObjectHelper->populateWithArray( + $dataObject, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $customerOrigData = (array)$this->getOrigData(); $customerOrigData[CustomerData::ID] = $this->getId(); $origDataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($origDataObject, $customerOrigData); + $this->dataObjectHelper->populateWithArray( + $origDataObject, + $customerOrigData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $this->_eventManager->dispatch( 'customer_save_after_data_object', ['customer_data_object' => $dataObject, 'orig_customer_data_object' => $origDataObject] diff --git a/app/code/Magento/Customer/Model/CustomerExtractor.php b/app/code/Magento/Customer/Model/CustomerExtractor.php index 7e16f8359a27992368d06f8a4c8a7ebc7951e464..bc2880babd4cdf2302956a90fa8126c7971d0854 100644 --- a/app/code/Magento/Customer/Model/CustomerExtractor.php +++ b/app/code/Magento/Customer/Model/CustomerExtractor.php @@ -77,7 +77,11 @@ class CustomerExtractor $customerData[$attributeCode] = $request->getParam($attributeCode); } $customerDataObject = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray($customerDataObject, $customerData); + $this->dataObjectHelper->populateWithArray( + $customerDataObject, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $store = $this->storeManager->getStore(); if ($isGroupIdEmpty) { $customerDataObject->setGroupId( diff --git a/app/code/Magento/Customer/Model/Data/Address.php b/app/code/Magento/Customer/Model/Data/Address.php index a4785786c8c21bbc0fa720e86646b933acd60ab8..d44fbda0bbba599c71f28e661dd3b65695b8e2ed 100644 --- a/app/code/Magento/Customer/Model/Data/Address.php +++ b/app/code/Magento/Customer/Model/Data/Address.php @@ -10,20 +10,43 @@ namespace Magento\Customer\Model\Data; use Magento\Customer\Api\Data\RegionInterface; use \Magento\Framework\Api\AttributeValueFactory; +/** + * Class Address + * + */ class Address extends \Magento\Framework\Api\AbstractExtensibleObject implements \Magento\Customer\Api\Data\AddressInterface { /** - * @param \Magento\Customer\Api\AddressMetadataInterface $metadataService + * @var \Magento\Customer\Api\AddressMetadataInterface + */ + protected $metadataService; + + /** + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $attributeValueFactory + * @param \Magento\Customer\Api\AddressMetadataInterface $metadataService * @param array $data */ public function __construct( - \Magento\Customer\Api\AddressMetadataInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $attributeValueFactory, + \Magento\Customer\Api\AddressMetadataInterface $metadataService, $data = [] ) { - parent::__construct($metadataService, $attributeValueFactory, $data); + $this->metadataService = $metadataService; + parent::__construct($extensionFactory, $attributeValueFactory, $data); + } + + /** + * {@inheritdoc} + */ + protected function getCustomAttributesCodes() + { + if ($this->customAttributesCodes === null) { + $this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService); + } + return $this->customAttributesCodes; } /** @@ -403,4 +426,25 @@ class Address extends \Magento\Framework\Api\AbstractExtensibleObject implements { return $this->setData(self::DEFAULT_BILLING, $isDefaultBilling); } + + /** + * {@inheritdoc} + * + * @return \Magento\Customer\Api\Data\AddressExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Customer\Api\Data\AddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\AddressExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Customer/Model/Data/AttributeMetadata.php b/app/code/Magento/Customer/Model/Data/AttributeMetadata.php index 5b4010e4ebc408495d91efcd94e870e5c71be4f9..dbf7feb726e23ba71d7bbf9dcef3b79a4433c1d7 100644 --- a/app/code/Magento/Customer/Model/Data/AttributeMetadata.php +++ b/app/code/Magento/Customer/Model/Data/AttributeMetadata.php @@ -9,7 +9,7 @@ namespace Magento\Customer\Model\Data; /** * Customer attribute metadata class. */ -class AttributeMetadata extends \Magento\Framework\Api\AbstractExtensibleObject implements +class AttributeMetadata extends \Magento\Framework\Api\AbstractSimpleObject implements \Magento\Customer\Api\Data\AttributeMetadataInterface { /** diff --git a/app/code/Magento/Customer/Model/Data/Customer.php b/app/code/Magento/Customer/Model/Data/Customer.php index 995bdd421c93383298a0106a70da28b3530b8d8a..4daf096e5ccd15268988e368107e41db8c48dcc2 100644 --- a/app/code/Magento/Customer/Model/Data/Customer.php +++ b/app/code/Magento/Customer/Model/Data/Customer.php @@ -6,23 +6,47 @@ namespace Magento\Customer\Model\Data; -use Magento\Customer\Api\Data\CustomerInterface; use \Magento\Framework\Api\AttributeValueFactory; +/** + * Class Customer + * + */ class Customer extends \Magento\Framework\Api\AbstractExtensibleObject implements \Magento\Customer\Api\Data\CustomerInterface { /** - * @param \Magento\Customer\Api\CustomerMetadataInterface $metadataService + * @var \Magento\Customer\Api\CustomerMetadataInterface + */ + protected $metadataService; + + /** + * Initialize dependencies. + * + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $attributeValueFactory + * @param \Magento\Customer\Api\CustomerMetadataInterface $metadataService * @param array $data */ public function __construct( - \Magento\Customer\Api\CustomerMetadataInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $attributeValueFactory, + \Magento\Customer\Api\CustomerMetadataInterface $metadataService, $data = [] ) { - parent::__construct($metadataService, $attributeValueFactory, $data); + $this->metadataService = $metadataService; + parent::__construct($extensionFactory, $attributeValueFactory, $data); + } + + /** + * {@inheritdoc} + */ + protected function getCustomAttributesCodes() + { + if ($this->customAttributesCodes === null) { + $this->customAttributesCodes = $this->getEavAttributesCodes($this->metadataService); + } + return $this->customAttributesCodes; } /** @@ -421,4 +445,25 @@ class Customer extends \Magento\Framework\Api\AbstractExtensibleObject implement { return $this->setData(self::KEY_ADDRESSES, $addresses); } + + /** + * {@inheritdoc} + * + * @return \Magento\Customer\Api\Data\CustomerExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Customer\Api\Data\CustomerExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\CustomerExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Customer/Model/Data/Group.php b/app/code/Magento/Customer/Model/Data/Group.php index 7f2883670308e7d37231282922a5d306ba661b00..9edc461f982c0a963f6c8aa29c8e391ffd81ef08 100644 --- a/app/code/Magento/Customer/Model/Data/Group.php +++ b/app/code/Magento/Customer/Model/Data/Group.php @@ -95,4 +95,25 @@ class Group extends \Magento\Framework\Api\AbstractExtensibleObject implements { return $this->setData(self::TAX_CLASS_NAME, $taxClassName); } + + /** + * {@inheritdoc} + * + * @return \Magento\Customer\Api\Data\GroupExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Customer\Api\Data\GroupExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\GroupExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Customer/Model/Data/Option.php b/app/code/Magento/Customer/Model/Data/Option.php index 7ebf6893d15136b692a1eb05e5d4049d1f4d97c3..080f9449ca1443555645d06ca7ad4f6d5af0d2a1 100644 --- a/app/code/Magento/Customer/Model/Data/Option.php +++ b/app/code/Magento/Customer/Model/Data/Option.php @@ -11,7 +11,7 @@ namespace Magento\Customer\Model\Data; /** * Class Option */ -class Option extends \Magento\Framework\Api\AbstractExtensibleObject implements +class Option extends \Magento\Framework\Api\AbstractSimpleObject implements \Magento\Customer\Api\Data\OptionInterface { /** diff --git a/app/code/Magento/Customer/Model/Data/Region.php b/app/code/Magento/Customer/Model/Data/Region.php index 42b5a1c944afbca4b58284ebcb1617c40c6af27c..ddea4c3a90ceb1597c497b516cd53a656548c2dd 100644 --- a/app/code/Magento/Customer/Model/Data/Region.php +++ b/app/code/Magento/Customer/Model/Data/Region.php @@ -7,6 +7,7 @@ namespace Magento\Customer\Model\Data; /** * Data Model implementing Address Region interface + * */ class Region extends \Magento\Framework\Api\AbstractExtensibleObject implements \Magento\Customer\Api\Data\RegionInterface @@ -73,4 +74,25 @@ class Region extends \Magento\Framework\Api\AbstractExtensibleObject implements { return $this->setData(self::REGION_ID, $regionId); } + + /** + * {@inheritdoc} + * + * @return \Magento\Customer\Api\Data\RegionExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Customer\Api\Data\RegionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Customer\Api\Data\RegionExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Customer/Model/Data/ValidationResults.php b/app/code/Magento/Customer/Model/Data/ValidationResults.php index 684b451360d4c8be6180ad0e86cf8ef0464a21bc..6c473ed0f167da0aa95aee4f42e8b1044549d595 100644 --- a/app/code/Magento/Customer/Model/Data/ValidationResults.php +++ b/app/code/Magento/Customer/Model/Data/ValidationResults.php @@ -10,7 +10,7 @@ namespace Magento\Customer\Model\Data; /** * Validation results data model. */ -class ValidationResults extends \Magento\Framework\Api\AbstractExtensibleObject implements +class ValidationResults extends \Magento\Framework\Api\AbstractSimpleObject implements \Magento\Customer\Api\Data\ValidationResultsInterface { /** diff --git a/app/code/Magento/Customer/Model/Data/ValidationRule.php b/app/code/Magento/Customer/Model/Data/ValidationRule.php index 5d8234cce281a0439e083e5e1b5d997f2bff6a0f..ce5a4a419a8e2fc962dbb2e7d5df4e4cb52a10cc 100644 --- a/app/code/Magento/Customer/Model/Data/ValidationRule.php +++ b/app/code/Magento/Customer/Model/Data/ValidationRule.php @@ -7,7 +7,7 @@ namespace Magento\Customer\Model\Data; use Magento\Customer\Api\Data\ValidationRuleInterface; -class ValidationRule extends \Magento\Framework\Api\AbstractExtensibleObject implements +class ValidationRule extends \Magento\Framework\Api\AbstractSimpleObject implements \Magento\Customer\Api\Data\ValidationRuleInterface { /** diff --git a/app/code/Magento/Customer/Model/Group.php b/app/code/Magento/Customer/Model/Group.php index 252b62393b6d9c24136fba6bb59990ac982837cf..b11d73f55bfac12c7f9b6f7a28cc271441543e8e 100644 --- a/app/code/Magento/Customer/Model/Group.php +++ b/app/code/Magento/Customer/Model/Group.php @@ -5,8 +5,6 @@ */ namespace Magento\Customer\Model; -use Magento\Framework\Api\AttributeValueFactory; - /** * Customer group model * @@ -17,7 +15,7 @@ use Magento\Framework\Api\AttributeValueFactory; * @method \Magento\Customer\Model\Group setTaxClassId(int $value) * @method Group setTaxClassName(string $value) */ -class Group extends \Magento\Framework\Model\AbstractExtensibleModel +class Group extends \Magento\Framework\Model\AbstractModel { const NOT_LOGGED_IN_ID = 0; @@ -63,8 +61,6 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel * * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Store\Model\StoresConfig $storesConfig * @param \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor * @param \Magento\Tax\Model\ClassModelFactory $classModelFactory @@ -76,8 +72,6 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, \Magento\Store\Model\StoresConfig $storesConfig, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, \Magento\Tax\Model\ClassModelFactory $classModelFactory, @@ -91,8 +85,6 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel parent::__construct( $context, $registry, - $metadataService, - $customAttributeFactory, $resource, $resourceCollection, $data diff --git a/app/code/Magento/Customer/Model/Log.php b/app/code/Magento/Customer/Model/Log.php new file mode 100644 index 0000000000000000000000000000000000000000..2c65bdcb20cc46472e603af03cd819a08b0a675a --- /dev/null +++ b/app/code/Magento/Customer/Model/Log.php @@ -0,0 +1,96 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Model; + +/** + * Customer log model. + * + * Contains customer log data. + */ +class Log +{ + /** + * Customer ID. + * + * @var int + */ + protected $customerId; + + /** + * Date and time of customer's last login. + * + * @var string + */ + protected $lastLoginAt; + + /** + * Date and time of customer's last logout. + * + * @var string + */ + protected $lastVisitAt; + + /** + * Date and time of customer's last visit. + * + * @var string + */ + protected $lastLogoutAt; + + /** + * @param int $customerId + * @param string $lastLoginAt + * @param string $lastVisitAt + * @param string $lastLogoutAt + */ + public function __construct($customerId = null, $lastLoginAt = null, $lastVisitAt = null, $lastLogoutAt = null) + { + $this->customerId = $customerId; + $this->lastLoginAt = $lastLoginAt; + $this->lastVisitAt = $lastVisitAt; + $this->lastLogoutAt = $lastLogoutAt; + } + + /** + * Retrieve customer id + * + * @return int + */ + public function getCustomerId() + { + return $this->customerId; + } + + /** + * Retrieve last login date as string + * + * @return string + */ + public function getLastLoginAt() + { + return $this->lastLoginAt; + } + + /** + * Retrieve last visit date as string + * + * @return string + */ + public function getLastVisitAt() + { + return $this->lastVisitAt; + } + + /** + * Retrieve last logout date as string + * + * @return string + */ + public function getLastLogoutAt() + { + return $this->lastLogoutAt; + } +} diff --git a/app/code/Magento/Customer/Model/Logger.php b/app/code/Magento/Customer/Model/Logger.php new file mode 100644 index 0000000000000000000000000000000000000000..e29ceb3cf0c09c805b8eecbf46a05b1356213e6f --- /dev/null +++ b/app/code/Magento/Customer/Model/Logger.php @@ -0,0 +1,118 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Model; + +/** + * Customer log data logger. + * + * Saves and retrieves customer log data. + */ +class Logger +{ + /** + * Resource instance. + * + * @var \Magento\Framework\App\Resource + */ + protected $resource; + + /** + * @var \Magento\Customer\Model\LogFactory + */ + protected $logFactory; + + /** + * @param \Magento\Framework\App\Resource $resource + * @param \Magento\Customer\Model\LogFactory $logFactory + */ + public function __construct( + \Magento\Framework\App\Resource $resource, + \Magento\Customer\Model\LogFactory $logFactory + ) { + $this->resource = $resource; + $this->logFactory = $logFactory; + } + + /** + * Save (insert new or update existing) log. + * + * @param int $customerId + * @param array $data + * @return $this + * @throws \InvalidArgumentException + */ + public function log($customerId, array $data) + { + $data = array_filter($data); + + if (!$data) { + throw new \InvalidArgumentException("Log data is empty"); + } + + /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */ + $adapter = $this->resource->getConnection('write'); + + $adapter->insertOnDuplicate( + $this->resource->getTableName('customer_log'), + array_merge(['customer_id' => $customerId], $data), + array_keys($data) + ); + + return $this; + } + + /** + * Load log by Customer Id. + * + * @param int $customerId + * @return Log + */ + public function get($customerId = null) + { + $data = (null !== $customerId) ? $this->loadLogData($customerId) : []; + + return $this->logFactory->create( + [ + 'customerId' => isset($data['customer_id']) ? $data['customer_id'] : null, + 'lastLoginAt' => isset($data['last_login_at']) ? $data['last_login_at'] : null, + 'lastLogoutAt' => isset($data['last_logout_at']) ? $data['last_logout_at'] : null, + 'lastVisitAt' => isset($data['last_visit_at']) ? $data['last_visit_at'] : null + ] + ); + } + + /** + * Load customer log data by customer id + * + * @param int $customerId + * @return array + */ + protected function loadLogData($customerId) + { + /** @var \Magento\Framework\DB\Adapter\AdapterInterface $adapter */ + $adapter = $this->resource->getConnection('read'); + + $select = $adapter->select() + ->from( + ['cl' => $this->resource->getTableName('customer_log')] + ) + ->joinLeft( + ['cv' => $this->resource->getTableName('customer_visitor')], + 'cv.customer_id = cl.customer_id', + ['last_visit_at'] + ) + ->where( + 'cl.customer_id = ?', + $customerId + ) + ->order( + 'cv.visitor_id DESC' + ) + ->limit(1); + + return $adapter->fetchRow($select); + } +} diff --git a/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php b/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php index 08a1ea6a1d263ee28d42fe18c79c01b5ea5c4bb3..0095cb509e2ee4c0ae8419327f4d1507961a841f 100644 --- a/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php +++ b/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php @@ -10,7 +10,6 @@ use Magento\Customer\Api\AddressMetadataInterface; use Magento\Customer\Model\AttributeMetadataConverter; use Magento\Customer\Model\AttributeMetadataDataProvider; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; -use Magento\Framework\Api\Config\MetadataConfig; use Magento\Framework\Api\SimpleDataObjectConverter; use Magento\Framework\Exception\NoSuchEntityException; @@ -24,11 +23,6 @@ class AddressMetadata implements AddressMetadataInterface */ private $addressDataObjectMethods; - /** - * @var MetadataConfig - */ - private $metadataConfig; - /** * @var AttributeMetadataConverter */ @@ -40,16 +34,13 @@ class AddressMetadata implements AddressMetadataInterface private $attributeMetadataDataProvider; /** - * @param MetadataConfig $metadataConfig * @param AttributeMetadataConverter $attributeMetadataConverter * @param AttributeMetadataDataProvider $attributeMetadataDataProvider */ public function __construct( - MetadataConfig $metadataConfig, AttributeMetadataConverter $attributeMetadataConverter, AttributeMetadataDataProvider $attributeMetadataDataProvider ) { - $this->metadataConfig = $metadataConfig; $this->attributeMetadataConverter = $attributeMetadataConverter; $this->attributeMetadataDataProvider = $attributeMetadataDataProvider; } @@ -127,7 +118,6 @@ class AddressMetadata implements AddressMetadataInterface */ public function getCustomAttributesMetadata($dataObjectClassName = AddressMetadataInterface::DATA_INTERFACE_NAME) { - $customAttributes = []; if (!$this->addressDataObjectMethods) { $dataObjectMethods = array_flip(get_class_methods($dataObjectClassName)); $baseClassDataObjectMethods = array_flip( @@ -135,6 +125,7 @@ class AddressMetadata implements AddressMetadataInterface ); $this->addressDataObjectMethods = array_diff_key($dataObjectMethods, $baseClassDataObjectMethods); } + $customAttributes = []; foreach ($this->getAllAttributesMetadata() as $attributeMetadata) { $attributeCode = $attributeMetadata->getAttributeCode(); $camelCaseKey = SimpleDataObjectConverter::snakeCaseToUpperCamelCase($attributeCode); @@ -145,6 +136,6 @@ class AddressMetadata implements AddressMetadataInterface $customAttributes[] = $attributeMetadata; } } - return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName)); + return $customAttributes; } } diff --git a/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php b/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php index 46e696cb17f86639ab00ba9bebcf3b62ad9a3ca7..91c017f2c3726fbca7e1c088d2ae12c4318b8f20 100644 --- a/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php +++ b/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php @@ -10,7 +10,6 @@ use Magento\Customer\Api\CustomerMetadataInterface; use Magento\Customer\Model\AttributeMetadataConverter; use Magento\Customer\Model\AttributeMetadataDataProvider; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; -use Magento\Framework\Api\Config\MetadataConfig; use Magento\Framework\Api\SimpleDataObjectConverter; use Magento\Framework\Exception\NoSuchEntityException; @@ -24,11 +23,6 @@ class CustomerMetadata implements CustomerMetadataInterface */ private $customerDataObjectMethods; - /** - * @var MetadataConfig - */ - private $metadataConfig; - /** * @var AttributeMetadataConverter */ @@ -40,16 +34,13 @@ class CustomerMetadata implements CustomerMetadataInterface private $attributeMetadataDataProvider; /** - * @param MetadataConfig $metadataConfig * @param AttributeMetadataConverter $attributeMetadataConverter * @param AttributeMetadataDataProvider $attributeMetadataDataProvider */ public function __construct( - MetadataConfig $metadataConfig, AttributeMetadataConverter $attributeMetadataConverter, AttributeMetadataDataProvider $attributeMetadataDataProvider ) { - $this->metadataConfig = $metadataConfig; $this->attributeMetadataConverter = $attributeMetadataConverter; $this->attributeMetadataDataProvider = $attributeMetadataDataProvider; } @@ -148,6 +139,6 @@ class CustomerMetadata implements CustomerMetadataInterface $customAttributes[] = $attributeMetadata; } } - return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName)); + return $customAttributes; } } diff --git a/app/code/Magento/Customer/Model/Metadata/Form/Postcode.php b/app/code/Magento/Customer/Model/Metadata/Form/Postcode.php index c65d0e7adaa2208981f16ac3de73566ae711570c..0af212b81b191a9c2d8cca6094fafdc6b996865f 100644 --- a/app/code/Magento/Customer/Model/Metadata/Form/Postcode.php +++ b/app/code/Magento/Customer/Model/Metadata/Form/Postcode.php @@ -9,7 +9,7 @@ use Magento\Customer\Api\Data\AttributeMetadataInterface; use Magento\Customer\Model\Metadata\ElementFactory; use Magento\Directory\Helper\Data as DirectoryHelper; use Magento\Framework\Locale\ResolverInterface; -use Psr\Log\LoggerInterface as Logger; +use Psr\Log\LoggerInterface as PsrLogger; use Magento\Framework\Stdlib\DateTime\TimezoneInterface as MagentoTimezone; /** @@ -24,7 +24,7 @@ class Postcode extends AbstractData /** * @param MagentoTimezone $localeDate - * @param Logger $logger + * @param PsrLogger $logger * @param AttributeMetadataInterface $attribute * @param ResolverInterface $localeResolver * @param string $value @@ -34,7 +34,7 @@ class Postcode extends AbstractData */ public function __construct( MagentoTimezone $localeDate, - Logger $logger, + PsrLogger $logger, AttributeMetadataInterface $attribute, ResolverInterface $localeResolver, $value, diff --git a/app/code/Magento/Customer/Model/Observer/Log.php b/app/code/Magento/Customer/Model/Observer/Log.php new file mode 100644 index 0000000000000000000000000000000000000000..539221b5e378f47a537816c4d1e3a14457ab6ea1 --- /dev/null +++ b/app/code/Magento/Customer/Model/Observer/Log.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Model\Observer; + +use Magento\Customer\Model\Logger; +use Magento\Framework\Stdlib\DateTime; +use Magento\Framework\Event\Observer; + +/** + * Customer log observer. + */ +class Log +{ + /** + * Logger of customer's log data. + * + * @var Logger + */ + protected $logger; + + /** + * @param Logger $logger + */ + public function __construct(Logger $logger) + { + $this->logger = $logger; + } + + /** + * Handler for 'customer_login' event. + * + * @param Observer $observer + * @return void + */ + public function logLastLoginAt(Observer $observer) + { + $this->logger->log( + $observer->getEvent()->getCustomer()->getId(), + ['last_login_at' => (new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)] + ); + } + + /** + * Handler for 'customer_logout' event. + * + * @param Observer $observer + * @return void + */ + public function logLastLogoutAt(Observer $observer) + { + $this->logger->log( + $observer->getEvent()->getCustomer()->getId(), + ['last_logout_at' => (new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)] + ); + } +} diff --git a/app/code/Magento/Customer/Model/Resource/AddressRepository.php b/app/code/Magento/Customer/Model/Resource/AddressRepository.php index c83617ec411201db71c248516418cd1a5d25691e..ce60b52c51c20722c26ab4bbf8c23dfcb8c521e2 100644 --- a/app/code/Magento/Customer/Model/Resource/AddressRepository.php +++ b/app/code/Magento/Customer/Model/Resource/AddressRepository.php @@ -47,9 +47,9 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf protected $addressResourceModel; /** - * @var \Magento\Customer\Api\Data\AddressSearchResultsDataBuilder + * @var \Magento\Customer\Api\Data\AddressSearchResultsInterfaceFactory */ - protected $addressSearchResultsBuilder; + protected $addressSearchResultsFactory; /** * @var \Magento\Customer\Model\Resource\Address\CollectionFactory @@ -62,7 +62,7 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf * @param \Magento\Customer\Model\CustomerRegistry $customerRegistry * @param \Magento\Customer\Model\Resource\Address $addressResourceModel * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Customer\Api\Data\AddressSearchResultsDataBuilder $addressSearchResultsBuilder + * @param \Magento\Customer\Api\Data\AddressSearchResultsInterfaceFactory $addressSearchResultsFactory * @param \Magento\Customer\Model\Resource\Address\CollectionFactory $addressCollectionFactory */ public function __construct( @@ -71,7 +71,7 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf \Magento\Customer\Model\CustomerRegistry $customerRegistry, \Magento\Customer\Model\Resource\Address $addressResourceModel, \Magento\Directory\Helper\Data $directoryData, - \Magento\Customer\Api\Data\AddressSearchResultsDataBuilder $addressSearchResultsBuilder, + \Magento\Customer\Api\Data\AddressSearchResultsInterfaceFactory $addressSearchResultsFactory, \Magento\Customer\Model\Resource\Address\CollectionFactory $addressCollectionFactory ) { $this->addressFactory = $addressFactory; @@ -79,7 +79,7 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf $this->customerRegistry = $customerRegistry; $this->addressResource = $addressResourceModel; $this->directoryData = $directoryData; - $this->addressSearchResultsBuilder = $addressSearchResultsBuilder; + $this->addressSearchResultsFactory = $addressSearchResultsFactory; $this->addressCollectionFactory = $addressCollectionFactory; } @@ -142,7 +142,7 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf */ public function getList(SearchCriteriaInterface $searchCriteria) { - $this->addressSearchResultsBuilder->setSearchCriteria($searchCriteria); + $searchResults = $this->addressSearchResultsFactory->create(); /** @var Collection $collection */ $collection = $this->addressCollectionFactory->create(); @@ -150,7 +150,7 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf foreach ($searchCriteria->getFilterGroups() as $group) { $this->addFilterGroupToCollection($group, $collection); } - $this->addressSearchResultsBuilder->setTotalCount($collection->getSize()); + $searchResults->setTotalCount($collection->getSize()); /** @var SortOrder $sortOrder */ foreach ((array)$searchCriteria->getSortOrders() as $sortOrder) { $field = $sortOrder->getField(); @@ -168,9 +168,9 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf foreach ($collection->getItems() as $address) { $addresses[] = $this->getById($address->getId()); } - $this->addressSearchResultsBuilder->setItems($addresses); - $this->addressSearchResultsBuilder->setSearchCriteria($searchCriteria); - return $this->addressSearchResultsBuilder->create(); + $searchResults->setItems($addresses); + $searchResults->setSearchCriteria($searchCriteria); + return $searchResults; } /** diff --git a/app/code/Magento/Customer/Model/Resource/CustomerRepository.php b/app/code/Magento/Customer/Model/Resource/CustomerRepository.php index 610870d48f195e1e3f7059ad730a2e0df12cdb62..757ef49198d792f77de17761bd01f7d30e67e8b4 100644 --- a/app/code/Magento/Customer/Model/Resource/CustomerRepository.php +++ b/app/code/Magento/Customer/Model/Resource/CustomerRepository.php @@ -48,9 +48,9 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte protected $customerMetadata; /** - * @var \Magento\Customer\Api\Data\CustomerSearchResultsDataBuilder + * @var \Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory */ - protected $searchResultsBuilder; + protected $searchResultsFactory; /** * @var \Magento\Framework\Event\ManagerInterface @@ -74,7 +74,7 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte * @param \Magento\Customer\Model\Resource\AddressRepository $addressRepository * @param \Magento\Customer\Model\Resource\Customer $customerResourceModel * @param \Magento\Customer\Api\CustomerMetadataInterface $customerMetadata - * @param \Magento\Customer\Api\Data\CustomerSearchResultsDataBuilder $searchResultsDataBuilder + * @param \Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory $searchResultsFactory * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter @@ -87,7 +87,7 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte \Magento\Customer\Model\Resource\AddressRepository $addressRepository, \Magento\Customer\Model\Resource\Customer $customerResourceModel, \Magento\Customer\Api\CustomerMetadataInterface $customerMetadata, - \Magento\Customer\Api\Data\CustomerSearchResultsDataBuilder $searchResultsDataBuilder, + \Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory $searchResultsFactory, \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter @@ -98,7 +98,7 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte $this->addressRepository = $addressRepository; $this->customerResourceModel = $customerResourceModel; $this->customerMetadata = $customerMetadata; - $this->searchResultsBuilder = $searchResultsDataBuilder; + $this->searchResultsFactory = $searchResultsFactory; $this->eventManager = $eventManager; $this->storeManager = $storeManager; $this->extensibleDataObjectConverter = $extensibleDataObjectConverter; @@ -209,7 +209,8 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte */ public function getList(SearchCriteriaInterface $searchCriteria) { - $this->searchResultsBuilder->setSearchCriteria($searchCriteria); + $searchResults = $this->searchResultsFactory->create(); + $searchResults->setSearchCriteria($searchCriteria); /** @var \Magento\Customer\Model\Resource\Customer\Collection $collection */ $collection = $this->customerFactory->create()->getCollection(); // This is needed to make sure all the attributes are properly loaded @@ -229,7 +230,7 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte foreach ($searchCriteria->getFilterGroups() as $group) { $this->addFilterGroupToCollection($group, $collection); } - $this->searchResultsBuilder->setTotalCount($collection->getSize()); + $searchResults->setTotalCount($collection->getSize()); $sortOrders = $searchCriteria->getSortOrders(); if ($sortOrders) { foreach ($searchCriteria->getSortOrders() as $sortOrder) { @@ -246,8 +247,8 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte foreach ($collection as $customerModel) { $customers[] = $customerModel->getDataModel(); } - $this->searchResultsBuilder->setItems($customers); - return $this->searchResultsBuilder->create(); + $searchResults->setItems($customers); + return $searchResults; } /** diff --git a/app/code/Magento/Customer/Model/Resource/GroupRepository.php b/app/code/Magento/Customer/Model/Resource/GroupRepository.php index 1b7a04ca76cea601b057a49bbc7a79d127fb83ba..74f227df9ebf71c99d6b4765cd41530dda28d63f 100644 --- a/app/code/Magento/Customer/Model/Resource/GroupRepository.php +++ b/app/code/Magento/Customer/Model/Resource/GroupRepository.php @@ -53,9 +53,9 @@ class GroupRepository implements \Magento\Customer\Api\GroupRepositoryInterface protected $dataObjectProcessor; /** - * @var \Magento\Customer\Api\Data\GroupSearchResultsDataBuilder + * @var \Magento\Customer\Api\Data\GroupSearchResultsInterfaceFactory */ - protected $searchResultsBuilder; + protected $searchResultsFactory; /** * @var \Magento\Tax\Api\TaxClassRepositoryInterface @@ -68,7 +68,7 @@ class GroupRepository implements \Magento\Customer\Api\GroupRepositoryInterface * @param \Magento\Customer\Api\Data\GroupInterfaceFactory $groupDataFactory * @param \Magento\Customer\Model\Resource\Group $groupResourceModel * @param \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor - * @param \Magento\Customer\Api\Data\GroupSearchResultsDataBuilder $searchResultsBuilder + * @param \Magento\Customer\Api\Data\GroupSearchResultsInterfaceFactory $searchResultsFactory * @param \Magento\Tax\Api\TaxClassRepositoryInterface $taxClassRepositoryInterface */ public function __construct( @@ -77,7 +77,7 @@ class GroupRepository implements \Magento\Customer\Api\GroupRepositoryInterface \Magento\Customer\Api\Data\GroupInterfaceFactory $groupDataFactory, \Magento\Customer\Model\Resource\Group $groupResourceModel, \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor, - \Magento\Customer\Api\Data\GroupSearchResultsDataBuilder $searchResultsBuilder, + \Magento\Customer\Api\Data\GroupSearchResultsInterfaceFactory $searchResultsFactory, \Magento\Tax\Api\TaxClassRepositoryInterface $taxClassRepositoryInterface ) { $this->groupRegistry = $groupRegistry; @@ -85,7 +85,7 @@ class GroupRepository implements \Magento\Customer\Api\GroupRepositoryInterface $this->groupDataFactory = $groupDataFactory; $this->groupResourceModel = $groupResourceModel; $this->dataObjectProcessor = $dataObjectProcessor; - $this->searchResultsBuilder = $searchResultsBuilder; + $this->searchResultsFactory = $searchResultsFactory; $this->taxClassRepository = $taxClassRepositoryInterface; } @@ -159,7 +159,8 @@ class GroupRepository implements \Magento\Customer\Api\GroupRepositoryInterface */ public function getList(SearchCriteriaInterface $searchCriteria) { - $this->searchResultsBuilder->setSearchCriteria($searchCriteria); + $searchResults = $this->searchResultsFactory->create(); + $searchResults->setSearchCriteria($searchCriteria); /** @var \Magento\Customer\Model\Resource\Group\Collection $collection */ $collection = $this->groupFactory->create()->getCollection(); @@ -169,7 +170,7 @@ class GroupRepository implements \Magento\Customer\Api\GroupRepositoryInterface foreach ($searchCriteria->getFilterGroups() as $group) { $this->addFilterGroupToCollection($group, $collection); } - $this->searchResultsBuilder->setTotalCount($collection->getSize()); + $searchResults->setTotalCount($collection->getSize()); $sortOrders = $searchCriteria->getSortOrders(); /** @var \Magento\Framework\Api\SortOrder $sortOrder */ if ($sortOrders) { @@ -195,7 +196,7 @@ class GroupRepository implements \Magento\Customer\Api\GroupRepositoryInterface ->setTaxClassName($group->getTaxClassName()); $groups[] = $groupDataObject; } - return $this->searchResultsBuilder->setItems($groups)->create(); + return $searchResults->setItems($groups); } /** diff --git a/app/code/Magento/Customer/Model/Resource/Visitor.php b/app/code/Magento/Customer/Model/Resource/Visitor.php index 639590bd07e85009d7002a63e1d16f678f875f18..8cc63d45988cad52b67034d5f07a32af0bfbc338 100644 --- a/app/code/Magento/Customer/Model/Resource/Visitor.php +++ b/app/code/Magento/Customer/Model/Resource/Visitor.php @@ -58,6 +58,7 @@ class Visitor extends \Magento\Framework\Model\Resource\Db\AbstractDb protected function _prepareDataForSave(\Magento\Framework\Model\AbstractModel $visitor) { return [ + 'customer_id' => $visitor->getCustomerId(), 'session_id' => $visitor->getSessionId(), 'last_visit_at' => $visitor->getLastVisitAt() ]; diff --git a/app/code/Magento/Customer/Model/Vat.php b/app/code/Magento/Customer/Model/Vat.php index d20d51b2f788155be9e6b62bea29cbe69e5cecad..0930595e6758900822694ea2b2b410ff490999df 100644 --- a/app/code/Magento/Customer/Model/Vat.php +++ b/app/code/Magento/Customer/Model/Vat.php @@ -6,7 +6,7 @@ namespace Magento\Customer\Model; use Magento\Framework\App\Config\ScopeConfigInterface; -use Psr\Log\LoggerInterface as Logger; +use Psr\Log\LoggerInterface as PsrLogger; use Magento\Store\Model\ScopeInterface; /** @@ -68,17 +68,17 @@ class Vat protected $scopeConfig; /** - * @var Logger + * @var PsrLogger */ protected $logger; /** * @param ScopeConfigInterface $scopeConfig - * @param Logger $logger + * @param PsrLogger $logger */ public function __construct( ScopeConfigInterface $scopeConfig, - Logger $logger + PsrLogger $logger ) { $this->scopeConfig = $scopeConfig; $this->logger = $logger; diff --git a/app/code/Magento/Customer/Model/Visitor.php b/app/code/Magento/Customer/Model/Visitor.php index 4fc1c3a8026535a7f3bad674f5c1abea19b7fb16..132fd35acc9d1c66adc5be763fd2214760fb6247 100644 --- a/app/code/Magento/Customer/Model/Visitor.php +++ b/app/code/Magento/Customer/Model/Visitor.php @@ -133,14 +133,15 @@ class Visitor extends \Magento\Framework\Model\AbstractModel if ($this->skipRequestLogging || $this->isModuleIgnored($observer)) { return $this; } + if ($this->session->getVisitorData()) { $this->setData($this->session->getVisitorData()); } + + $this->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)); + if (!$this->getId()) { $this->setSessionId($this->session->getSessionId()); - $this->setLastVisitAt( - (new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT) - ); $this->save(); $this->_eventManager->dispatch('visitor_init', ['visitor' => $this]); $this->session->setVisitorData($this->getData()); diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php index 6ebf692405649991e59149a9f47a5ffda6508ce3..2b7a160eb3de8495fa5fa096bb76dd41a3e748e3 100644 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -6,6 +6,8 @@ namespace Magento\Customer\Setup; +use Magento\Framework\DB\Ddl\Table; +use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; @@ -17,12 +19,14 @@ class UpgradeSchema implements UpgradeSchemaInterface { /** * {@inheritdoc} + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) { + $setup->startSetup(); + if (version_compare($context->getVersion(), '2.0.0.1') < 0) { $installer = $setup; - $installer->startSetup(); $connection = $installer->getConnection(); $tableNames = [ @@ -57,7 +61,96 @@ class UpgradeSchema implements UpgradeSchemaInterface ); $connection->dropColumn($installer->getTable('customer_entity'), 'entity_type_id'); $connection->dropColumn($installer->getTable('customer_entity'), 'attribute_set_id'); - $installer->endSetup(); } + + if (version_compare($context->getVersion(), '2.0.0.2') < 0) { + /** + * Update 'customer_visitor' table. + */ + $setup->getConnection() + ->addColumn( + $setup->getTable('customer_visitor'), + 'customer_id', + [ + 'type' => Table::TYPE_INTEGER, + 'after' => 'visitor_id', + 'comment' => 'Customer ID' + ] + ); + + $setup->getConnection() + ->addIndex( + $setup->getTable('customer_visitor'), + $setup->getIdxName( + $setup->getTable('customer_visitor'), + ['customer_id'] + ), + 'customer_id' + ); + + /** + * Create 'customer_log' table. + */ + $table = $setup->getConnection() + ->newTable( + $setup->getTable('customer_log') + ) + ->addColumn( + 'log_id', + Table::TYPE_INTEGER, + null, + [ + 'nullable' => false, + 'identity' => true, + 'primary' => true + ], + 'Log ID' + ) + ->addColumn( + 'customer_id', + Table::TYPE_INTEGER, + null, + [ + 'nullable' => false + ], + 'Customer ID' + ) + ->addColumn( + 'last_login_at', + Table::TYPE_TIMESTAMP, + null, + [ + 'nullable' => true, + 'default' => null + ], + 'Last Login Time' + ) + ->addColumn( + 'last_logout_at', + Table::TYPE_TIMESTAMP, + null, + [ + 'nullable' => true, + 'default' => null + ], + 'Last Logout Time' + ) + ->addIndex( + $setup->getIdxName( + $setup->getTable('customer_log'), + ['customer_id'], + AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['customer_id'], + [ + 'type' => AdapterInterface::INDEX_TYPE_UNIQUE + ] + ) + ->setComment('Customer Log Table'); + + $setup->getConnection()->createTable($table); + } + + $setup->endSetup(); } } diff --git a/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/View/PersonalInfoTest.php b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/View/PersonalInfoTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a196a2917f99477245f5f7e8cc7fd6b74533dfcb --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Block/Adminhtml/Edit/Tab/View/PersonalInfoTest.php @@ -0,0 +1,239 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Test\Unit\Block\Adminhtml\Edit\Tab\View; + +use Magento\Customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo; +use Magento\Framework\Stdlib\DateTime; + +/** + * Customer personal information template block test. + */ +class PersonalInfoTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var string + */ + protected $defaultTimezone = 'America/Los_Angeles'; + + /** + * @var string + */ + protected $pathToDefaultTimezone = 'path/to/default/timezone'; + + /** + * @var PersonalInfo + */ + protected $block; + + /** + * @var \Magento\Customer\Model\Log|\PHPUnit_Framework_MockObject_MockObject + */ + protected $customerLog; + + /** + * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $localeDate; + + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfig; + + /** + * @return void + */ + protected function setUp() + { + $customer = $this->getMock( + 'Magento\Customer\Api\Data\CustomerInterface', + [], + [], + '', + false + ); + $customer->expects($this->any())->method('getId')->willReturn(1); + $customer->expects($this->any())->method('getStoreId')->willReturn(1); + + $customerDataFactory = $this->getMock( + 'Magento\Customer\Api\Data\CustomerInterfaceFactory', + ['create'], + [], + '', + false + ); + $customerDataFactory->expects($this->any())->method('create')->willReturn($customer); + + $backendSession = $this->getMock( + 'Magento\Backend\Model\Session', + ['getCustomerData'], + [], + '', + false + ); + $backendSession->expects($this->any())->method('getCustomerData')->willReturn(['account' => []]); + + $this->customerLog = $this->getMock( + 'Magento\Customer\Model\Log', + ['getLastLoginAt', 'getLastVisitAt', 'getLastLogoutAt'], + [], + '', + false + ); + $this->customerLog->expects($this->any())->method('loadByCustomer')->willReturnSelf(); + + $customerLogger = $this->getMock( + 'Magento\Customer\Model\Logger', + ['get'], + [], + '', + false + ); + $customerLogger->expects($this->any())->method('get')->willReturn($this->customerLog); + + $dateTime = $this->getMock( + 'Magento\Framework\Stdlib\DateTime', + ['now'], + [], + '', + false + ); + $dateTime->expects($this->any())->method('now')->willReturn('2015-03-04 12:00:00'); + + $this->localeDate = $this->getMock( + 'Magento\Framework\Stdlib\DateTime\Timezone', + ['scopeDate', 'formatDateTime', 'getDefaultTimezonePath'], + [], + '', + false + ); + $this->localeDate + ->expects($this->any()) + ->method('getDefaultTimezonePath') + ->willReturn($this->pathToDefaultTimezone); + + $this->scopeConfig = $this->getMock( + 'Magento\Framework\App\Config', + ['getValue'], + [], + '', + false + ); + + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->block = $objectManagerHelper->getObject( + 'Magento\Customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo', + [ + 'customerDataFactory' => $customerDataFactory, + 'dateTime' => $dateTime, + 'customerLogger' => $customerLogger, + 'localeDate' => $this->localeDate, + 'scopeConfig' => $this->scopeConfig, + 'backendSession' => $backendSession, + ] + ); + } + + /** + * @return void + */ + public function testGetStoreLastLoginDateTimezone() + { + $this->scopeConfig + ->expects($this->once()) + ->method('getValue') + ->with( + $this->pathToDefaultTimezone, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ) + ->willReturn($this->defaultTimezone); + + $this->assertEquals($this->defaultTimezone, $this->block->getStoreLastLoginDateTimezone()); + } + + /** + * @param string $status + * @param string|null $lastLoginAt + * @param string|null $lastVisitAt + * @param string|null $lastLogoutAt + * @return void + * @dataProvider getCurrentStatusDataProvider + */ + public function testGetCurrentStatus($status, $lastLoginAt, $lastVisitAt, $lastLogoutAt) + { + $this->customerLog->expects($this->any())->method('getLastLoginAt')->willReturn($lastLoginAt); + $this->customerLog->expects($this->any())->method('getLastVisitAt')->willReturn($lastVisitAt); + $this->customerLog->expects($this->any())->method('getLastLogoutAt')->willReturn($lastLogoutAt); + + $this->assertEquals($status, (string) $this->block->getCurrentStatus()); + } + + /** + * @return array + */ + public function getCurrentStatusDataProvider() + { + return [ + ['Offline', null, null, null], + ['Offline', '2015-03-04 11:00:00', null, '2015-03-04 12:00:00'], + ['Offline', '2015-03-04 11:00:00', '2015-03-04 11:40:00', null], + ['Online', '2015-03-04 11:00:00', (new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT), null] + ]; + } + + /** + * @param string $result + * @param string|null $lastLoginAt + * @dataProvider getLastLoginDateDataProvider + * @return void + */ + public function testGetLastLoginDate($result, $lastLoginAt) + { + $this->customerLog->expects($this->once())->method('getLastLoginAt')->willReturn($lastLoginAt); + $this->localeDate->expects($this->any())->method('formatDateTime')->willReturn($lastLoginAt); + + $this->assertEquals($result, $this->block->getLastLoginDate()); + } + + /** + * @return array + */ + public function getLastLoginDateDataProvider() + { + return [ + ['2015-03-04 12:00:00', '2015-03-04 12:00:00'], + ['Never', null] + ]; + } + + /** + * @param string $result + * @param string|null $lastLoginAt + * @dataProvider getStoreLastLoginDateDataProvider + * @return void + */ + public function testGetStoreLastLoginDate($result, $lastLoginAt) + { + $this->customerLog->expects($this->once())->method('getLastLoginAt')->willReturn($lastLoginAt); + + $this->localeDate->expects($this->any())->method('scopeDate')->will($this->returnValue($lastLoginAt)); + $this->localeDate->expects($this->any())->method('formatDateTime')->willReturn($lastLoginAt); + + $this->assertEquals($result, $this->block->getStoreLastLoginDate()); + } + + /** + * @return array + */ + public function getStoreLastLoginDateDataProvider() + { + return [ + ['2015-03-04 12:00:00', '2015-03-04 12:00:00'], + ['Never', null] + ]; + } +} diff --git a/app/code/Magento/Customer/Test/Unit/Block/Form/LoginTest.php b/app/code/Magento/Customer/Test/Unit/Block/Form/Login/InfoTest.php similarity index 68% rename from app/code/Magento/Customer/Test/Unit/Block/Form/LoginTest.php rename to app/code/Magento/Customer/Test/Unit/Block/Form/Login/InfoTest.php index 493674bf0ad7290d4591bf1915fa5843e7d35168..b45a2811d9dd36cb67bcb332a667737915df0f64 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Form/LoginTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Form/Login/InfoTest.php @@ -3,17 +3,12 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Customer\Test\Unit\Block\Form; +namespace Magento\Customer\Test\Unit\Block\Form\Login; -class LoginTest extends \PHPUnit_Framework_TestCase +class InfoTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager - */ - protected $objectManager; - - /** - * @var \Magento\Customer\Block\Form\Login + * @var \Magento\Customer\Block\Form\Login\Info */ protected $block; @@ -50,9 +45,8 @@ class LoginTest extends \PHPUnit_Framework_TestCase ['addRequestParam'] )->getMock(); - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->block = $this->objectManager->getObject( - 'Magento\Customer\Block\Form\Login', + $this->block = (new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this))->getObject( + 'Magento\Customer\Block\Form\Login\Info', [ 'customerUrl' => $this->customerUrl, 'checkoutData' => $this->checkoutData, @@ -61,13 +55,20 @@ class LoginTest extends \PHPUnit_Framework_TestCase ); } - public function testGetCreateAccountUrl() + public function testGetExistingCreateAccountUrl() { $expectedUrl = 'Custom Url'; $this->block->setCreateAccountUrl($expectedUrl); $this->checkoutData->expects($this->any())->method('isContextCheckout')->will($this->returnValue(false)); $this->assertEquals($expectedUrl, $this->block->getCreateAccountUrl()); + } + + public function testGetCreateAccountUrlWithContext() + { + $url = 'Custom Url'; + $expectedUrl = 'Custom Url with context'; + $this->block->setCreateAccountUrl($url); $this->checkoutData->expects($this->any())->method('isContextCheckout')->will($this->returnValue(true)); $this->coreUrl->expects( @@ -75,30 +76,20 @@ class LoginTest extends \PHPUnit_Framework_TestCase )->method( 'addRequestParam' )->with( - $expectedUrl, + $url, ['context' => 'checkout'] )->will( $this->returnValue($expectedUrl) ); $this->assertEquals($expectedUrl, $this->block->getCreateAccountUrl()); + } - $this->block->unsCreateAccountUrl(); - $this->customerUrl->expects($this->any())->method('getRegisterUrl')->will($this->returnValue($expectedUrl)); - $this->checkoutData->expects($this->any())->method('isContextCheckout')->will($this->returnValue(false)); - $this->assertEquals($expectedUrl, $this->block->getCreateAccountUrl()); + public function testGetCreateAccountUrl() + { + $expectedUrl = 'Custom Url'; $this->customerUrl->expects($this->any())->method('getRegisterUrl')->will($this->returnValue($expectedUrl)); - $this->checkoutData->expects($this->any())->method('isContextCheckout')->will($this->returnValue(true)); - $this->coreUrl->expects( - $this->any() - )->method( - 'addRequestParam' - )->with( - $expectedUrl, - ['context' => 'checkout'] - )->will( - $this->returnValue($expectedUrl) - ); + $this->checkoutData->expects($this->any())->method('isContextCheckout')->will($this->returnValue(false)); $this->assertEquals($expectedUrl, $this->block->getCreateAccountUrl()); } } diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Account/ConfirmTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Account/ConfirmTest.php index 6323dec97d41723037ebf55067c6a088d3c6f5bd..a4fe4832056411b7453b2eaa2b8b01ea04d3b010 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Account/ConfirmTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Account/ConfirmTest.php @@ -19,7 +19,7 @@ use Magento\Store\Model\ScopeInterface; class ConfirmTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Customer\Controller\Account + * @var \Magento\Customer\Controller\Account\Confirm */ protected $model; @@ -171,7 +171,7 @@ class ConfirmTest extends \PHPUnit_Framework_TestCase 'customerRepository' => $this->customerRepositoryMock, 'addressHelper' => $this->addressHelperMock, 'urlFactory' => $urlFactoryMock, - 'resultRedirectFactory' => $redirectFactoryMock + 'resultRedirectFactory' => $redirectFactoryMock, ] ); } @@ -426,7 +426,7 @@ class ConfirmTest extends \PHPUnit_Framework_TestCase 'http://example.com/success', 'http://example.com/success', true, - __('Thank you for registering with') + __('Thank you for registering with'), ], [ 1, @@ -435,7 +435,7 @@ class ConfirmTest extends \PHPUnit_Framework_TestCase 'http://example.com/success', 'http://example.com/success', false, - __('Thank you for registering with') + __('Thank you for registering with'), ], ]; } diff --git a/app/code/Magento/Customer/Test/Unit/Model/AttributeTest.php b/app/code/Magento/Customer/Test/Unit/Model/AttributeTest.php index aed47c9e45898f0b9e4ea6dc6877c06c87f92d1f..81fdf472c365eb9e7ff2348ac3922b320a28b1bf 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/AttributeTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/AttributeTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Customer\Test\Unit\Model; use Magento\Customer\Model\Attribute; @@ -29,11 +31,6 @@ class AttributeTest extends \PHPUnit_Framework_TestCase */ protected $registryMock; - /** - * @var \Magento\Framework\Api\MetadataServiceInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $metadataServiceMock; - /** * @var \Magento\Framework\Api\AttributeValueFactory|\PHPUnit_Framework_MockObject_MockObject */ @@ -109,6 +106,14 @@ class AttributeTest extends \PHPUnit_Framework_TestCase */ private $dataObjectHelperMock; + /** + * @var \Magento\Framework\Api\ExtensionAttributesFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $extensionAttributesFactory; + + /** + * Test method + */ protected function setUp() { $this->contextMock = $this->getMockBuilder('Magento\Framework\Model\Context') @@ -116,7 +121,8 @@ class AttributeTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->registryMock = $this->getMockBuilder('Magento\Framework\Registry') ->getMock(); - $this->metadataServiceMock = $this->getMockBuilder('Magento\Framework\Api\MetadataServiceInterface') + $this->extensionAttributesFactory = $this->getMockBuilder('Magento\Framework\Api\ExtensionAttributesFactory') + ->disableOriginalConstructor() ->getMock(); $this->attributeValueFactoryMock = $this->getMockBuilder('Magento\Framework\Api\AttributeValueFactory') ->disableOriginalConstructor() @@ -173,7 +179,7 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $this->attribute = new Attribute( $this->contextMock, $this->registryMock, - $this->metadataServiceMock, + $this->extensionAttributesFactory, $this->attributeValueFactoryMock, $this->configMock, $this->typeFactoryMock, @@ -190,6 +196,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test method + */ public function testAfterSaveEavCache() { $this->configMock @@ -199,6 +208,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $this->attribute->afterSave(); } + /** + * Test method + */ public function testAfterDeleteEavCache() { $this->configMock diff --git a/app/code/Magento/Customer/Test/Unit/Model/LogTest.php b/app/code/Magento/Customer/Test/Unit/Model/LogTest.php new file mode 100644 index 0000000000000000000000000000000000000000..96ce27aef717692871d99e6702bfde5a5314d6a9 --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Model/LogTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Test\Unit\Model; + +/** + * Customer log model test. + */ +class LogTest extends \PHPUnit_Framework_TestCase +{ + /** + * Customer log model. + * + * @var \Magento\Customer\Model\Log + */ + protected $log; + + /** + * @var array + */ + protected $logData = [ + 'customer_id' => 369, + 'last_login_at' => '2015-03-04 12:00:00', + 'last_visit_at' => '2015-03-04 12:01:00', + 'last_logout_at' => '2015-03-04 12:05:00', + ]; + + /** + * @return void + */ + protected function setUp() + { + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->log = $objectManagerHelper->getObject( + 'Magento\Customer\Model\Log', + [ + 'customerId' => $this->logData['customer_id'], + 'lastLoginAt' => $this->logData['last_login_at'], + 'lastVisitAt' => $this->logData['last_visit_at'], + 'lastLogoutAt' => $this->logData['last_logout_at'] + ] + ); + } + + /** + * @return void + */ + public function testGetCustomerId() + { + $this->assertEquals($this->logData['customer_id'], $this->log->getCustomerId()); + } + + /** + * @return void + */ + public function testGetLastLoginAt() + { + $this->assertEquals($this->logData['last_login_at'], $this->log->getLastLoginAt()); + } + + /** + * @return void + */ + public function testGetLastVisitAt() + { + $this->assertEquals($this->logData['last_visit_at'], $this->log->getLastVisitAt()); + } + + /** + * @return void + */ + public function testGetLastLogoutAt() + { + $this->assertEquals($this->logData['last_logout_at'], $this->log->getLastLogoutAt()); + } +} diff --git a/app/code/Magento/Customer/Test/Unit/Model/LoggerTest.php b/app/code/Magento/Customer/Test/Unit/Model/LoggerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..88c7f55c22a3eb5ad0c5666d8ab0fcf77b87dac9 --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Model/LoggerTest.php @@ -0,0 +1,193 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Test\Unit\Model; + +/** + * Customer log data logger test. + */ +class LoggerTest extends \PHPUnit_Framework_TestCase +{ + /** + * Customer log data logger. + * + * @var \Magento\Customer\Model\Logger + */ + protected $logger; + + /** + * @var \Magento\Customer\Model\LogFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $logFactory; + + /** + * Resource instance. + * + * @var \Magento\Framework\App\Resource|\PHPUnit_Framework_MockObject_MockObject + */ + protected $resource; + + /** + * DB connection instance. + * + * @var \Magento\Framework\DB\Adapter\Pdo|\PHPUnit_Framework_MockObject_MockObject + */ + protected $adapter; + + /** + * @return void + */ + protected function setUp() + { + $this->adapter = $this->getMock( + 'Magento\Framework\DB\Adapter\Pdo', + ['select', 'insertOnDuplicate', 'fetchRow'], + [], + '', + false + ); + $this->resource = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); + $this->logFactory = $this->getMock('\Magento\Customer\Model\LogFactory', ['create'], [], '', false); + + $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->logger = $objectManagerHelper->getObject( + '\Magento\Customer\Model\Logger', + [ + 'resource' => $this->resource, + 'logFactory' => $this->logFactory + ] + ); + } + + /** + * @param int $customerId + * @param array $data + * @dataProvider testLogDataProvider + * @return void + */ + public function testLog($customerId, $data) + { + $tableName = 'customer_log_table_name'; + $data = array_filter($data); + + if (!$data) { + $this->setExpectedException('\InvalidArgumentException', 'Log data is empty'); + $this->logger->log($customerId, $data); + return; + } + + $this->resource->expects($this->once()) + ->method('getConnection') + ->with('write') + ->willReturn($this->adapter); + $this->resource->expects($this->once()) + ->method('getTableName') + ->with('customer_log') + ->willReturn($tableName); + $this->adapter->expects($this->once()) + ->method('insertOnDuplicate') + ->with($tableName, array_merge(['customer_id' => $customerId], $data), array_keys($data)); + + $this->assertEquals($this->logger, $this->logger->log($customerId, $data)); + } + + /** + * @return array + */ + public function testLogDataProvider() + { + return [ + [235, ['last_login_at' => '2015-03-04 12:00:00']], + [235, ['last_login_at' => null]], + ]; + } + + /** + * @param int $customerId + * @param array $data + * @dataProvider testGetDataProvider + * @return void + */ + public function testGet($customerId, $data) + { + $logArguments = [ + 'customerId' => $data['customer_id'], + 'lastLoginAt' => $data['last_login_at'], + 'lastLogoutAt' => $data['last_logout_at'], + 'lastVisitAt' => $data['last_visit_at'] + ]; + + $select = $this->getMock('Magento\Framework\DB\Select', [], [], '', false); + + $select->expects($this->any())->method('from')->willReturnSelf(); + $select->expects($this->any())->method('joinLeft')->willReturnSelf(); + $select->expects($this->any())->method('where')->willReturnSelf(); + $select->expects($this->any())->method('order')->willReturnSelf(); + $select->expects($this->any())->method('limit')->willReturnSelf(); + + $this->adapter->expects($this->any()) + ->method('select') + ->willReturn($select); + + $this->resource->expects($this->once()) + ->method('getConnection') + ->with('read') + ->willReturn($this->adapter); + $this->adapter->expects($this->any()) + ->method('fetchRow') + ->with($select) + ->willReturn($data); + + $log = $this->getMock( + 'Magento\Customer\Model\Log', + [], + $logArguments + ); + + $this->logFactory->expects($this->any()) + ->method('create') + ->with($logArguments) + ->willReturn($log); + + $this->assertEquals($log, $this->logger->get($customerId)); + } + + /** + * @return array + */ + public function testGetDataProvider() + { + return [ + [ + 235, + [ + 'customer_id' => 369, + 'last_login_at' => '2015-03-04 12:00:00', + 'last_visit_at' => '2015-03-04 12:01:00', + 'last_logout_at' => '2015-03-04 12:05:00', + ] + ], + [ + 235, + [ + 'customer_id' => 369, + 'last_login_at' => '2015-03-04 12:00:00', + 'last_visit_at' => '2015-03-04 12:01:00', + 'last_logout_at' => null, + ] + ], + [ + 235, + [ + 'customer_id' => null, + 'last_login_at' => null, + 'last_visit_at' => null, + 'last_logout_at' => null, + ] + ], + ]; + } +} diff --git a/app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php b/app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fcd3ff2c58f76fff1619f3804c0c079eb8c5c397 --- /dev/null +++ b/app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php @@ -0,0 +1,90 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Test\Unit\Model\Observer; + +use Magento\Customer\Model\Logger; +use Magento\Framework\Stdlib\DateTime; +use Magento\Framework\Event\Observer; +use Magento\Customer\Model\Observer\Log; + +/** + * Class LogTest + */ +class LogTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Log + */ + protected $logObserver; + + /** + * @var Logger | \PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @return void + */ + public function setUp() + { + $this->loggerMock = $this->getMock('Magento\Customer\Model\Logger', [], [], '', false); + $this->logObserver = new Log($this->loggerMock); + } + + /** + * @return void + */ + public function testLogLastLoginAt() + { + $id = 1; + + $observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false); + $eventMock = $this->getMock('Magento\Framework\Event', ['getCustomer'], [], '', false); + $customerMock = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false); + + $observerMock->expects($this->once()) + ->method('getEvent') + ->willReturn($eventMock); + $eventMock->expects($this->once()) + ->method('getCustomer') + ->willReturn($customerMock); + $customerMock->expects($this->once()) + ->method('getId') + ->willReturn($id); + + $this->loggerMock->expects($this->once()) + ->method('log'); + + $this->logObserver->logLastLoginAt($observerMock); + } + + /** + * @return void + */ + public function testLogLastLogoutAt() + { + $id = 1; + + $observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false); + $eventMock = $this->getMock('Magento\Framework\Event', ['getCustomer'], [], '', false); + $customerMock = $this->getMock('Magento\Customer\Model\Customer', [], [], '', false); + + $observerMock->expects($this->once()) + ->method('getEvent') + ->willReturn($eventMock); + $eventMock->expects($this->once()) + ->method('getCustomer') + ->willReturn($customerMock); + $customerMock->expects($this->once()) + ->method('getId') + ->willReturn($id); + + $this->loggerMock->expects($this->once()) + ->method('log'); + + $this->logObserver->logLastLogoutAt($observerMock); + } +} diff --git a/app/code/Magento/Customer/Test/Unit/Model/Resource/Group/Grid/ServiceCollectionTest.php b/app/code/Magento/Customer/Test/Unit/Model/Resource/Group/Grid/ServiceCollectionTest.php index 96dfa00d94649984fd84913aba701ba72bae0589..5d9f67f24e56e09a51f142380ce5e27363b064ca 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Resource/Group/Grid/ServiceCollectionTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Resource/Group/Grid/ServiceCollectionTest.php @@ -72,6 +72,7 @@ class ServiceCollectionTest extends \PHPUnit_Framework_TestCase 'filterBuilder' => $this->filterBuilder, 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, 'groupRepository' => $this->groupRepositoryMock, + 'sortOrderBuilder' => $this->sortOrderBuilder, ] ); } diff --git a/app/code/Magento/Customer/etc/config.xml b/app/code/Magento/Customer/etc/config.xml index 12d5639d3636fc6ad657bfe0b8f20da83260f10b..981e8734fd3d1b44983ad150b25d5b284e20874b 100644 --- a/app/code/Magento/Customer/etc/config.xml +++ b/app/code/Magento/Customer/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <customer> <account_share> diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 5ea705d5687f45e48baf39832f4ef733abaaa7d3..acf37638c3915db937145e8245c1a59b14cac1c9 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -37,8 +37,6 @@ type="Magento\Customer\Model\Metadata\CustomerCachedMetadata" /> <preference for="Magento\Customer\Api\AddressMetadataInterface" type="Magento\Customer\Model\Metadata\AddressCachedMetadata" /> - <preference for="Magento\Customer\Api\Data\AttributeMetadataDataBuilder" - type="Magento\Customer\Model\AttributeMetadataDataBuilder" /> <type name="Magento\Customer\Model\Session"> <arguments> <argument name="configShare" xsi:type="object">Magento\Customer\Model\Config\Share\Proxy</argument> @@ -48,16 +46,6 @@ <argument name="customerRepository" xsi:type="object">Magento\Customer\Api\CustomerRepositoryInterface\Proxy</argument> </arguments> </type> - <type name="Magento\Customer\Api\Data\CustomerDataBuilder" shared="false"> - <arguments> - <argument name="metadataService" xsi:type="object">\Magento\Customer\Api\CustomerMetadataInterface</argument> - </arguments> - </type> - <type name="Magento\Customer\Api\Data\AddressDataBuilder" shared="false"> - <arguments> - <argument name="metadataService" xsi:type="object">\Magento\Customer\Api\AddressMetadataInterface</argument> - </arguments> - </type> <type name="Magento\Customer\Helper\Address"> <arguments> <argument name="addressConfig" xsi:type="object">Magento\Customer\Model\Address\Config\Proxy</argument> @@ -68,7 +56,6 @@ <argument name="customerResource" xsi:type="object">Magento\Customer\Model\Resource\Customer\Proxy</argument> </arguments> </type> - <type name="Magento\Customer\Api\Data\OptionDataBuilder" shared="false" /> <type name="Magento\Eav\Model\Entity\Setup\PropertyMapper\Composite"> <arguments> <argument name="propertyMappers" xsi:type="array"> @@ -76,26 +63,6 @@ </argument> </arguments> </type> - <virtualType name="Magento\Customer\Api\Config\CustomerMetadataConfig" type="Magento\Framework\Api\Config\MetadataConfig"> - <arguments> - <argument name="attributeMetadataBuilder" xsi:type="object">Magento\Customer\Model\AttributeMetadataDataBuilder</argument> - </arguments> - </virtualType> - <type name="Magento\Customer\Model\Metadata\CustomerMetadata"> - <arguments> - <argument name="metadataConfig" xsi:type="object">Magento\Customer\Api\Config\CustomerMetadataConfig</argument> - </arguments> - </type> - <virtualType name="Magento\Customer\Api\Config\AddressMetadataConfig" type="Magento\Framework\Api\Config\MetadataConfig"> - <arguments> - <argument name="attributeMetadataBuilder" xsi:type="object">Magento\Customer\Model\AttributeMetadataDataBuilder</argument> - </arguments> - </virtualType> - <type name="Magento\Customer\Model\Metadata\AddressMetadata"> - <arguments> - <argument name="metadataConfig" xsi:type="object">Magento\Customer\Api\Config\AddressMetadataConfig</argument> - </arguments> - </type> <type name="Magento\Framework\Model\ActionValidator\RemoveAction"> <arguments> <argument name="protectedModels" xsi:type="array"> diff --git a/app/code/Magento/Customer/etc/frontend/events.xml b/app/code/Magento/Customer/etc/frontend/events.xml index 81c65b5aa1c648e3cfe5e9f422e16ab4a268bd4e..a91b32c0ea159ab5e69b7d80732252cf72f16814 100644 --- a/app/code/Magento/Customer/etc/frontend/events.xml +++ b/app/code/Magento/Customer/etc/frontend/events.xml @@ -17,6 +17,7 @@ </event> <event name="customer_logout"> <observer name="customer_visitor" instance="Magento\Customer\Model\Visitor" method="bindCustomerLogout" /> + <observer name="customer_log_logout" instance="Magento\Customer\Model\Observer\Log" method="logLastLogoutAt" /> </event> <event name="sales_quote_save_after"> <observer name="customer_visitor" instance="Magento\Customer\Model\Visitor" method="bindQuoteCreate" /> @@ -24,4 +25,7 @@ <event name="checkout_quote_destroy"> <observer name="customer_visitor" instance="Magento\Customer\Model\Visitor" method="bindQuoteDestroy" /> </event> + <event name="customer_login"> + <observer name="customer_log_login" instance="Magento\Customer\Model\Observer\Log" method="logLastLoginAt" /> + </event> </config> diff --git a/app/code/Magento/Customer/etc/frontend/page_types.xml b/app/code/Magento/Customer/etc/frontend/page_types.xml index 3b4093e12cc0bb6a0250e33c66a7aa1a0ad3fb78..e895bca1e8bd6ec9f833b43d0b15754d5b0e1495 100644 --- a/app/code/Magento/Customer/etc/frontend/page_types.xml +++ b/app/code/Magento/Customer/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="customer_account_confirmation" label="Customer Account Confirmation"/> <type id="customer_account_create" label="Customer Account Registration Form"/> <type id="customer_account_createpassword" label="Reset a Password"/> diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index 33f923e05015b2ac6618f497ca5ea129be68bb74..973c14db73d61034756a46694f3abab1856ed480 100644 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> - <module name="Magento_Customer" setup_version="2.0.0.1"> + <module name="Magento_Customer" setup_version="2.0.0.2"> <sequence> <module name="Magento_Eav"/> <module name="Magento_Directory"/> diff --git a/app/code/Magento/Customer/view/adminhtml/templates/tab/addresses.phtml b/app/code/Magento/Customer/view/adminhtml/templates/tab/addresses.phtml index 7caea5e2d5ae8360469eb9b0ade87f66b5c51da0..a800f91781e3f6cf2fcf8d966186e2a50e17ed3f 100644 --- a/app/code/Magento/Customer/view/adminhtml/templates/tab/addresses.phtml +++ b/app/code/Magento/Customer/view/adminhtml/templates/tab/addresses.phtml @@ -11,20 +11,20 @@ <script data-template="tab-address-content" type="text/x-magento-template"> <div> <% if (data.prefix || data.firstname || data.middlename || data.lastname || data.suffix) { %> - <%= data.prefix %> <%= data.firstname %> <%= data.middlename %> <%= data.lastname %> <%= data.suffix %><br/> + <%- data.prefix %> <%- data.firstname %> <%- data.middlename %> <%- data.lastname %> <%- data.suffix %><br/> <% } %> - <% if (data.company) { %><%= data.company %><br/><% } %> - <% if (data.street0) { %><%= data.street0 %><br/><% } %> - <% if (data.street1) { %><%= data.street1 %><br/><% } %> - <% if (data.street2) { %><%= data.street2 %><br/><% } %> - <% if (data.street3) { %><%= data.street3 %><br/><% } %> + <% if (data.company) { %><%- data.company %><br/><% } %> + <% if (data.street0) { %><%- data.street0 %><br/><% } %> + <% if (data.street1) { %><%- data.street1 %><br/><% } %> + <% if (data.street2) { %><%- data.street2 %><br/><% } %> + <% if (data.street3) { %><%- data.street3 %><br/><% } %> <% if (data.city || data.region || data.postcode) { %> - <% if (data.city) { %><%= data.city %><% } %><% if (data.region) { %><% if (data.city) { %>, <% } %><%= data.region %><% } %><% if (data.postcode) { %><% if (data.city || data.region) { %>, <% } %><%= data.postcode %><% } %><br/> + <% if (data.city) { %><%- data.city %><% } %><% if (data.region) { %><% if (data.city) { %>, <% } %><%- data.region %><% } %><% if (data.postcode) { %><% if (data.city || data.region) { %>, <% } %><%- data.postcode %><% } %><br/> <% } %> - <% if (data.country_id) { %><%= data.country_id %><br/><% } %> - <% if (data.telephone) { %>T: <%= data.telephone %><br/><% } %> - <% if (data.fax) { %>F: <%= data.fax %><br/><% } %> - <% if (data.vat_id) { %>VAT: <%= data.vat_id %><% } %> + <% if (data.country_id) { %><%- data.country_id %><br/><% } %> + <% if (data.telephone) { %>T: <%- data.telephone %><br/><% } %> + <% if (data.fax) { %>F: <%- data.fax %><br/><% } %> + <% if (data.vat_id) { %>VAT: <%- data.vat_id %><% } %> </div> </script> @@ -95,11 +95,11 @@ <!-- Template for adding address item to list --> <script data-template="address-tab" type="text/x-magento-template"> <div id="address_item_template" class="hidden template"> - <li class="address-list-item" id="address_item_<%= data.itemId %>" data-item="<%= data.itemId %>"> - <a href="#form_new_item<%= data.itemId %>" data-mage-init='{"dataItemDeleteButton": {}}'> + <li class="address-list-item" id="address_item_<%- data.itemId %>" data-item="<%- data.itemId %>"> + <a href="#form_new_item<%- data.itemId %>" data-mage-init='{"dataItemDeleteButton": {}}'> <?php if (!$block->isReadonly()): ?> <div class="address-list-item-actions"> - <button class="action-delete" type="button" title="Remove address" id="delete_button<%= data.itemId %>" data-role="delete"> + <button class="action-delete" type="button" title="Remove address" id="delete_button<%- data.itemId %>" data-role="delete"> <span>Remove address</span> </button> <button class="action-edit" type="button" title="Edit address"> @@ -113,14 +113,14 @@ </address> </a> <div class="field choice field-address-item-billing"> - <input type="checkbox" <?php if ($block->isReadonly()):?> disabled="disabled"<?php endif;?> value="_item<%= data.itemId %>" id="address_item_billing_item<%= data.itemId %>" name="account[default_billing]" title="<?php echo __('Set as Default Billing Address') ?>" /> - <label class="label" for="address_item_billing_item<%= data.itemId %>"> + <input type="checkbox" <?php if ($block->isReadonly()):?> disabled="disabled"<?php endif;?> value="_item<%- data.itemId %>" id="address_item_billing_item<%- data.itemId %>" name="account[default_billing]" title="<?php echo __('Set as Default Billing Address') ?>" /> + <label class="label" for="address_item_billing_item<%- data.itemId %>"> <span><?php echo __('Default Billing Address') ?></span> </label> </div> <div class="field choice field-address-item-shipping"> - <input type="checkbox" <?php if ($block->isReadonly()):?> disabled="disabled"<?php endif;?> value="_item<%= data.itemId %>" id="address_item_shipping_item<%= data.itemId %>" name="account[default_shipping]" title="<?php echo __('Set as Default Shipping Address') ?>"/> - <label class="label" for="address_item_shipping_item<%= data.itemId %>"> + <input type="checkbox" <?php if ($block->isReadonly()):?> disabled="disabled"<?php endif;?> value="_item<%- data.itemId %>" id="address_item_shipping_item<%- data.itemId %>" name="account[default_shipping]" title="<?php echo __('Set as Default Shipping Address') ?>"/> + <label class="label" for="address_item_shipping_item<%- data.itemId %>"> <span><?php echo __('Default Shipping Address') ?></span> </label> </div> @@ -132,8 +132,8 @@ <?php $_templatePrefix = $block->getTemplatePrefix() ?> <script data-template="address-form" type="text/x-magento-template"> <div id="address_form_template" class="no-display template"><!-- Don`t delete class no-display, save customer stops work --> - <div id="form_<%= data.formName %>" data-item="<%= data.itemCount %>" class="address-item-edit-content" - data-mage-init='{"observableInputs":{"name": "<%= data.formName %>"}}'> + <div id="form_<%- data.formName %>" data-item="<%- data.itemCount %>" class="address-item-edit-content" + data-mage-init='{"observableInputs":{"name": "<%- data.formName %>"}}'> <?php // Set form template elements prefix $block->getForm()->setHtmlIdPrefix($_templatePrefix) diff --git a/app/code/Magento/Customer/view/adminhtml/templates/tab/view/personal_info.phtml b/app/code/Magento/Customer/view/adminhtml/templates/tab/view/personal_info.phtml index 51204820fd18123d88d90b6c07aadda993728468..e87d3005a1dad3e90d4d06b8c67ea73f561627e7 100644 --- a/app/code/Magento/Customer/view/adminhtml/templates/tab/view/personal_info.phtml +++ b/app/code/Magento/Customer/view/adminhtml/templates/tab/view/personal_info.phtml @@ -10,8 +10,11 @@ * Template for block \Magento\Customer\Block\Adminhtml\Edit\Tab\View\Status\PersonalInfo */ -$createDateAdmin = $block->getCreateDate(); -$createDateStore = $block->getStoreCreateDate(); +$lastLoginDateAdmin = $block->getLastLoginDate(); +$lastLoginDateStore = $block->getStoreLastLoginDate(); + +$createDateAdmin = $block->getCreateDate(); +$createDateStore = $block->getStoreCreateDate(); ?> <div class="fieldset-wrapper customer-information"> @@ -21,6 +24,16 @@ $createDateStore = $block->getStoreCreateDate(); <table class="data-table"> <tbody> <?php echo $block->getChildHtml(); ?> + <tr> + <th><?php echo __('Last Logged In:') ?></th> + <td><?php echo $lastLoginDateAdmin ?> (<?php echo $block->getCurrentStatus() ?>)</td> + </tr> + <?php if ($lastLoginDateAdmin != $lastLoginDateStore): ?> + <tr> + <th><?php echo __('Last Logged In (%1):', $block->getStoreLastLoginDateTimezone()) ?></th> + <td><?php echo $lastLoginDateStore ?> (<?php echo $block->getCurrentStatus() ?>)</td> + </tr> + <?php endif; ?> <tr> <th><?php echo __('Confirmed email:') ?></th> <td><?php echo $block->getIsConfirmedStatus() ?></td> diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml index c5b7b4ed77af6114c5ee5edc8d46901c256b8e42..c931d10ffacfca9771214fa8b2186555d5e516de 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml @@ -11,7 +11,7 @@ <block class="Magento\Framework\View\Element\Js\Components" name="customer_account_create_head_components" template="Magento_Customer::js/components.phtml"/> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="form/register.phtml" cacheable="false"> + <block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="form/register.phtml"> <container name="form.additional.info" as="form_additional_info"/> <container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/> </block> diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml index 6a2d849c364d45f46a674d4ab4c011053cb0cc94..6dafbfb6cecb2b19cc5f787050abb2065a05d163 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account_login.xml @@ -10,10 +10,10 @@ <referenceContainer name="content"> <!-- customer.form.login.extra --> <container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container"> - <block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="form/login.phtml" cacheable="false"> + <block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="form/login.phtml"> <container name="form.additional.info" as="form_additional_info"/> </block> - <block class="Magento\Customer\Block\Form\Login" name="customer.new" template="newcustomer.phtml" cacheable="false"/> + <block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="newcustomer.phtml"/> </container> <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml"> <arguments> diff --git a/app/code/Magento/Customer/view/frontend/templates/newcustomer.phtml b/app/code/Magento/Customer/view/frontend/templates/newcustomer.phtml index 31e31a9dfa48c4db9eda150b348df3a10a12e637..e4609e91131483a037adc9d592d72d6455cb2f09 100644 --- a/app/code/Magento/Customer/view/frontend/templates/newcustomer.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/newcustomer.phtml @@ -11,7 +11,7 @@ /** * New Customer block template * - * @var $block \Magento\Customer\Block\Form\Login + * @var $block \Magento\Customer\Block\Form\Login\Info */ ?> <?php if ($block->getRegistration()->isAllowed()): ?> diff --git a/app/code/Magento/CustomerImportExport/etc/config.xml b/app/code/Magento/CustomerImportExport/etc/config.xml index 02000ca611d79749eb2fa68a74a39ff5bd3953be..000eef6ea21c83cdda49761e7cc61d40484fa993 100644 --- a/app/code/Magento/CustomerImportExport/etc/config.xml +++ b/app/code/Magento/CustomerImportExport/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <export> <customer_page_size> diff --git a/app/code/Magento/DesignEditor/etc/config.xml b/app/code/Magento/DesignEditor/etc/config.xml index c343d59d0bb703575be2d01364566f11d74aafd6..f977f5d456b01c2edeed42f04491d9050fd87e6a 100644 --- a/app/code/Magento/DesignEditor/etc/config.xml +++ b/app/code/Magento/DesignEditor/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <theme> <customization> diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml index 8e71ed9541144c18cdaa6f9784aa0216d361b987..8958f0301853197e9e989924c60f02b5dc0260b5 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml +++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/code/js.phtml @@ -28,8 +28,8 @@ </div> </div> <script id="js-file-uploader-template" type="text/x-magento-template"> - <div id="<%= data.id %>" class="file-row"> - <span class="file-info"><%= data.name %> (<%= data.size %>)</span> + <div id="<%- data.id %>" class="file-row"> + <span class="file-info"><%- data.name %> (<%- data.size %>)</span> <div class="progressbar-container"> <div class="progressbar upload-progress" style="width: 0%;"></div> </div> @@ -38,8 +38,8 @@ </script> <script id="js-uploaded-file-template" type="text/x-magento-template"> - <span class="filename" title="<%= data.name %>"><%= data.name %></span> - <a href="#" class="action-delete" title="<?php echo __('Delete File'); ?>" data-id="<%= data.id %>"> + <span class="filename" title="<%- data.name %>"><%- data.name %></span> + <a href="#" class="action-delete" title="<?php echo __('Delete File'); ?>" data-id="<%- data.id %>"> <span><?php echo __('Delete File'); ?></span> </a> </script> diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml index 792be29aa981896889296e1a85ff669cde14a706..dbda7bb3e0d47595072a0c13e8f68ce6f50594e7 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml +++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/content/uploader.phtml @@ -10,15 +10,15 @@ <div class="scroll-assets"> <script data-template="<?php echo $block->getHtmlId() ?>-template" type="text/x-magento-template"> <div class="progressbar-container"> - <div class="file-row" data-upload-id="<%= data.id %>"> - <span class="file-info-name"><%= data.name %></span> + <div class="file-row" data-upload-id="<%- data.id %>"> + <span class="file-info-name"><%- data.name %></span> <span class="file-info-details"> - <span class="file-info-size">(<%= data.size %>)</span> + <span class="file-info-size">(<%- data.size %>)</span> <span class="file-info-error hidden"> </span> </span> <span class="file-icon"> <span class="file-info-cancel"> - <button type="button" class="action-delete" data-delete-file="<%= data.id %>"> + <button type="button" class="action-delete" data-delete-file="<%- data.id %>"> <span><?php echo __('Remove'); ?></span> </button> </span> diff --git a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml index 705b5bcde58bb20c707e747c50bc73ef38b0fb36..c16bce0be3303278b3aa6c8643b22e77229a034b 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml +++ b/app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml @@ -35,8 +35,7 @@ require([ "extjs/ext-tree-checkbox", 'Magento_DesignEditor/js/tools-files' ], function(jQuery){ - -Ext.onReady(function(){ +jQuery(function(){ var Tree = Ext.tree; var tree = new Tree.TreePanel('tree', { animate:true, diff --git a/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js b/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js index 983fff295955bc254d03667afaa8dc3bf101f994..d19339d3f2552893755b919cf4232eef13dc86e3 100644 --- a/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js +++ b/app/code/Magento/DesignEditor/view/adminhtml/web/js/dialog.js @@ -46,7 +46,7 @@ define([ return ['success', 'error', 'info'].indexOf(type) != -1; }, _prepareMessage: function(message, type) { - var tmpl = mageTemplate('<div class="<%= data.classes %>"><%= data.message %></div>'); + var tmpl = mageTemplate('<div class="<%- data.classes %>"><%- data.message %></div>'); if (typeof message != 'string' && message.message && message.type) { type = message.type; @@ -99,9 +99,6 @@ define([ * @param {Array.<Object>|Object} buttons */ set: function (title, text, buttons) { - title = $.mage.__(title); - text = $.mage.__(text); - this.text.set(text); this.title.set(title); this.setButtons(buttons); @@ -120,9 +117,6 @@ define([ if ($.type(buttons) !== 'array') { buttons = [buttons]; } - buttons.each(function(button){ - button.text = $.mage.__(button.text) - }); } var hasToAddCancel = (addCancel == undefined && buttons.length <= 1) || addCancel == true; @@ -146,8 +140,6 @@ define([ * @param {number} position */ addButton: function(button, position) { - button.text = $.mage.__(button.text) - var buttons = this.options.buttons; buttons.splice(position, 0, button); this._setOption('buttons', buttons); @@ -166,7 +158,7 @@ define([ position = buttonPointer; } else { //Find 1st button with given title - var title = $.mage.__(buttonPointer); + var title = buttonPointer; this.options.buttons.each(function(button, index) { if (button.text == title) { position = index; diff --git a/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml b/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml index b2486cfcbd3786e6f36430c4694c8efd6bb06d63..70ae82aee847533e40c9bf447e75c207c8c2d5ff 100644 --- a/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml +++ b/app/code/Magento/DesignEditor/view/frontend/templates/translate_inline.phtml @@ -13,19 +13,19 @@ <link rel="stylesheet" type="text/css" href="<?php echo $block->getViewFileUrl('mage/translate-inline-vde.css') ?>"/> <script id="translate-inline-dialog-form-template" type="text/x-magento-template"> - <form id="<%= data.id %>" data-form="translate-inline-dialog-form"> + <form id="<%- data.id %>" data-form="translate-inline-dialog-form"> <% _.each(data.items, function(item, index) { %> - <input id="perstore_<%= index %>" name="translate[<%= index %>][perstore]" type="hidden" value="0"/> - <input name="translate[<%= index %>][original]" type="hidden" value="<%= data.escape(item.original) %>"/> - <textarea id="custom_<%= index %>" - name="translate[<%= index %>][custom]" - data-translate-input-index="<%= index %>"><%= data.escape(item.translated) %></textarea> + <input id="perstore_<%- index %>" name="translate[<%- index %>][perstore]" type="hidden" value="0"/> + <input name="translate[<%- index %>][original]" type="hidden" value="<%- data.escape(item.original) %>"/> + <textarea id="custom_<%- index %>" + name="translate[<%- index %>][custom]" + data-translate-input-index="<%- index %>"><%- data.escape(item.translated) %></textarea> <% }); %> </form> </script> <script data-template="translate-inline-icon" type="text/x-magento-template"> - <img src="<%= data.img %>" height="16" width="16" class="translate-edit-icon"> + <img src="<%- data.img %>" height="16" width="16" class="translate-edit-icon"> </script> <div id="translate-dialog" data-role="translate-dialog" diff --git a/app/code/Magento/Developer/etc/config.xml b/app/code/Magento/Developer/etc/config.xml index a669e0d6b6d8407587ffb65f7e694d68497b6214..e89e173e832768926551bac312375247c148205b 100644 --- a/app/code/Magento/Developer/etc/config.xml +++ b/app/code/Magento/Developer/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <dev> <restrict> diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index 024ef97396a6f20436526ca37ff0c47b86c4bb56..6c64a3d0f59f0196fa54970d40fb641cf582323c 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -8,7 +8,6 @@ "magento/module-shipping": "0.42.0-beta11", "magento/module-backend": "0.42.0-beta11", "magento/module-directory": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-sales": "0.42.0-beta11", "magento/module-checkout": "0.42.0-beta11", "magento/module-catalog": "0.42.0-beta11", diff --git a/app/code/Magento/Dhl/etc/config.xml b/app/code/Magento/Dhl/etc/config.xml index c491e6e10f53538c51ba195997e5be8ca846f498..0d60e087a0e35b88c4d858b5332e5338dea2385c 100644 --- a/app/code/Magento/Dhl/etc/config.xml +++ b/app/code/Magento/Dhl/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <system> <media_storage_configuration> diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index 8e66ab394fbb810a2f46479afb74b859b3472301..d13968038ae92aa7d937ba680efeaaf6f043de8f 100644 --- a/app/code/Magento/Directory/composer.json +++ b/app/code/Magento/Directory/composer.json @@ -5,7 +5,6 @@ "php": "~5.5.0|~5.6.0", "magento/module-config": "0.42.0-beta11", "magento/module-store": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-backend": "0.42.0-beta11", "magento/framework": "0.42.0-beta11", "lib-libxml": "*", diff --git a/app/code/Magento/Directory/etc/config.xml b/app/code/Magento/Directory/etc/config.xml index 60328d17d8c195a18c7ff7434a4f22abd4aac4ab..54cec22d63ee92e7b5143778d51b003a09dc604f 100644 --- a/app/code/Magento/Directory/etc/config.xml +++ b/app/code/Magento/Directory/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <system> <currency> diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml index c2f5119fbd915909fea91d4cdabe08b702d6de7a..385b4422a936a867361ddb7f3c0cc21f94f5b52b 100644 --- a/app/code/Magento/Directory/etc/module.xml +++ b/app/code/Magento/Directory/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Directory" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Downloadable/Api/Data/File/ContentInterface.php b/app/code/Magento/Downloadable/Api/Data/File/ContentInterface.php index ce1e4b8afa1e879f97a18a87ad68bbc2d35f2a68..01194703cbb86cb65e151634f862f7fa794f46df 100644 --- a/app/code/Magento/Downloadable/Api/Data/File/ContentInterface.php +++ b/app/code/Magento/Downloadable/Api/Data/File/ContentInterface.php @@ -39,4 +39,21 @@ interface ContentInterface extends \Magento\Framework\Api\ExtensibleDataInterfac * @return $this */ public function setName($name); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Downloadable\Api\Data\File\ContentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Downloadable\Api\Data\File\ContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Downloadable\Api\Data\File\ContentExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Downloadable/Api/Data/LinkContentInterface.php b/app/code/Magento/Downloadable/Api/Data/LinkContentInterface.php index ec82d46a008cbfd001d906913eefbd35a81497c7..1972068f435512611b3d564f875ec666f6d20b56 100644 --- a/app/code/Magento/Downloadable/Api/Data/LinkContentInterface.php +++ b/app/code/Magento/Downloadable/Api/Data/LinkContentInterface.php @@ -174,4 +174,21 @@ interface LinkContentInterface extends \Magento\Framework\Api\ExtensibleDataInte * @return $this */ public function setSampleType($sampleType); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Downloadable\Api\Data\LinkContentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Downloadable\Api\Data\LinkContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Downloadable\Api\Data\LinkContentExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Downloadable/Api/Data/LinkInterface.php b/app/code/Magento/Downloadable/Api/Data/LinkInterface.php index df4f97a055ee838142ac05c0e5ee91f9bd0663b9..0152a1a256540db9b0cab423e2804bd906475245 100644 --- a/app/code/Magento/Downloadable/Api/Data/LinkInterface.php +++ b/app/code/Magento/Downloadable/Api/Data/LinkInterface.php @@ -173,4 +173,19 @@ interface LinkInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setSampleUrl($sampleUrl); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Downloadable\Api\Data\LinkExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Downloadable\Api\Data\LinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Downloadable\Api\Data\LinkExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Downloadable/Api/Data/SampleContentInterface.php b/app/code/Magento/Downloadable/Api/Data/SampleContentInterface.php index 03864afad3dd6a7b98683ed4a7ae53bf2e1f0734..b4b0580bda1879b6aa75ab70371f6c522b7d1100 100644 --- a/app/code/Magento/Downloadable/Api/Data/SampleContentInterface.php +++ b/app/code/Magento/Downloadable/Api/Data/SampleContentInterface.php @@ -84,4 +84,21 @@ interface SampleContentInterface extends \Magento\Framework\Api\ExtensibleDataIn * @return $this */ public function setSampleUrl($sampleUrl); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Downloadable\Api\Data\SampleContentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Downloadable\Api\Data\SampleContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Downloadable\Api\Data\SampleContentExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Downloadable/Api/Data/SampleInterface.php b/app/code/Magento/Downloadable/Api/Data/SampleInterface.php index aff31bf3f413f1b8ae20691678faaa0261d6b023..3d6dfc937f3871a4a489e43c1f1912c5a7498082 100644 --- a/app/code/Magento/Downloadable/Api/Data/SampleInterface.php +++ b/app/code/Magento/Downloadable/Api/Data/SampleInterface.php @@ -96,4 +96,21 @@ interface SampleInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setSampleUrl($sampleUrl); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Downloadable\Api\Data\SampleExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Downloadable\Api\Data\SampleExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Downloadable\Api\Data\SampleExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Downloadable/Api/LinkRepositoryInterface.php b/app/code/Magento/Downloadable/Api/LinkRepositoryInterface.php index 58bad33a356c9262d1bee8cb6308ed87560e8d3c..a8bd6f83d9be190834e0e92d34c039010a4d870c 100644 --- a/app/code/Magento/Downloadable/Api/LinkRepositoryInterface.php +++ b/app/code/Magento/Downloadable/Api/LinkRepositoryInterface.php @@ -12,29 +12,29 @@ interface LinkRepositoryInterface /** * List of samples for downloadable product * - * @param string $productSku + * @param string $sku * @return \Magento\Downloadable\Api\Data\SampleInterface[] */ - public function getSamples($productSku); + public function getSamples($sku); /** * List of links with associated samples * - * @param string $productSku + * @param string $sku * @return \Magento\Downloadable\Api\Data\LinkInterface[] */ - public function getLinks($productSku); + public function getLinks($sku); /** * Update downloadable link of the given product (link type and its resources cannot be changed) * - * @param string $productSku + * @param string $sku * @param \Magento\Downloadable\Api\Data\LinkContentInterface $linkContent * @param int $linkId * @param bool $isGlobalScopeContent * @return int */ - public function save($productSku, LinkContentInterface $linkContent, $linkId = null, $isGlobalScopeContent = false); + public function save($sku, LinkContentInterface $linkContent, $linkId = null, $isGlobalScopeContent = false); /** * Delete downloadable link diff --git a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php index 5b6c1b0960b4d8366c54d9be8bbcefb02e7c438b..1e09a35920dae97946d759c147f82b3b264ef7e0 100644 --- a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php +++ b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php @@ -155,7 +155,7 @@ class ListProducts extends \Magento\Framework\View\Element\Template */ public function getDownloadUrl($item) { - return $this->getUrl('*/download/link', ['id' => $item->getLinkHash(), '_secure' => true]); + return $this->getUrl('downloadable/download/link', ['id' => $item->getLinkHash(), '_secure' => true]); } /** diff --git a/app/code/Magento/Downloadable/Model/File/Content.php b/app/code/Magento/Downloadable/Model/File/Content.php index e59ffc9dd605df594e47245d6fb41c15396615c1..5fdd65fa9440b49cde9988cf97516e42a335fbed 100644 --- a/app/code/Magento/Downloadable/Model/File/Content.php +++ b/app/code/Magento/Downloadable/Model/File/Content.php @@ -56,4 +56,26 @@ class Content extends \Magento\Framework\Model\AbstractExtensibleModel implement { return $this->setData(self::NAME, $name); } + + /** + * {@inheritdoc} + * + * @return \Magento\Downloadable\Api\Data\File\ContentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Downloadable\Api\Data\File\ContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Downloadable\Api\Data\File\ContentExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Downloadable/Model/Link.php b/app/code/Magento/Downloadable/Model/Link.php index 8bd4c56a3148efd24a471da136de198037f5f76d..84de54915ab0edec47b492ac19a2fde4f5d131b4 100644 --- a/app/code/Magento/Downloadable/Model/Link.php +++ b/app/code/Magento/Downloadable/Model/Link.php @@ -6,8 +6,6 @@ namespace Magento\Downloadable\Model; use Magento\Downloadable\Api\Data\LinkInterface; -use Magento\Framework\Api\AttributeDataBuilder; -use Magento\Framework\Api\MetadataServiceInterface; use Magento\Downloadable\Model\Resource\Link as Resource; /** @@ -51,20 +49,10 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements C const KEY_SAMPLE_URL = 'sample_url'; /**#@-*/ - /** - * @var MetadataServiceInterface - */ - protected $metadataService; - - /** - * @var AttributeDataBuilder - */ - protected $customAttributeBuilder; - /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -73,7 +61,7 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements C public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, @@ -82,7 +70,7 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements C parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -373,5 +361,26 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements C { return $this->setData(self::KEY_SAMPLE_URL, $sampleUrl); } + + /** + * {@inheritdoc} + * + * @return \Magento\Downloadable\Api\Data\LinkExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Downloadable\Api\Data\LinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Downloadable\Api\Data\LinkExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Downloadable/Model/Link/Content.php b/app/code/Magento/Downloadable/Model/Link/Content.php index 071e130a25de07bdc7af2306dacd793eec172f52..a40f76faf1cff5c353a8406943c9b51b4f95e428 100644 --- a/app/code/Magento/Downloadable/Model/Link/Content.php +++ b/app/code/Magento/Downloadable/Model/Link/Content.php @@ -243,4 +243,26 @@ class Content extends \Magento\Framework\Model\AbstractExtensibleModel implement { return $this->setData(self::SAMPLE_TYPE, $sampleType); } + + /** + * {@inheritdoc} + * + * @return \Magento\Downloadable\Api\Data\LinkContentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Downloadable\Api\Data\LinkContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Downloadable\Api\Data\LinkContentExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Downloadable/Model/LinkRepository.php b/app/code/Magento/Downloadable/Model/LinkRepository.php index 586c22a32d4dc5dc4a1ce18ca029fb6feb4feee3..217e5ae59cea4f9dc81bfa6079a2bd49f1efc022 100644 --- a/app/code/Magento/Downloadable/Model/LinkRepository.php +++ b/app/code/Magento/Downloadable/Model/LinkRepository.php @@ -90,11 +90,11 @@ class LinkRepository implements \Magento\Downloadable\Api\LinkRepositoryInterfac /** * {@inheritdoc} */ - public function getLinks($productSku) + public function getLinks($sku) { $linkList = []; /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); $links = $this->downloadableType->getLinks($product); /** @var \Magento\Downloadable\Model\Link $link */ foreach ($links as $link) { @@ -150,11 +150,11 @@ class LinkRepository implements \Magento\Downloadable\Api\LinkRepositoryInterfac /** * {@inheritdoc} */ - public function getSamples($productSku) + public function getSamples($sku) { $sampleList = []; /** @var \Magento\Catalog\Model\Product $product */ - $product = $this->productRepository->get($productSku); + $product = $this->productRepository->get($sku); $samples = $this->downloadableType->getSamples($product); /** @var \Magento\Downloadable\Model\Sample $sample */ foreach ($samples as $sample) { @@ -181,9 +181,9 @@ class LinkRepository implements \Magento\Downloadable\Api\LinkRepositoryInterfac * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function save($productSku, LinkContentInterface $linkContent, $linkId = null, $isGlobalScopeContent = false) + public function save($sku, LinkContentInterface $linkContent, $linkId = null, $isGlobalScopeContent = false) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); if ($linkId) { /** @var $link \Magento\Downloadable\Model\Link */ @@ -222,7 +222,7 @@ class LinkRepository implements \Magento\Downloadable\Api\LinkRepositoryInterfac ->save(); return $link->getId(); } else { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($sku, true); if ($product->getTypeId() !== \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) { throw new InputException('Product type of the product must be \'downloadable\'.'); } diff --git a/app/code/Magento/Downloadable/Model/Sample.php b/app/code/Magento/Downloadable/Model/Sample.php index 23cd6bd9408e61195d3f1eb6955363cc77fa514c..07dd821050aad1d60ae18abc38211afdd1fb4a55 100644 --- a/app/code/Magento/Downloadable/Model/Sample.php +++ b/app/code/Magento/Downloadable/Model/Sample.php @@ -33,7 +33,7 @@ class Sample extends \Magento\Framework\Model\AbstractExtensibleModel implements /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -42,7 +42,7 @@ class Sample extends \Magento\Framework\Model\AbstractExtensibleModel implements public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, @@ -51,7 +51,7 @@ class Sample extends \Magento\Framework\Model\AbstractExtensibleModel implements parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -224,4 +224,25 @@ class Sample extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_SAMPLE_URL, $sampleUrl); } + + /** + * {@inheritdoc} + * + * @return \Magento\Downloadable\Api\Data\SampleExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Downloadable\Api\Data\SampleExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Downloadable\Api\Data\SampleExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Downloadable/Model/Sample/Content.php b/app/code/Magento/Downloadable/Model/Sample/Content.php index f60f92f9d11f91e86de522f3d346030e694f5178..0fcf613353966548cfbf6ec83e2ca47837ff9f54 100644 --- a/app/code/Magento/Downloadable/Model/Sample/Content.php +++ b/app/code/Magento/Downloadable/Model/Sample/Content.php @@ -117,4 +117,26 @@ class Content extends \Magento\Framework\Model\AbstractExtensibleModel implement { return $this->setData(self::SAMPLE_URL, $sampleUrl); } + + /** + * {@inheritdoc} + * + * @return \Magento\Downloadable\Api\Data\SampleContentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Downloadable\Api\Data\SampleContentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Downloadable\Api\Data\SampleContentExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Downloadable/etc/config.xml b/app/code/Magento/Downloadable/etc/config.xml index e0460f6028eeb68ff4c51eb964a9d97e9ac32198..4cd8938ad25e8124510f74e2ce8e4395de9573ef 100644 --- a/app/code/Magento/Downloadable/etc/config.xml +++ b/app/code/Magento/Downloadable/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <catalog> <downloadable> diff --git a/app/code/Magento/Downloadable/etc/frontend/page_types.xml b/app/code/Magento/Downloadable/etc/frontend/page_types.xml index caa1839665d6da8eb350758d7d39f415e3bb1bba..609bc5837c17881bbedddb11c42a5e61e8de729a 100644 --- a/app/code/Magento/Downloadable/etc/frontend/page_types.xml +++ b/app/code/Magento/Downloadable/etc/frontend/page_types.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="downloadable_customer_products" label="Customer My Account Downloadable Items"/> </page_types> diff --git a/app/code/Magento/Downloadable/etc/webapi.xml b/app/code/Magento/Downloadable/etc/webapi.xml index 7a95a353ded05feb876d90d6b96361cce19ef9eb..0291fe5322f8328380ab63b58dfd7b8b8322dbe2 100644 --- a/app/code/Magento/Downloadable/etc/webapi.xml +++ b/app/code/Magento/Downloadable/etc/webapi.xml @@ -7,25 +7,25 @@ --> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> - <route url="/V1/products/:productSku/downloadable-links" method="GET"> + <route url="/V1/products/:sku/downloadable-links" method="GET"> <service class="Magento\Downloadable\Api\LinkRepositoryInterface" method="getLinks"/> <resources> <resource ref="Magento_Downloadable::downloadable" /> </resources> </route> - <route url="/V1/products/:productSku/downloadable-links/samples" method="GET"> + <route url="/V1/products/:sku/downloadable-links/samples" method="GET"> <service class="Magento\Downloadable\Api\LinkRepositoryInterface" method="getSamples"/> <resources> <resource ref="Magento_Downloadable::downloadable" /> </resources> </route> - <route url="/V1/products/:productSku/downloadable-links" method="POST"> + <route url="/V1/products/:sku/downloadable-links" method="POST"> <service class="Magento\Downloadable\Api\LinkRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Downloadable::downloadable" /> </resources> </route> - <route url="/V1/products/:productSku/downloadable-links/:linkId" method="PUT"> + <route url="/V1/products/:sku/downloadable-links/:linkId" method="PUT"> <service class="Magento\Downloadable\Api\LinkRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Downloadable::downloadable" /> @@ -37,13 +37,13 @@ <resource ref="Magento_Downloadable::downloadable" /> </resources> </route> - <route url="/V1/products/:productSku/downloadable-links/samples" method="POST"> + <route url="/V1/products/:sku/downloadable-links/samples" method="POST"> <service class="Magento\Downloadable\Api\SampleRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Downloadable::downloadable" /> </resources> </route> - <route url="/V1/products/:productSku/downloadable-links/samples/:sampleId" method="PUT"> + <route url="/V1/products/:sku/downloadable-links/samples/:sampleId" method="PUT"> <service class="Magento\Downloadable\Api\SampleRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Downloadable::downloadable" /> diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml index aa2a922757ac2a5c6a1da63ac097b9a9bf1106dd..db3a01d67c3cf61a3b8469d5b995c2dbd79b0810 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable.phtml @@ -24,11 +24,11 @@ require([ //<![CDATA[> var uploaderTemplate = '<div class="no-display" id="[[idName]]-template">' + - '<div id="<%= data.id %>" class="file-row file-row-narrow">' + + '<div id="<%- data.id %>" class="file-row file-row-narrow">' + '<span class="file-info">' + - '<span class="file-info-name"><%= data.name %></span>' + + '<span class="file-info-name"><%- data.name %></span>' + ' ' + - '<span class="file-info-size">(<%= data.size %>)</span>' + + '<span class="file-info-size">(<%- data.size %>)</span>' + '</span>' + '<div class="progressbar-container">' + '<div class="progressbar upload-progress" style="width: 0%;"></div>' + @@ -37,13 +37,13 @@ var uploaderTemplate = '<div class="no-display" id="[[idName]]-template">' + '</div>' + '</div>' + '<div class="no-display" id="[[idName]]-template-progress">' + - '<%= data.percent %>% <%= data.uploaded %> / <%= data.total %>' + + '<%- data.percent %>% <%- data.uploaded %> / <%- data.total %>' + '</div>'; var fileListTemplate = '<span class="file-info">' + - '<span class="file-info-name"><%= data.name %></span>' + + '<span class="file-info-name"><%- data.name %></span>' + ' ' + - '<span class="file-info-size">(<%= data.size %>)</span>' + + '<span class="file-info-size">(<%- data.size %>)</span>' + '</span>'; window.Downloadable = { diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml index b110d63d00c79b245d5cb4f6b48c8814b43b025a..bf2b72140ba8a082faa3e7824016fe7310ce724b 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml @@ -80,29 +80,29 @@ require([ registry.get('downloadable', function (Downloadable) { var linkTemplate = '<tr>'+ '<td>'+ - '<input type="hidden" class="__delete__" name="downloadable[link][<%= data.id %>][is_delete]" value="" />'+ - '<input type="hidden" name="downloadable[link][<%= data.id %>][link_id]" value="<%= data.link_id %>" />'+ - '<input type="text" class="required-entry input-text" name="downloadable[link][<%= data.id %>][title]" value="<%= data.title %>" />'+ - '<?php echo $_product->getStoreId() ? '<input type="checkbox" id="downloadable_link_<%= data.id %>_title" name="downloadable[link][<%= data.id %>][use_default_title]" value="1" /><label class="normal" for="downloadable_link_<%= data.id %>_title">Use Default Value</label>' : '' ?>'+ + '<input type="hidden" class="__delete__" name="downloadable[link][<%- data.id %>][is_delete]" value="" />'+ + '<input type="hidden" name="downloadable[link][<%- data.id %>][link_id]" value="<%- data.link_id %>" />'+ + '<input type="text" class="required-entry input-text" name="downloadable[link][<%- data.id %>][title]" value="<%- data.title %>" />'+ + '<?php echo $_product->getStoreId() ? '<input type="checkbox" id="downloadable_link_<%- data.id %>_title" name="downloadable[link][<%- data.id %>][use_default_title]" value="1" /><label class="normal" for="downloadable_link_<%- data.id %>_title">Use Default Value</label>' : '' ?>'+ '</td>'+ <?php if ($block->getCanReadPrice() !== false) : ?> '<td class="input-price">'+ - '<input type="text" id="downloadable_link_<%= data.id %>_price_value" class="input-text validate-number link-prices<?php if ($block->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][<%= data.id %>][price]" value="<%= data.price %>"<?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' + + '<input type="text" id="downloadable_link_<%- data.id %>_price_value" class="input-text validate-number link-prices<?php if ($block->getCanEditPrice() === false) : ?> disabled<?php endif; ?>" name="downloadable[link][<%- data.id %>][price]" value="<%- data.price %>"<?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> ' + '<label>[<?php echo $block->getBaseCurrencyCode($_product->getStoreId()) ?>]</label>' + <?php if ($_product->getStoreId() && $block->getIsPriceWebsiteScope()) : ?> - '<br /><input type="checkbox" id="downloadable_link_<%= data.id %>_price" name="downloadable[link][<%= data.id %>][use_default_price]" value="1"<?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> <label for="downloadable_link_<%= data.id %>_price">Use Default Value</label>' + + '<br /><input type="checkbox" id="downloadable_link_<%- data.id %>_price" name="downloadable[link][<%- data.id %>][use_default_price]" value="1"<?php if ($block->getCanEditPrice() === false) : ?> disabled="disabled"<?php endif; ?> /> <label for="downloadable_link_<%- data.id %>_price">Use Default Value</label>' + <?php endif; ?> '</td>' + <?php else : ?> - '<input type="hidden" id="downloadable_link_<%= data.id %>_price_value" class="link-prices" name="downloadable[link][<%= data.id %>][price]" value="0" />' + + '<input type="hidden" id="downloadable_link_<%- data.id %>_price_value" class="link-prices" name="downloadable[link][<%- data.id %>][price]" value="0" />' + <?php if ($_product->getStoreId() && $block->getIsPriceWebsiteScope()) : ?> - '<input type="hidden" id="downloadable_link_<%= data.id %>_price" name="downloadable[link][<%= data.id %>][use_default_price]" value="1" />' + + '<input type="hidden" id="downloadable_link_<%- data.id %>_price" name="downloadable[link][<%- data.id %>][use_default_price]" value="1" />' + <?php endif; ?> <?php endif; ?> - '<td><input type="text" id="downloadable_link_<%= data.id %>_downloads" name="downloadable[link][<%= data.id %>][number_of_downloads]" class="input-text downloads" value="<%= data.number_of_downloads %>" />'+ - '<p><input type="checkbox" class="checkbox" id="downloadable_link_<%= data.id %>_is_unlimited" name="downloadable[link][<%= data.id %>][is_unlimited]" value="1" <%= data.is_unlimited %> /> <label for="downloadable_link_<%= data.id %>_is_unlimited">Unlimited</label></p></td>'+ + '<td><input type="text" id="downloadable_link_<%- data.id %>_downloads" name="downloadable[link][<%- data.id %>][number_of_downloads]" class="input-text downloads" value="<%- data.number_of_downloads %>" />'+ + '<p><input type="checkbox" class="checkbox" id="downloadable_link_<%- data.id %>_is_unlimited" name="downloadable[link][<%- data.id %>][is_unlimited]" value="1" <%- data.is_unlimited %> /> <label for="downloadable_link_<%- data.id %>_is_unlimited">Unlimited</label></p></td>'+ '<td>'+ - '<select id="downloadable_link _<%= data.id %>_shareable" name="downloadable[link][<%= data.id %>][is_shareable]">'+ + '<select id="downloadable_link _<%- data.id %>_shareable" name="downloadable[link][<%- data.id %>][is_shareable]">'+ '<option value="1">Yes</option>'+ '<option value="0">No</option>'+ '<option value="2" selected="selected">Use config</option>'+ @@ -111,58 +111,58 @@ require([ '<td>'+ '<div class="files">'+ '<div class="row">'+ - '<label for="downloadable_link_<%= data.id %>_sample_file_type"><input type="radio" class="radio" id="downloadable_link_<%= data.id %>_sample_file_type" name="downloadable[link][<%= data.id %>][sample][type]" value="file"<%= data.sample_file_checked %> /> File:</label>'+ - '<input type="hidden" id="downloadable_link_<%= data.id %>_sample_file_save" name="downloadable[link][<%= data.id %>][sample][file]" value="<%= data.sample_file_save %>" class="validate-downloadable-file"/>'+ - '<div id="downloadable_link_<%= data.id %>_sample_file" class="uploader">'+ - '<div id="downloadable_link_<%= data.id %>_sample_file-old" class="file-row-info"></div>'+ - '<div id="downloadable_link_<%= data.id %>_sample_file-new" class="file-row-info"></div>'+ + '<label for="downloadable_link_<%- data.id %>_sample_file_type"><input type="radio" class="radio" id="downloadable_link_<%- data.id %>_sample_file_type" name="downloadable[link][<%- data.id %>][sample][type]" value="file"<%- data.sample_file_checked %> /> File:</label>'+ + '<input type="hidden" id="downloadable_link_<%- data.id %>_sample_file_save" name="downloadable[link][<%- data.id %>][sample][file]" value="<%- data.sample_file_save %>" class="validate-downloadable-file"/>'+ + '<div id="downloadable_link_<%- data.id %>_sample_file" class="uploader">'+ + '<div id="downloadable_link_<%- data.id %>_sample_file-old" class="file-row-info"></div>'+ + '<div id="downloadable_link_<%- data.id %>_sample_file-new" class="file-row-info"></div>'+ '<div class="fileinput-button form-buttons">'+ '<span><?php echo __('Browse Files...') ?></span>' + - '<input id="downloadable_link_<%= data.id %>_sample_file" type="file" name="<?php echo $block->getFileFieldName('link_samples') ?>">' + + '<input id="downloadable_link_<%- data.id %>_sample_file" type="file" name="<?php echo $block->getFileFieldName('link_samples') ?>">' + '<script>' + - 'linksUploader("#downloadable_link_<%= data.id %>_sample_file", "<?php echo $block->getUploadUrl('link_samples') ?>"); ' + + 'linksUploader("#downloadable_link_<%- data.id %>_sample_file", "<?php echo $block->getUploadUrl('link_samples') ?>"); ' + '</scr'+'ipt>'+ '</div>'+ '<div class="clear"></div>'+ '</div>'+ '</div>'+ '<div class="row">'+ - '<label for="downloadable_link_<%= data.id %>_sample_url_type"><input type="radio" class="radio" id="downloadable_link_<%= data.id %>_sample_url_type" name="downloadable[link][<%= data.id %>][sample][type]" value="url"<%= data.sample_url_checked %> /> URL:</label><input type="text" class="input-text validate-downloadable-url validate-url" name="downloadable[link][<%= data.id %>][sample][url]" value="<%= data.sample_url %>" />'+ + '<label for="downloadable_link_<%- data.id %>_sample_url_type"><input type="radio" class="radio" id="downloadable_link_<%- data.id %>_sample_url_type" name="downloadable[link][<%- data.id %>][sample][type]" value="url"<%- data.sample_url_checked %> /> URL:</label><input type="text" class="input-text validate-downloadable-url validate-url" name="downloadable[link][<%- data.id %>][sample][url]" value="<%- data.sample_url %>" />'+ '</div>'+ '<div>'+ - '<span id="downloadable_link_<%= data.id %>_sample_container"></span>'+ + '<span id="downloadable_link_<%- data.id %>_sample_container"></span>'+ '</div>'+ '</div>'+ '</td>'+ '<td>'+ '<div class="files">'+ '<div class="row">'+ - '<label for="downloadable_link_<%= data.id %>_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_<%= data.id %>_file_type" name="downloadable[link][<%= data.id %>][type]" value="file"<%= data.file_checked %> /> File:</label>'+ - '<input type="hidden" class="validate-downloadable-file" id="downloadable_link_<%= data.id %>_file_save" name="downloadable[link][<%= data.id %>][file]" value="<%= data.file_save %>" />'+ - '<div id="downloadable_link_<%= data.id %>_file" class="uploader">'+ - '<div id="downloadable_link_<%= data.id %>_file-old" class="file-row-info"></div>'+ - '<div id="downloadable_link_<%= data.id %>_file-new" class="file-row-info new-file"></div>'+ + '<label for="downloadable_link_<%- data.id %>_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_<%- data.id %>_file_type" name="downloadable[link][<%- data.id %>][type]" value="file"<%- data.file_checked %> /> File:</label>'+ + '<input type="hidden" class="validate-downloadable-file" id="downloadable_link_<%- data.id %>_file_save" name="downloadable[link][<%- data.id %>][file]" value="<%- data.file_save %>" />'+ + '<div id="downloadable_link_<%- data.id %>_file" class="uploader">'+ + '<div id="downloadable_link_<%- data.id %>_file-old" class="file-row-info"></div>'+ + '<div id="downloadable_link_<%- data.id %>_file-new" class="file-row-info new-file"></div>'+ '<div class="fileinput-button form-buttons">'+ '<span><?php echo __('Browse Files...') ?></span>' + - '<input id="downloadable_link_<%= data.id %>_file" type="file" name="<?php echo $block->getFileFieldName('links') ?>">' + + '<input id="downloadable_link_<%- data.id %>_file" type="file" name="<?php echo $block->getFileFieldName('links') ?>">' + '<script>' + - 'linksUploader("#downloadable_link_<%= data.id %>_file", "<?php echo $block->getUploadUrl('links') ?>"); ' + + 'linksUploader("#downloadable_link_<%- data.id %>_file", "<?php echo $block->getUploadUrl('links') ?>"); ' + '</scr'+'ipt>'+ '</div>'+ '<div class="clear"></div>'+ '</div>'+ '</div>'+ '<div class="row">'+ - '<label for="downloadable_link_<%= data.id %>_url_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_<%= data.id %>_url_type" name="downloadable[link][<%= data.id %>][type]" value="url"<%= data.url_checked %> /> URL:</label><input type="text" class="validate-downloadable-url validate-url input-text" name="downloadable[link][<%= data.id %>][link_url]" value="<%= data.link_url %>" />'+ + '<label for="downloadable_link_<%- data.id %>_url_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_link_<%- data.id %>_url_type" name="downloadable[link][<%- data.id %>][type]" value="url"<%- data.url_checked %> /> URL:</label><input type="text" class="validate-downloadable-url validate-url input-text" name="downloadable[link][<%- data.id %>][link_url]" value="<%- data.link_url %>" />'+ '</div>'+ '<div>'+ - '<span id="downloadable_link_<%= data.id %>_link_container"></span>'+ + '<span id="downloadable_link_<%- data.id %>_link_container"></span>'+ '</div>'+ '</div>'+ '</td>'+ - '<td><input type="text" name="downloadable[link][<%= data.id %>][sort_order]" value="<%= data.sort_order %>" class="input-text sort" /></td>'+ + '<td><input type="text" name="downloadable[link][<%- data.id %>][sort_order]" value="<%- data.sort_order %>" class="input-text sort" /></td>'+ '<td class="col-delete">'+ - '<button id="downloadable_link_<%= data.id %>_delete_button" type="button" class="action- scalable delete delete-link-item"><span><span><span><?php echo __('Delete'); ?></span></span></span></button>'+ + '<button id="downloadable_link_<%- data.id %>_delete_button" type="button" class="action- scalable delete delete-link-item"><span><span><span><?php echo __('Delete'); ?></span></span></span></button>'+ '</td>'+ '</tr>'; diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml index bde508869e2eef8ec0a93d9f2a6fcf0bd01737d6..525009f591747a531c55553aeb251e81cad8d6b4 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml @@ -61,25 +61,25 @@ require([ registry.get('downloadable', function (Downloadable) { var sampleTemplate = '<tr>'+ '<td>'+ - '<input type="hidden" class="__delete__" name="downloadable[sample][<%= data.id %>][is_delete]" value="" />'+ - '<input type="hidden" name="downloadable[sample][<%= data.id %>][sample_id]" value="<%= data.sample_id %>" />'+ - '<input type="text" class="required-entry input-text" name="downloadable[sample][<%= data.id %>][title]" value="<%= data.title %>" />'+ - '<?php echo $_product->getStoreId() ? '<br /><input type="checkbox" id="downloadable_sample_<%= data.id %>_title" name="downloadable[sample][<%= data.id %>][use_default_title]" value="1" /><label class="normal" for="downloadable_sample_<%= data.id %>_title">Use Default Value</label>' : '' ?>'+ + '<input type="hidden" class="__delete__" name="downloadable[sample][<%- data.id %>][is_delete]" value="" />'+ + '<input type="hidden" name="downloadable[sample][<%- data.id %>][sample_id]" value="<%- data.sample_id %>" />'+ + '<input type="text" class="required-entry input-text" name="downloadable[sample][<%- data.id %>][title]" value="<%- data.title %>" />'+ + '<?php echo $_product->getStoreId() ? '<br /><input type="checkbox" id="downloadable_sample_<%- data.id %>_title" name="downloadable[sample][<%- data.id %>][use_default_title]" value="1" /><label class="normal" for="downloadable_sample_<%- data.id %>_title">Use Default Value</label>' : '' ?>'+ '</td>'+ '<td>'+ '<div class="files-wide">'+ '<div class="row">'+ - '<label for="downloadable_sample_<%= data.id %>_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_sample_<%= data.id %>_file_type" name="downloadable[sample][<%= data.id %>][type]" value="file"<%= data.file_checked %> /> File:</label>'+ - '<input type="hidden" class="validate-downloadable-file" id="downloadable_sample_<%= data.id %>_file_save" name="downloadable[sample][<%= data.id %>][file]" value="<%= data.file_save %>" />'+ - '<div id="downloadable_sample_<%= data.id %>_file" class="uploader">'+ - '<div id="downloadable_sample_<%= data.id %>_file-old" class="file-row-info"></div>'+ - '<div id="downloadable_sample_<%= data.id %>_file-new" class="file-row-info new-file"></div>'+ + '<label for="downloadable_sample_<%- data.id %>_file_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_sample_<%- data.id %>_file_type" name="downloadable[sample][<%- data.id %>][type]" value="file"<%- data.file_checked %> /> File:</label>'+ + '<input type="hidden" class="validate-downloadable-file" id="downloadable_sample_<%- data.id %>_file_save" name="downloadable[sample][<%- data.id %>][file]" value="<%- data.file_save %>" />'+ + '<div id="downloadable_sample_<%- data.id %>_file" class="uploader">'+ + '<div id="downloadable_sample_<%- data.id %>_file-old" class="file-row-info"></div>'+ + '<div id="downloadable_sample_<%- data.id %>_file-new" class="file-row-info new-file"></div>'+ '<div class="fileinput-button form-buttons">'+ '<span><?php echo __('Browse Files...') ?></span>' + - '<input id="downloadable_sample_<%= data.id %>_file" type="file" name="<?php echo $block->getConfig()->getFileField() ?>" data-url="<?php echo $block->getConfig()->getUrl() ?>">' + + '<input id="downloadable_sample_<%- data.id %>_file" type="file" name="<?php echo $block->getConfig()->getFileField() ?>" data-url="<?php echo $block->getConfig()->getUrl() ?>">' + '<script>' + '/*<![CDATA[*/' + - 'sampleUploader("#downloadable_sample_<%= data.id %>_file"); ' + + 'sampleUploader("#downloadable_sample_<%- data.id %>_file"); ' + '/*]]>*/' + '</scr'+'ipt>'+ '</div>'+ @@ -87,15 +87,15 @@ require([ '</div>'+ '</div>'+ '<div class="row">'+ - '<label for="downloadable_sample_<%= data.id %>_url_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_sample_<%= data.id %>_url_type" name="downloadable[sample][<%= data.id %>][type]" value="url"<%= data.url_checked %> /> URL:</label> <input type="text" class="validate-downloadable-url validate-url input-text" name="downloadable[sample][<%= data.id %>][sample_url]" value="<%= data.sample_url %>" />'+ + '<label for="downloadable_sample_<%- data.id %>_url_type"><input type="radio" class="radio validate-one-required-by-name" id="downloadable_sample_<%- data.id %>_url_type" name="downloadable[sample][<%- data.id %>][type]" value="url"<%- data.url_checked %> /> URL:</label> <input type="text" class="validate-downloadable-url validate-url input-text" name="downloadable[sample][<%- data.id %>][sample_url]" value="<%- data.sample_url %>" />'+ '</div>'+ '<div>'+ - '<span id="downloadable_sample_<%= data.id %>_container"></span>'+ + '<span id="downloadable_sample_<%- data.id %>_container"></span>'+ '</div>'+ '</div>'+ '</td>'+ - '<td><input type="text" name="downloadable[sample][<%= data.id %>][sort_order]" value="<%= data.sort_order %>" class="input-text sort" /></td>'+ + '<td><input type="text" name="downloadable[sample][<%- data.id %>][sort_order]" value="<%- data.sort_order %>" class="input-text sort" /></td>'+ '<td class="col-delete">'+ '<button type="button" class="action- scalable delete icon-btn delete-sample-item"><span>Delete</span></button>'+ '</td>'+ diff --git a/app/code/Magento/Eav/Api/Data/AttributeGroupDataBuilder.php b/app/code/Magento/Eav/Api/Data/AttributeGroupDataBuilder.php deleted file mode 100644 index 66ef5afef6e29eea7e61048ee7ee48f95d5e716e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Eav/Api/Data/AttributeGroupDataBuilder.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Eav\Api\Data; - -use Magento\Framework\Api\MetadataServiceInterface; -use Magento\Framework\Api\ObjectFactory; - -/** - * DataBuilder class for \Magento\Eav\Api\Data\AttributeGroupInterface - * @codeCoverageIgnore - */ -class AttributeGroupDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * @param ObjectFactory $objectFactory - * @param MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string $modelClassInterface - */ - public function __construct( - ObjectFactory $objectFactory, - MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = 'Magento\Eav\Api\Data\AttributeGroupInterface' - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - $modelClassInterface - ); - } - - /** - * {@inheritdoc} - */ - public function create() - { - /** TODO: temporary fix while problem with hasDataChanges flag not solved. MAGETWO-30324 */ - $object = parent::create(); - $object->setDataChanges(true); - return $object; - } - - /** - * @param string|null $attributeGroupName - * @return $this - */ - public function setAttributeGroupName($attributeGroupName) - { - $this->_set('attribute_group_name', $attributeGroupName); - return $this; - } - - /** - * @param string|null $attributeGroupId - * @return $this - */ - public function setAttributeGroupId($attributeGroupId) - { - $this->_set('attribute_group_id', $attributeGroupId); - return $this; - } - - /** - * @param int|null $attributeSetId - * @return $this - */ - public function setAttributeSetId($attributeSetId) - { - $this->_set('attribute_set_id', $attributeSetId); - return $this; - } -} diff --git a/app/code/Magento/Eav/Api/Data/AttributeGroupInterface.php b/app/code/Magento/Eav/Api/Data/AttributeGroupInterface.php index 074bc9c6721d0cbf944c5d5b5a07542b69143c1b..9c02bda805670c87d5870d4e8828769666d474ae 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeGroupInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeGroupInterface.php @@ -1,12 +1,13 @@ <?php /** - * * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Eav\Api\Data; -interface AttributeGroupInterface +use Magento\Framework\Api\ExtensibleDataInterface; + +interface AttributeGroupInterface extends ExtensibleDataInterface { const GROUP_ID = 'attribute_group_id'; @@ -58,4 +59,21 @@ interface AttributeGroupInterface * @return $this */ public function setAttributeSetId($attributeSetId); + + /** + * Retrieve existing extension attributes object. + * + * @return \Magento\Eav\Api\Data\AttributeGroupExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Eav\Api\Data\AttributeGroupExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Eav\Api\Data\AttributeGroupExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php b/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php index 14a78abf17a5c9806d271b42e58ddf1870f956e2..fd9a4416c42cac6310c62febf27afc114a6c3a74 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php @@ -14,4 +14,12 @@ interface AttributeGroupSearchResultsInterface extends \Magento\Framework\Api\Se * @return \Magento\Eav\Api\Data\AttributeGroupInterface[] */ public function getItems(); + + /** + * Set attribute sets list. + * + * @param \Magento\Eav\Api\Data\AttributeGroupInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeInterface.php b/app/code/Magento/Eav/Api/Data/AttributeInterface.php index 45f61ee56dd2aa920b225bbb66a2404fdd81ba3c..614d75a1279454b3aed41b98788e85cd15c193d8 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeInterface.php @@ -6,7 +6,7 @@ */ namespace Magento\Eav\Api\Data; -interface AttributeInterface extends \Magento\Framework\Api\ExtensibleDataInterface +interface AttributeInterface extends \Magento\Framework\Api\CustomAttributesDataInterface { const ATTRIBUTE_ID = 'attribute_id'; @@ -297,4 +297,9 @@ interface AttributeInterface extends \Magento\Framework\Api\ExtensibleDataInterf * @return $this */ public function setValidationRules(array $validationRules = null); + + /** + * @return \Magento\Eav\Api\Data\AttributeExtensionInterface|null + */ + public function getExtensionAttributes(); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php b/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php index 2b419e95236e24625652ece84a4a5d083ad99a84..ccf026345d871471491ab633ed878ecf5f452b42 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php @@ -14,4 +14,12 @@ interface AttributeSearchResultsInterface extends \Magento\Framework\Api\SearchR * @return \Magento\Eav\Api\Data\AttributeInterface[] */ public function getItems(); + + /** + * Set attributes list. + * + * @param \Magento\Eav\Api\Data\AttributeInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeSetDataBuilder.php b/app/code/Magento/Eav/Api/Data/AttributeSetDataBuilder.php deleted file mode 100644 index 4383ee100029be8d4c34a6bbf9d9c5bf71a5c9cb..0000000000000000000000000000000000000000 --- a/app/code/Magento/Eav/Api/Data/AttributeSetDataBuilder.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Eav\Api\Data; - -use Magento\Framework\Api\MetadataServiceInterface; -use Magento\Framework\Api\ObjectFactory; - -/** - * DataBuilder class for \Magento\Eav\Api\Data\AttributeSetInterface - * @codeCoverageIgnore - */ -class AttributeSetDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * @param ObjectFactory $objectFactory - * @param MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string $modelClassInterface - */ - public function __construct( - ObjectFactory $objectFactory, - MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = 'Magento\Eav\Api\Data\AttributeSetInterface' - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - $modelClassInterface - ); - } - - /** - * @param string $attributeSetName - * @return $this - */ - public function setAttributeSetName($attributeSetName) - { - $this->_set('attribute_set_name', $attributeSetName); - return $this; - } - - /** - * @param int|null $attributeSetId - * @return $this - */ - public function setAttributeSetId($attributeSetId) - { - $this->_set('attribute_set_id', $attributeSetId); - return $this; - } - - /** - * @param int $sortOrder - * @return $this - */ - public function setSortOrder($sortOrder) - { - $this->_set('sort_order', $sortOrder); - return $this; - } - - /** - * @param int|null $entityTypeId - * @return $this - */ - public function setEntityTypeId($entityTypeId) - { - $this->_set('entity_type_id', $entityTypeId); - return $this; - } - - /** - * {@inheritdoc} - */ - public function create() - { - /** TODO: temporary fix while problem with hasDataChanges flag not solved. MAGETWO-30324 */ - $object = parent::create(); - $object->setDataChanges(true); - return $object; - } -} diff --git a/app/code/Magento/Eav/Api/Data/AttributeSetInterface.php b/app/code/Magento/Eav/Api/Data/AttributeSetInterface.php index 0c8e66dae0f0e09bf519e21875ca6acc90bcc24e..a44a0bd4dae93040d2903c97b4355362ce872b2d 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeSetInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeSetInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\Eav\Api\Data; -interface AttributeSetInterface +interface AttributeSetInterface extends \Magento\Framework\Api\ExtensibleDataInterface { /** * Get attribute set ID @@ -66,4 +66,19 @@ interface AttributeSetInterface * @return $this */ public function setEntityTypeId($entityTypeId); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Eav\Api\Data\AttributeSetExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Eav\Api\Data\AttributeSetExtensionInterface|null $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Eav\Api\Data\AttributeSetExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php b/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php index 7621e60c2b07d67c7afac4f6bdd7b02302880dcd..ef0d07da39cd28adf9353b0a37355835863f26f9 100644 --- a/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php +++ b/app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php @@ -14,4 +14,12 @@ interface AttributeSetSearchResultsInterface extends \Magento\Framework\Api\Sear * @return \Magento\Eav\Api\Data\AttributeSetInterface[] */ public function getItems(); + + /** + * Set attribute sets list. + * + * @param \Magento\Eav\Api\Data\AttributeSetInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Eav/Model/Attribute/GroupRepository.php b/app/code/Magento/Eav/Model/Attribute/GroupRepository.php index 3ac1073b7cbf59f2bb4803865d4931b61fd2b130..558964315f315229a58605dbc3adf0698fb86629 100644 --- a/app/code/Magento/Eav/Model/Attribute/GroupRepository.php +++ b/app/code/Magento/Eav/Model/Attribute/GroupRepository.php @@ -33,29 +33,29 @@ class GroupRepository implements \Magento\Eav\Api\AttributeGroupRepositoryInterf protected $groupListFactory; /** - * @var \Magento\Eav\Api\Data\AttributeGroupSearchResultsDataBuilder + * @var \Magento\Eav\Api\Data\AttributeGroupSearchResultsInterfaceFactory */ - protected $searchResultsBuilder; + protected $searchResultsFactory; /** * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group $groupResource * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $groupListFactory * @param \Magento\Eav\Model\Entity\Attribute\GroupFactory $groupFactory * @param \Magento\Eav\Api\AttributeSetRepositoryInterface $setRepository - * @param \Magento\Eav\Api\Data\AttributeGroupSearchResultsDataBuilder $searchResultsBuilder + * @param \Magento\Eav\Api\Data\AttributeGroupSearchResultsInterfaceFactory $searchResultsFactory */ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Group $groupResource, \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $groupListFactory, \Magento\Eav\Model\Entity\Attribute\GroupFactory $groupFactory, \Magento\Eav\Api\AttributeSetRepositoryInterface $setRepository, - \Magento\Eav\Api\Data\AttributeGroupSearchResultsDataBuilder $searchResultsBuilder + \Magento\Eav\Api\Data\AttributeGroupSearchResultsInterfaceFactory $searchResultsFactory ) { $this->groupResource = $groupResource; $this->groupListFactory = $groupListFactory; $this->groupFactory = $groupFactory; $this->setRepository = $setRepository; - $this->searchResultsBuilder = $searchResultsBuilder; + $this->searchResultsFactory = $searchResultsFactory; } /** @@ -109,10 +109,11 @@ class GroupRepository implements \Magento\Eav\Api\AttributeGroupRepositoryInterf $collection->setAttributeSetFilter($attributeSetId); $collection->setSortOrder(); - $this->searchResultsBuilder->setSearchCriteria($searchCriteria); - $this->searchResultsBuilder->setItems($collection->getItems()); - $this->searchResultsBuilder->setTotalCount($collection->getSize()); - return $this->searchResultsBuilder->create(); + $searchResult = $this->searchResultsFactory->create(); + $searchResult->setSearchCriteria($searchCriteria); + $searchResult->setItems($collection->getItems()); + $searchResult->setTotalCount($collection->getSize()); + return $searchResult; } /** diff --git a/app/code/Magento/Eav/Model/AttributeRepository.php b/app/code/Magento/Eav/Model/AttributeRepository.php index 86437cdbf3d48452e55aaefa5b6c2c0702c643a1..b3dfb59a88829a072cf65e6dc7fb4c9336459a10 100644 --- a/app/code/Magento/Eav/Model/AttributeRepository.php +++ b/app/code/Magento/Eav/Model/AttributeRepository.php @@ -33,9 +33,9 @@ class AttributeRepository implements \Magento\Eav\Api\AttributeRepositoryInterfa protected $attributeCollectionFactory; /** - * @var \Magento\Eav\Api\Data\AttributeSearchResultsDataBuilder + * @var \Magento\Eav\Api\Data\AttributeSearchResultsInterfaceFactory */ - protected $searchResultsBuilder; + protected $searchResultsFactory; /** * @var Entity\AttributeFactory @@ -46,20 +46,20 @@ class AttributeRepository implements \Magento\Eav\Api\AttributeRepositoryInterfa * @param Config $eavConfig * @param Resource\Entity\Attribute $eavResource * @param Resource\Entity\Attribute\CollectionFactory $attributeCollectionFactory - * @param \Magento\Eav\Api\Data\AttributeSearchResultsDataBuilder $searchResultsBuilder + * @param \Magento\Eav\Api\Data\AttributeSearchResultsInterfaceFactory $searchResultsFactory * @param Entity\AttributeFactory $attributeFactory */ public function __construct( \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Resource\Entity\Attribute $eavResource, \Magento\Eav\Model\Resource\Entity\Attribute\CollectionFactory $attributeCollectionFactory, - \Magento\Eav\Api\Data\AttributeSearchResultsDataBuilder $searchResultsBuilder, + \Magento\Eav\Api\Data\AttributeSearchResultsInterfaceFactory $searchResultsFactory, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory ) { $this->eavConfig = $eavConfig; $this->eavResource = $eavResource; $this->attributeCollectionFactory = $attributeCollectionFactory; - $this->searchResultsBuilder = $searchResultsBuilder; + $this->searchResultsFactory = $searchResultsFactory; $this->attributeFactory = $attributeFactory; } @@ -127,10 +127,11 @@ class AttributeRepository implements \Magento\Eav\Api\AttributeRepositoryInterfa foreach ($attributeCollection as $attribute) { $attributes[] = $this->get($entityTypeCode, $attribute->getAttributeCode()); } - $this->searchResultsBuilder->setSearchCriteria($searchCriteria); - $this->searchResultsBuilder->setItems($attributes); - $this->searchResultsBuilder->setTotalCount($totalCount); - return $this->searchResultsBuilder->create(); + $searchResults = $this->searchResultsFactory->create(); + $searchResults->setSearchCriteria($searchCriteria); + $searchResults->setItems($attributes); + $searchResults->setTotalCount($totalCount); + return $searchResults; } /** diff --git a/app/code/Magento/Eav/Model/AttributeSetRepository.php b/app/code/Magento/Eav/Model/AttributeSetRepository.php index 29cfc020a170711c6f2560f924faf45870866aa8..dc989a741f09d3dc6a825b156da200cfabf42dea 100644 --- a/app/code/Magento/Eav/Model/AttributeSetRepository.php +++ b/app/code/Magento/Eav/Model/AttributeSetRepository.php @@ -42,29 +42,29 @@ class AttributeSetRepository implements AttributeSetRepositoryInterface private $eavConfig; /** - * @var \Magento\Eav\Api\Data\AttributeSetSearchResultsDataBuilder + * @var \Magento\Eav\Api\Data\AttributeSetSearchResultsInterfaceFactory */ - private $searchResultsBuilder; + private $searchResultsFactory; /** * @param AttributeSetResource $attributeSetResource * @param AttributeSetFactory $attributeSetFactory * @param CollectionFactory $collectionFactory * @param Config $eavConfig - * @param \Magento\Eav\Api\Data\AttributeSetSearchResultsDataBuilder $searchResultBuilder + * @param \Magento\Eav\Api\Data\AttributeSetSearchResultsInterfaceFactory $searchResultFactory */ public function __construct( AttributeSetResource $attributeSetResource, AttributeSetFactory $attributeSetFactory, CollectionFactory $collectionFactory, EavConfig $eavConfig, - \Magento\Eav\Api\Data\AttributeSetSearchResultsDataBuilder $searchResultBuilder + \Magento\Eav\Api\Data\AttributeSetSearchResultsInterfaceFactory $searchResultFactory ) { $this->attributeSetResource = $attributeSetResource; $this->attributeSetFactory = $attributeSetFactory; $this->collectionFactory = $collectionFactory; $this->eavConfig = $eavConfig; - $this->searchResultsBuilder = $searchResultBuilder; + $this->searchResultsFactory = $searchResultFactory; } /** @@ -98,10 +98,11 @@ class AttributeSetRepository implements AttributeSetRepositoryInterface $collection->setCurPage($searchCriteria->getCurrentPage()); $collection->setPageSize($searchCriteria->getPageSize()); - $this->searchResultsBuilder->setSearchCriteria($searchCriteria); - $this->searchResultsBuilder->setItems($collection->getItems()); - $this->searchResultsBuilder->setTotalCount($collection->getSize()); - return $this->searchResultsBuilder->create(); + $searchResults = $this->searchResultsFactory->create(); + $searchResults->setSearchCriteria($searchCriteria); + $searchResults->setItems($collection->getItems()); + $searchResults->setTotalCount($collection->getSize()); + return $searchResults; } /** diff --git a/app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php b/app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php new file mode 100644 index 0000000000000000000000000000000000000000..958c645190806499496440018d332fb1caf0f750 --- /dev/null +++ b/app/code/Magento/Eav/Model/EavCustomAttributeTypeLocator.php @@ -0,0 +1,72 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Eav\Model; + +use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface; + +class EavCustomAttributeTypeLocator implements CustomAttributeTypeLocatorInterface +{ + /** + * @var AttributeRepositoryInterface + */ + private $attributeRepository; + + /** + * @var array + */ + private $serviceEntityTypeMap; + + /** + * @var array + */ + private $serviceBackendModelDataInterfaceMap; + + /** + * Initialize EavCustomAttributeTypeLocator + * + * @param AttributeRepositoryInterface $attributeRepository + * @param array $serviceEntityTypeMap + * @param array $serviceBackendModelDataInterfaceMap + */ + public function __construct( + AttributeRepositoryInterface $attributeRepository, + array $serviceEntityTypeMap = [], + array $serviceBackendModelDataInterfaceMap = [] + ) { + $this->attributeRepository = $attributeRepository; + $this->serviceEntityTypeMap = $serviceEntityTypeMap; + $this->serviceBackendModelDataInterfaceMap = $serviceBackendModelDataInterfaceMap; + } + + /** + * {@inheritdoc} + */ + public function getType($attributeCode, $serviceClass) + { + if (!$serviceClass || !$attributeCode || !isset($this->serviceEntityTypeMap[$serviceClass]) + || !isset($this->serviceBackendModelDataInterfaceMap[$serviceClass]) + ) { + return null; + } + + try { + $backendModel = $this->attributeRepository + ->get($this->serviceEntityTypeMap[$serviceClass], $attributeCode) + ->getBackendModel(); + } catch (NoSuchEntityException $e) { + return null; + } + + $dataInterface = isset($this->serviceBackendModelDataInterfaceMap[$serviceClass][$backendModel]) + ? $this->serviceBackendModelDataInterfaceMap[$serviceClass][$backendModel] + : null; + + return $dataInterface; + } +} diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index 5a2b8365a25204491b4c079f86ef3aca4768b3b6..6c2dcc71ed12a164f6a8675b18aef512523a97d0 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -1024,6 +1024,9 @@ abstract class AbstractEntity extends \Magento\Framework\Model\Resource\Abstract if (empty($attributes)) { $this->loadAllAttributes($object); } else { + if (!is_array($attributes)) { + $attributes = [$attributes]; + } foreach ($attributes as $attrCode) { $this->getAttribute($attrCode); } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index ef74bb1e59e968598de052ba3c08707c67f402cd..df877f97a92afdec4ea0cdb857e10d3a90f84ba9 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -12,6 +12,7 @@ use Magento\Framework\Api\AttributeValueFactory; * EAV Entity attribute model * * @method \Magento\Eav\Model\Entity\Attribute setOption($value) + * @method \Magento\Eav\Api\Data\AttributeExtensionInterface getExtensionAttributes() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute implements @@ -66,7 +67,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Eav\Model\Config $eavConfig * @param TypeFactory $eavTypeFactory @@ -87,7 +88,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, @@ -107,7 +108,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $eavConfig, $eavTypeFactory, diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index 155f3a0f0e1fb2ed46c73c472a57ee8b9b92ee9c..d241a3234fa697bfdb4c833f511a8159d1998d06 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -114,7 +114,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory @@ -132,7 +132,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, @@ -149,7 +149,7 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -1184,4 +1184,25 @@ abstract class AbstractAttribute extends \Magento\Framework\Model\AbstractExtens { return $this->setData(self::VALIDATE_RULES, $validationRules); } + + /** + * {@inheritdoc} + * + * @return \Magento\Eav\Api\Data\AttributeExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Eav\Api\Data\AttributeExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php index 5e14ddca8729ee2299fc60b3c4dd28488d75eb10..b12ddf75a716d052c30e7b0a2d4edeb623f076dc 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -26,7 +26,7 @@ class Created extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken /** * Set created date * - * @param \Magento\Core\Model\Object $object + * @param \Magento\Framework\Model\AbstractModel $object * @return $this */ public function beforeSave($object) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Group.php b/app/code/Magento/Eav/Model/Entity/Attribute/Group.php index 1e68ac3ccbf19c3e0961a381b7c334b99f082114..4248f1523d4d517c4061b453cb6353832206d4b0 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Group.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Group.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Eav\Model\Entity\Attribute; /** @@ -124,5 +125,27 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::ATTRIBUTE_SET_ID, $attributeSetId); } + + /** + * {@inheritdoc} + * + * @return \Magento\Eav\Api\Data\AttributeGroupExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Eav\Api\Data\AttributeGroupExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Eav\Api\Data\AttributeGroupExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Option.php b/app/code/Magento/Eav/Model/Entity/Attribute/Option.php index f884585623b3be172c84067a7293f53c3ac95237..57cbb324ef7c81b39cdb76d140ed697b90ce999f 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Option.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Option.php @@ -6,7 +6,7 @@ namespace Magento\Eav\Model\Entity\Attribute; use Magento\Eav\Api\Data\AttributeOptionInterface; -use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Framework\Model\AbstractModel; /** * Emtity attribute option model @@ -18,7 +18,7 @@ use Magento\Framework\Model\AbstractExtensibleModel; * * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends AbstractExtensibleModel implements AttributeOptionInterface +class Option extends AbstractModel implements AttributeOptionInterface { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/OptionLabel.php b/app/code/Magento/Eav/Model/Entity/Attribute/OptionLabel.php index 5319477495b36e0e87e8a3e294db2a6d5c3a8ece..dfb45c211041d8dd89fb05974df32a7af9930901 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/OptionLabel.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/OptionLabel.php @@ -6,13 +6,13 @@ namespace Magento\Eav\Model\Entity\Attribute; use Magento\Eav\Api\Data\AttributeOptionLabelInterface; -use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Framework\Model\AbstractModel; /** * Entity attribute option label model * */ -class OptionLabel extends AbstractExtensibleModel implements AttributeOptionLabelInterface +class OptionLabel extends AbstractModel implements AttributeOptionLabelInterface { /** * {@inheritdoc} diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php index 75122ca097d4d06a0b459d2d688632dcf925dd8d..c8eb151622d4d235b8460fc548ac202d504b0e4a 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php @@ -19,8 +19,8 @@ */ namespace Magento\Eav\Model\Entity\Attribute; -use Magento\Eav\Model\Entity\Type; use Magento\Eav\Exception as EavException; +use Magento\Eav\Model\Entity\Type; use Magento\Framework\Api\AttributeValueFactory; /** @@ -47,6 +47,7 @@ class Set extends \Magento\Framework\Model\AbstractExtensibleModel implements /** * Prefix of model events names + * * @var string */ protected $_eventPrefix = 'eav_entity_attribute_set'; @@ -74,7 +75,7 @@ class Set extends \Magento\Framework\Model\AbstractExtensibleModel implements /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Eav\Model\Config $eavConfig * @param GroupFactory $attrGroupFactory @@ -88,7 +89,7 @@ class Set extends \Magento\Framework\Model\AbstractExtensibleModel implements public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\Attribute\GroupFactory $attrGroupFactory, @@ -101,7 +102,7 @@ class Set extends \Magento\Framework\Model\AbstractExtensibleModel implements parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -439,5 +440,26 @@ class Set extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_ENTITY_TYPE_ID, $entityTypeId); } + + /** + * {@inheritdoc} + * + * @return \Magento\Eav\Api\Data\AttributeSetExtensionInterface|null|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Eav\Api\Data\AttributeSetExtensionInterface|null $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Eav\Api\Data\AttributeSetExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/ValidationRule.php b/app/code/Magento/Eav/Model/Entity/Attribute/ValidationRule.php index c3d4743674af8fa0a459ef9dd42ee344973d31f7..ee9367705335ae4fe6f4212bb23beabee05760e4 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/ValidationRule.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/ValidationRule.php @@ -9,7 +9,7 @@ namespace Magento\Eav\Model\Entity\Attribute; /** * @codeCoverageIgnore */ -class ValidationRule extends \Magento\Framework\Model\AbstractExtensibleModel implements +class ValidationRule extends \Magento\Framework\Model\AbstractModel implements \Magento\Eav\Api\Data\AttributeValidationRuleInterface { /** diff --git a/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php b/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php index 394be4fc0d26047bece3d5c36ae4248562918b3e..377aa2277184687d8ad6f6c20ef2d9166c0466c2 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/Attribute/GroupRepositoryTest.php @@ -30,7 +30,7 @@ class GroupRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $searchResultsBuilderMock; + protected $searchResultsFactoryMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -54,9 +54,9 @@ class GroupRepositoryTest extends \PHPUnit_Framework_TestCase false ); $this->setRepositoryMock = $this->getMock('\Magento\Eav\Api\AttributeSetRepositoryInterface'); - $this->searchResultsBuilderMock = $this->getMock( - '\Magento\Eav\Api\Data\AttributeGroupSearchResultsDataBuilder', - ['setSearchCriteria', 'setItems', 'setTotalCount', 'create'], + $this->searchResultsFactoryMock = $this->getMock( + '\Magento\Eav\Api\Data\AttributeGroupSearchResultsInterfaceFactory', + ['create'], [], '', false @@ -77,7 +77,7 @@ class GroupRepositoryTest extends \PHPUnit_Framework_TestCase 'groupListFactory' => $this->groupListFactoryMock, 'groupFactory' => $this->groupFactoryMock, 'setRepository' => $this->setRepositoryMock, - 'searchResultsBuilder' => $this->searchResultsBuilderMock + 'searchResultsFactory' => $this->searchResultsFactoryMock ] ); } @@ -246,11 +246,18 @@ class GroupRepositoryTest extends \PHPUnit_Framework_TestCase $groupCollectionMock->expects($this->once())->method('setSortOrder'); $groupCollectionMock->expects($this->once())->method('getSize')->willReturn(1); - $this->searchResultsBuilderMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock); - $this->searchResultsBuilderMock->expects($this->once())->method('setItems')->with([$groupMock]); - $this->searchResultsBuilderMock->expects($this->once())->method('setTotalCount')->with(1); - $this->searchResultsBuilderMock->expects($this->once())->method('create')->willReturnSelf(); - $this->assertEquals($this->searchResultsBuilderMock, $this->model->getList($searchCriteriaMock)); + $searchResultsMock = $this->getMock( + '\Magento\Eav\Api\Data\AttributeGroupSearchResultsInterface', + [], + [], + '', + false + ); + $searchResultsMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock); + $searchResultsMock->expects($this->once())->method('setItems')->with([$groupMock]); + $searchResultsMock->expects($this->once())->method('setTotalCount')->with(1); + $this->searchResultsFactoryMock->expects($this->once())->method('create')->willReturn($searchResultsMock); + $this->assertEquals($searchResultsMock, $this->model->getList($searchCriteriaMock)); } /** diff --git a/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php b/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php index 77ecf73968d47018b8d280658ea140be22a261ea..2b710da0cfab25d5cda2f9c97db05aeff4b91124 100644 --- a/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php +++ b/app/code/Magento/Eav/Test/Unit/Model/AttributeSetRepositoryTest.php @@ -40,7 +40,7 @@ class AttributeSetRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - private $resultBuilderMock; + private $resultFactoryMock; protected function setUp() { @@ -66,9 +66,9 @@ class AttributeSetRepositoryTest extends \PHPUnit_Framework_TestCase false ); $this->eavConfigMock = $this->getMock('Magento\Eav\Model\Config', ['getEntityType'], [], '', false); - $this->resultBuilderMock = $this->getMock( - '\Magento\Eav\Api\Data\AttributeSetSearchResultsDataBuilder', - ['setSearchCriteria', 'setItems', 'setTotalCount', 'create', '__wakeup'], + $this->resultFactoryMock = $this->getMock( + '\Magento\Eav\Api\Data\AttributeSetSearchResultsInterfaceFactory', + ['create'], [], '', false @@ -78,7 +78,7 @@ class AttributeSetRepositoryTest extends \PHPUnit_Framework_TestCase $this->setFactoryMock, $this->collectionFactoryMock, $this->eavConfigMock, - $this->resultBuilderMock + $this->resultFactoryMock ); } @@ -216,18 +216,18 @@ class AttributeSetRepositoryTest extends \PHPUnit_Framework_TestCase $collectionMock->expects($this->once())->method('getItems')->willReturn([$attributeSetMock]); $collectionMock->expects($this->once())->method('getSize')->willReturn(1); - $this->resultBuilderMock->expects($this->once()) + $resultMock = $this->getMock('\Magento\Eav\Api\Data\AttributeSetSearchResultsInterface', [], [], '', false); + $resultMock->expects($this->once()) ->method('setSearchCriteria') ->with($searchCriteriaMock) ->willReturnSelf(); - $this->resultBuilderMock->expects($this->once()) + $resultMock->expects($this->once()) ->method('setItems') ->with([$attributeSetMock]) ->willReturnSelf(); - $this->resultBuilderMock->expects($this->once())->method('setTotalCount')->with(1)->willReturnSelf(); + $resultMock->expects($this->once())->method('setTotalCount')->with(1)->willReturnSelf(); - $resultMock = $this->getMock('\Magento\Eav\Api\Data\AttributeSetSearchResultsInterface', [], [], '', false); - $this->resultBuilderMock->expects($this->once())->method('create')->willReturn($resultMock); + $this->resultFactoryMock->expects($this->once())->method('create')->willReturn($resultMock); $this->model->getList($searchCriteriaMock); } diff --git a/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php b/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..89690484c74835f76a52415371a65c2f3ce6c531 --- /dev/null +++ b/app/code/Magento/Eav/Test/Unit/Model/EavCustomAttributeTypeLocatorTest.php @@ -0,0 +1,150 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// @codingStandardsIgnoreFile + +namespace Magento\Eav\Test\Unit\Model; + +use Magento\Eav\Api\AttributeRepositoryInterface; +use Magento\Eav\Model\EavCustomAttributeTypeLocator; + +class EavCustomAttributeTypeLocatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var EavCustomAttributeTypeLocator + */ + private $eavCustomAttributeTypeLocator; + + /** + * @var AttributeRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $attributeRepository = []; + + protected function setUp() + { + $this->attributeRepository = $this->getMock( + 'Magento\Eav\Model\AttributeRepository', + ['get'], + [], + '', + false + ); + } + + /** + * Test getType method + * + * @param string $attributeCode + * @param string $serviceClass + * @param array $attributeRepositoryResponse + * @param array $serviceEntityTypeMapData + * @param array $serviceBackendModelDataInterfaceMapData + * @param string $expected + * @dataProvider getTypeDataProvider + */ + public function testGetType( + $attributeCode, + $serviceClass, + $attributeRepositoryResponse, + $serviceEntityTypeMapData, + $serviceBackendModelDataInterfaceMapData, + $expected + ) { + $this->attributeRepository + ->expects($this->any()) + ->method('get') + ->willReturn($attributeRepositoryResponse); + + + $this->eavCustomAttributeTypeLocator = new EavCustomAttributeTypeLocator( + $this->attributeRepository, + $serviceEntityTypeMapData, + $serviceBackendModelDataInterfaceMapData + ); + + $type = $this->eavCustomAttributeTypeLocator->getType($attributeCode, $serviceClass); + + $this->assertEquals($expected, $type, 'Expected: ' . $expected . 'but got: ' . $type); + } + + public function getTypeDataProvider() + { + $serviceInterface = 'Magento\Catalog\Api\Data\ProductInterface'; + $eavEntityType = 'catalog_product'; + $mediaBackEndModelClass = 'Magento\Catalog\Model\Product\Attribute\Backend\Media'; + $mediaAttributeDataInterface = '\Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface'; + $serviceBackendModelDataInterfaceMapData = [ + $serviceInterface => [$mediaBackEndModelClass => $mediaAttributeDataInterface] + ]; + + $attribute = $this->getMock( + 'Magento\Catalog\Model\Resource\Eav\Attribute', + ['getBackendModel'], + [], + '', + false + ); + + $attribute->expects($this->any()) + ->method('getBackendModel') + ->willReturn($mediaBackEndModelClass); + + $attributeNoBackendModel = $this->getMock( + 'Magento\Catalog\Model\Resource\Eav\Attribute', + ['getBackendModel'], + [], + '', + false + ); + + $attributeNoBackendModel->expects($this->any()) + ->method('getBackendModel') + ->willReturn(null); + + return [ + [ + 'attributeCode' => 'media_galley', + 'serviceClass' => $serviceInterface, + 'attributeRepositoryResponse' => $attribute, + 'serviceEntityTypeMapData' => [$serviceInterface => $eavEntityType], + 'serviceBackendModelDataInterfaceMapData' => $serviceBackendModelDataInterfaceMapData, + 'expected' => $mediaAttributeDataInterface + ], + [ + 'attributeCode' => null, + 'serviceClass' => $serviceInterface, + 'attributeRepositoryResponse' => $attribute, + 'serviceEntityTypeMapData' => [$serviceInterface => $eavEntityType], + 'serviceBackendModelDataInterfaceMapData' => $serviceBackendModelDataInterfaceMapData, + 'expected' => null + ], + [ + 'attributeCode' => 'media_galley', + 'serviceClass' => null, + 'attributeRepositoryResponse' => $attribute, + 'serviceEntityTypeMapData' => [$serviceInterface => $eavEntityType], + 'serviceBackendModelDataInterfaceMapData' => $serviceBackendModelDataInterfaceMapData, + 'expected' => null + ], + [ + 'attributeCode' => 'media_galley', + 'serviceClass' => $serviceInterface, + 'attributeRepositoryResponse' => $attributeNoBackendModel, + 'serviceEntityTypeMapData' => [], + 'serviceBackendModelDataInterfaceMapData' => [], + 'expected' => null + ], + [ + 'attributeCode' => 'media_galley', + 'serviceClass' => 'Magento\Catalog\Api\Data\ProductInterface', + 'attributeRepositoryResponse' => $attribute, + 'serviceEntityTypeMapData' => [$serviceInterface => $eavEntityType], + 'serviceBackendModelDataInterfaceMapData' => [], + 'expected' => null + ] + ]; + } +} diff --git a/app/code/Magento/Eav/etc/config.xml b/app/code/Magento/Eav/etc/config.xml index f5d8d72d90d6b0706f3a102fcf33b1b263342e81..d6b5873aaf92e121cf985d6d1ad03f42c16e55ff 100644 --- a/app/code/Magento/Eav/etc/config.xml +++ b/app/code/Magento/Eav/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <general> <validator_data> diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml index 42c3fc13ef7d9524b43f34797a689b27d9f227ce..3dfebf456c7ff4ae26f6f8a118431872c7c2f67e 100644 --- a/app/code/Magento/Eav/etc/di.xml +++ b/app/code/Magento/Eav/etc/di.xml @@ -23,6 +23,8 @@ <preference for="Magento\Eav\Api\Data\AttributeSearchResultsInterface" type="Magento\Framework\Api\SearchResults" /> <preference for="Magento\Eav\Api\Data\AttributeSetSearchResultsInterface" type="Magento\Framework\Api\SearchResults" /> <preference for="Magento\Eav\Api\Data\AttributeGroupSearchResultsInterface" type="Magento\Framework\Api\SearchResults" /> + <preference for="Magento\Framework\Webapi\CustomAttributeTypeLocatorInterface" type="Magento\Eav\Model\EavCustomAttributeTypeLocator" /> + <type name="Magento\Eav\Model\Entity\Attribute\Config"> <arguments> <argument name="reader" xsi:type="object">Magento\Eav\Model\Entity\Attribute\Config\Reader\Proxy</argument> @@ -43,4 +45,16 @@ <type name="Magento\Eav\Model\Resource\Entity\Attribute"> <plugin name="storeLabelCaching" type="Magento\Eav\Plugin\Model\Resource\Entity\Attribute" /> </type> + <type name="Magento\Eav\Model\EavCustomAttributeTypeLocator"> + <arguments> + <argument name="serviceEntityTypeMap" xsi:type="array"> + <item name="Magento\Catalog\Api\Data\ProductInterface" xsi:type="const">Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE</item> + </argument> + <argument name="serviceBackendModelDataInterfaceMap" xsi:type="array"> + <item name="Magento\Catalog\Api\Data\ProductInterface" xsi:type="array"> + <item name="Magento\Catalog\Model\Product\Attribute\Backend\Media" xsi:type="string">Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface</item> + </item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Eav/etc/module.xml b/app/code/Magento/Eav/etc/module.xml index 156e78c1bdd64de754d9f2ee5274ef9dc65788d7..c4b4e458bd89df75bbe667371a54c90867752df2 100644 --- a/app/code/Magento/Eav/etc/module.xml +++ b/app/code/Magento/Eav/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Eav" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Eav/etc/webapi.xml b/app/code/Magento/Eav/etc/webapi.xml index ca246c7cf3a97038d6b11bac5e949149bdfdcdc7..bb5bd767dc8fad16cc1ec95fc814174777cdae55 100644 --- a/app/code/Magento/Eav/etc/webapi.xml +++ b/app/code/Magento/Eav/etc/webapi.xml @@ -31,7 +31,7 @@ <resource ref="Magento_Catalog::sets"/> </resources> </route> - <route url="/V1/eav/attribute-sets" method="PUT"> + <route url="/V1/eav/attribute-sets/:attributeSetId" method="PUT"> <service class="Magento\Eav\Api\AttributeSetRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Catalog::sets"/> diff --git a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php index e9ea334e776dab2079d0167ca86a9e67c5380ebf..bfdd32f7e55421599563f7da80f170a757111b31 100644 --- a/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php +++ b/app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + /** * Test class for \Magento\Email\Model\AbstractTemplate. */ @@ -56,4 +58,46 @@ class AbstractTemplateTest extends \PHPUnit_Framework_TestCase { return [[[]], [['area' => 'some_area']], [['store' => 'any_store']]]; } + + public function testEmulateDesignAndRevertDesign() + { + $originalConfig = ['area' => 'some_area', 'store' => 1]; + $expectedConfig = ['area' => 'frontend', 'store' => 2]; + $this->_model->setDesignConfig($originalConfig); + + $this->_model->emulateDesign(2); + // assert config data has been emulated + $this->assertEquals($expectedConfig, $this->_model->getDesignConfig()->getData()); + + $this->_model->revertDesign(); + // assert config data has been reverted to the original state + $this->assertEquals($originalConfig, $this->_model->getDesignConfig()->getData()); + } + + public function testGetDesignConfig() + { + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $designMock = $this->getMock('Magento\Framework\View\DesignInterface'); + $designMock->expects($this->any())->method('getArea')->willReturn('test_area'); + + $storeMock = $this->getMock('Magento\Store\Model\Store', [], [], '', false); + $storeMock->expects($this->any())->method('getId')->willReturn(2); + $storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface'); + $storeManagerMock->expects($this->any())->method('getStore')->willReturn($storeMock); + + $model = $this->getMockForAbstractClass( + 'Magento\Email\Model\AbstractTemplate', + $helper->getConstructArguments( + 'Magento\Email\Model\AbstractTemplate', + [ + 'design' => $designMock, + 'storeManager' => $storeManagerMock + ] + ) + ); + + $expectedConfig = ['area' => 'test_area', 'store' => 2]; + $this->assertEquals($expectedConfig, $model->getDesignConfig()->getData()); + } } diff --git a/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6a51e983e3b53191e4265d5f9f7d857825c86d1f --- /dev/null +++ b/app/code/Magento/Email/Test/Unit/Model/BackendTemplateTest.php @@ -0,0 +1,86 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// @codingStandardsIgnoreFile + +/** + * Test class for Magento\Email\Model\BackendTemplate. + */ +namespace Magento\Email\Test\Unit\Model; + +use Magento\Email\Model\BackendTemplate; + +class BackendTemplateTest extends \PHPUnit_Framework_TestCase +{ + /** + * Backend template mock + * + * @var BackendTemplate + */ + protected $model; + + /** + * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfigMock; + + /** + * @var \Magento\Config\Model\Config\Structure|\PHPUnit_Framework_MockObject_MockObject + */ + protected $structureMock; + + /** + * @var \Magento\Email\Model\Resource\Template|\PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceModelMock; + + protected function setUp() + { + $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->scopeConfigMock = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); + $this->scopeConfigMock->expects($this->any())->method('getValue')->willReturn(['test' => 1]); + + $this->structureMock = $this->getMock('Magento\Config\Model\Config\Structure', [], [], '', false); + $this->structureMock->expects($this->any())->method('getFieldPathsByAttribute')->willReturn(['path' => 'test']); + + $this->resourceModelMock = $this->getMock('Magento\Email\Model\Resource\Template', [], [], '', false); + $this->resourceModelMock->expects($this->any())->method('getSystemConfigByPathsAndTemplateId')->willReturn(['test_config' => 2015]); + $objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface'); + $objectManagerMock->expects($this->any()) + ->method('get') + ->with('Magento\Email\Model\Resource\Template') + ->will($this->returnValue($this->resourceModelMock)); + \Magento\Framework\App\ObjectManager::setInstance($objectManagerMock); + + $this->model = $helper->getObject( + 'Magento\Email\Model\BackendTemplate', + ['scopeConfig' => $this->scopeConfigMock, 'structure' => $this->structureMock] + ); + } + + public function testGetSystemConfigPathsWhereUsedAsDefaultNoTemplateCode() + { + $this->assertEquals([], $this->model->getSystemConfigPathsWhereUsedAsDefault()); + } + + public function testGetSystemConfigPathsWhereUsedAsDefaultValidTemplateCode() + { + $this->model->setData('orig_template_code', 1); + $this->assertEquals([['path' => 'test']], $this->model->getSystemConfigPathsWhereUsedAsDefault()); + } + + public function testGetSystemConfigPathsWhereUsedCurrentlyNoId() + { + $this->assertEquals([], $this->model->getSystemConfigPathsWhereUsedCurrently()); + } + + public function testGetSystemConfigPathsWhereUsedCurrentlyValidId() + { + $this->model->setId(1); + $this->assertEquals(['test_config' => 2015], $this->model->getSystemConfigPathsWhereUsedCurrently()); + } +} diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 7eae5d149b013397761753c02789deb21b2abc46..cf75e8fdd529bb89688f2cc12bdd4d92efc527f0 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,7 +3,6 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-core": "0.42.0-beta11", "magento/module-config": "0.42.0-beta11", "magento/module-store": "0.42.0-beta11", "magento/module-cms": "0.42.0-beta11", diff --git a/app/code/Magento/Email/etc/config.xml b/app/code/Magento/Email/etc/config.xml index e966e4c1ed4c14dbcdfb5f0d4275f01a170d238a..700f625c9541c224cdbbf74dfdbcec7bf7390370 100644 --- a/app/code/Magento/Email/etc/config.xml +++ b/app/code/Magento/Email/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <system> <media_storage_configuration> diff --git a/app/code/Magento/Email/etc/module.xml b/app/code/Magento/Email/etc/module.xml index 30252dd178b9eaefd8b68eca5814954dd5935310..3e5126d0e7e3a7c4997164f737f0fd6428bc9ead 100644 --- a/app/code/Magento/Email/etc/module.xml +++ b/app/code/Magento/Email/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Email" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> <module name="Magento_Cms"/> </sequence> diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 9959c31c0264e069e40a70b15d0c145f6222819e..8997dc97ac88704304a484e44b7062d5a0399953 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -6,11 +6,11 @@ "magento/module-store": "0.42.0-beta11", "magento/module-shipping": "0.42.0-beta11", "magento/module-directory": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-catalog": "0.42.0-beta11", "magento/module-sales": "0.42.0-beta11", "magento/module-catalog-inventory": "0.42.0-beta11", "magento/module-quote": "0.42.0-beta11", + "magento/module-config": "0.42.0-beta11", "magento/framework": "0.42.0-beta11", "lib-libxml": "*", "magento/magento-composer-installer": "*" diff --git a/app/code/Magento/Fedex/etc/config.xml b/app/code/Magento/Fedex/etc/config.xml index d20fd9f2d1b1f66350a8bf1b1bb98cac7abc6c59..9d99b8997487bad3eae596d0b7b026be93f524d3 100644 --- a/app/code/Magento/Fedex/etc/config.xml +++ b/app/code/Magento/Fedex/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <carriers> <fedex> diff --git a/app/code/Magento/GiftMessage/Api/Data/MessageInterface.php b/app/code/Magento/GiftMessage/Api/Data/MessageInterface.php index c360ca4e8f1f2539e7be29789da17de5108ceb1c..a044e7c0ab0c72253dc3b375c1ed2677fb47c389 100644 --- a/app/code/Magento/GiftMessage/Api/Data/MessageInterface.php +++ b/app/code/Magento/GiftMessage/Api/Data/MessageInterface.php @@ -91,4 +91,21 @@ interface MessageInterface extends \Magento\Framework\Api\ExtensibleDataInterfac * @return $this */ public function setMessage($message); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\GiftMessage\Api\Data\MessageExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\GiftMessage\Api\Data\MessageExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\GiftMessage\Api\Data\MessageExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/GiftMessage/Model/Message.php b/app/code/Magento/GiftMessage/Model/Message.php index 4dda8d5546d9fd788a4f295555297e8936f4d1e9..be07b6cfb242c50d11fc7a9cf691d91b717150ef 100644 --- a/app/code/Magento/GiftMessage/Model/Message.php +++ b/app/code/Magento/GiftMessage/Model/Message.php @@ -26,7 +26,7 @@ class Message extends \Magento\Framework\Model\AbstractExtensibleModel implement /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param Resource\Message $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -36,7 +36,7 @@ class Message extends \Magento\Framework\Model\AbstractExtensibleModel implement public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\GiftMessage\Model\Resource\Message $resource, \Magento\Framework\Data\Collection\Db $resourceCollection, @@ -47,7 +47,7 @@ class Message extends \Magento\Framework\Model\AbstractExtensibleModel implement parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -164,5 +164,26 @@ class Message extends \Magento\Framework\Model\AbstractExtensibleModel implement { return $this->setData(self::MESSAGE, $message); } + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\GiftMessage\Api\Data\MessageExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * Set an extension attributes object. + * + * @param \Magento\GiftMessage\Api\Data\MessageExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\GiftMessage\Api\Data\MessageExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index cdc15af4279b4934754adee08f63e97497cdec0e..575d83a28cc8e0fd75f7b8262697cfe213d19845 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -15,9 +15,6 @@ "magento/framework": "0.42.0-beta11", "magento/magento-composer-installer": "*" }, - "suggest": { - "magento/module-core": "0.42.0-beta11" - }, "type": "magento2-module", "version": "0.42.0-beta11", "license": [ diff --git a/app/code/Magento/GiftMessage/etc/config.xml b/app/code/Magento/GiftMessage/etc/config.xml index 2bebc1173ef729e22de095815520c3be2d900759..dc21f3cfecaf4055397c3ee28d0e225f3135eb2c 100644 --- a/app/code/Magento/GiftMessage/etc/config.xml +++ b/app/code/Magento/GiftMessage/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <sales> <gift_messages> diff --git a/app/code/Magento/GoogleAdwords/etc/config.xml b/app/code/Magento/GoogleAdwords/etc/config.xml index 1fa6ffc95967943ca3106e10c4e21960e85ac912..71bd7813ad22278703215c1cb7c052cc72d16b5f 100644 --- a/app/code/Magento/GoogleAdwords/etc/config.xml +++ b/app/code/Magento/GoogleAdwords/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <google> <adwords> diff --git a/app/code/Magento/GoogleAnalytics/etc/module.xml b/app/code/Magento/GoogleAnalytics/etc/module.xml index 0012f962d97a81dbd3ff8bbcc3f0f3db09443cd8..bcb1b0ed7573d5f672b2c5bf77f1869b1ff16c1a 100644 --- a/app/code/Magento/GoogleAnalytics/etc/module.xml +++ b/app/code/Magento/GoogleAnalytics/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_GoogleAnalytics" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/GoogleOptimizer/etc/config.xml b/app/code/Magento/GoogleOptimizer/etc/config.xml index 5c2c3fde8a40869d6fbb9a203289c06c3eefcb57..fa510197464776407fb36f4f791bc34f827669f1 100644 --- a/app/code/Magento/GoogleOptimizer/etc/config.xml +++ b/app/code/Magento/GoogleOptimizer/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <google> <optimizer> diff --git a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php index 79a7197d04206cb5c6dce13979680f7149264469..059b9492610d43eea619399493c45173da1e33bc 100644 --- a/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php +++ b/app/code/Magento/GoogleShopping/Block/Adminhtml/Types/Edit/Attributes.php @@ -131,9 +131,9 @@ class Attributes extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\El $select = $this->getLayout()->createBlock( 'Magento\GoogleShopping\Block\Adminhtml\Types\Edit\Select' )->setId( - $this->getFieldId() . '_<%= data.index %>_gattribute' + $this->getFieldId() . '_<%- data.index %>_gattribute' )->setName( - $this->getFieldName() . '[<%= data.index %>][gcontent_attribute]' + $this->getFieldName() . '[<%- data.index %>][gcontent_attribute]' )->setOptions( $options ); @@ -152,9 +152,9 @@ class Attributes extends \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\El $select = $this->getLayout()->createBlock( 'Magento\Framework\View\Element\Html\Select' )->setId( - $this->getFieldId() . '_<%= data.index %>_attribute' + $this->getFieldId() . '_<%- data.index %>_attribute' )->setName( - $this->getFieldName() . '[<%= data.index %>][attribute_id]' + $this->getFieldName() . '[<%- data.index %>][attribute_id]' )->setOptions( $this->_getAttributes($this->getAttributeSetId(), $escapeJsQuotes) ); diff --git a/app/code/Magento/GoogleShopping/etc/config.xml b/app/code/Magento/GoogleShopping/etc/config.xml index d5daf823e33eec7a1104abb4abfda0ec2a2a47fa..82d68fde8927948a6bbdd118a543e1628a100f25 100644 --- a/app/code/Magento/GoogleShopping/etc/config.xml +++ b/app/code/Magento/GoogleShopping/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <google> <googleshopping> diff --git a/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml b/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml index 82dfc0457cfd9c92a924cded4a157620eaf84236..03790f402f19a7d9e8cc601cb74a181cc4d7747e 100644 --- a/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml +++ b/app/code/Magento/GoogleShopping/view/adminhtml/templates/types/edit/attributes.phtml @@ -69,10 +69,10 @@ Gcontent.Attribute.prototype = { } } -var attributesSelectTemplate = '<tr id="<?php echo $block->getFieldId() ?>_<%= data.index %>">' + +var attributesSelectTemplate = '<tr id="<?php echo $block->getFieldId() ?>_<%- data.index %>">' + '<td>'+ '<?php echo $block->getAttributesSelectHtml(true) ?>' + - '<input type="hidden" name="<?php echo $block->getFieldName() ?>[<%= data.index %>][delete]" class="delete" value="">' + + '<input type="hidden" name="<?php echo $block->getFieldName() ?>[<%- data.index %>][delete]" class="delete" value="">' + '</td>' + '<td><?php echo $block->getGcontentAttributesSelectHtml() ?></td>' + '<td class="col-delete">' + <?php echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getDeleteButtonHtml()) ?> + '</td>' + diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php index f5139b50c8737e7cea0d5e9dc9cc1b7c2d36aac8..f44fe22015929528a2d7decdcc81858696c76e11 100644 --- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php @@ -262,7 +262,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType if (!$product->hasData($this->_keyStatusFilters)) { return [ \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED, - \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED + \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED, ]; } return $product->getData($this->_keyStatusFilters); diff --git a/app/code/Magento/GroupedProduct/etc/config.xml b/app/code/Magento/GroupedProduct/etc/config.xml index 6dcf6efdac0dc24ff4f21b451e2982c991743713..676a5554de340408a34f6244f78d2a3571c138f7 100644 --- a/app/code/Magento/GroupedProduct/etc/config.xml +++ b/app/code/Magento/GroupedProduct/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <checkout> <cart> diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml index d9e2b3e0aeb6eba332a17850e9fff66ca3d2da44..de0a513ca84823ca9faa42af5e247655f4eb73fe 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/templates/product/grouped/list.phtml @@ -11,30 +11,30 @@ <span class="draggable-handle"></span> <input type="hidden" - name="links[associated][<%= data.id %>][id]" - value="<%= data.id %>" + name="links[associated][<%- data.id %>][id]" + value="<%- data.id %>" data-role="id" /> <input type="hidden" - name="links[associated][<%= data.id %>][position]" - value="<%= data.position %>" + name="links[associated][<%- data.id %>][position]" + value="<%- data.position %>" data-role="position" /> </td> <td data-column="name" class="editable col-name"> - <%= data.name %> + <%- data.name %> </td> <td data-column="sku" class="col-sku"> - <%= data.sku %> + <%- data.sku %> </td> <td data-column="price" class="col-price"> - <%= data.price %> + <%- data.price %> </td> <td data-column="qty" class="editable col-qty col-number"> <input type="text" class="input-text " - name="links[associated][<%= data.id %>][qty]" - value="<%= data.qty %>"> + name="links[associated][<%- data.id %>][qty]" + value="<%- data.qty %>"> </td> <td data-column="actions" class="col-actions"> <button type="button" class="action- delete" data-role="delete"></button> diff --git a/app/code/Magento/ImportExport/etc/config.xml b/app/code/Magento/ImportExport/etc/config.xml index 84e0568291fb3e97e06338107c3e60bc03e455b5..b10fbc4e34c2cfe47314390998c47d13001f77a6 100644 --- a/app/code/Magento/ImportExport/etc/config.xml +++ b/app/code/Magento/ImportExport/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <general> <file> diff --git a/app/code/Magento/Indexer/Test/Unit/Model/Config/ConverterTest.php b/app/code/Magento/Indexer/Test/Unit/Model/Config/ConverterTest.php index b352c126ad3bcee98de67385eea22a472a73ffe5..3be90c1459b5a6f773450d9debaf86cf673d2e2d 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/Config/ConverterTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/Config/ConverterTest.php @@ -25,24 +25,4 @@ class ConverterTest extends \PHPUnit_Framework_TestCase $this->assertEquals($data['expected'], $this->_model->convert($dom)); } - - /** - * @param string $xmlData - * @dataProvider wrongXmlDataProvider - * @expectedException \Exception - */ - public function testMapThrowsExceptionWhenXmlHasWrongFormat($xmlData) - { - $dom = new \DOMDocument(); - $dom->loadXML($xmlData); - $this->_model->convert($dom); - } - - /** - * @return array - */ - public function wrongXmlDataProvider() - { - return [['<?xml version="1.0"?><config>']]; - } } diff --git a/app/code/Magento/Indexer/Test/Unit/Model/Resource/AbstractResourceTest.php b/app/code/Magento/Indexer/Test/Unit/Model/Resource/AbstractResourceTest.php index 353e5cfaf83f0d9ec0c36fd718a6f6c8a74cb74c..b35dd6e74c6a9b0aa4a9ef75d5421b2220449819 100644 --- a/app/code/Magento/Indexer/Test/Unit/Model/Resource/AbstractResourceTest.php +++ b/app/code/Magento/Indexer/Test/Unit/Model/Resource/AbstractResourceTest.php @@ -86,13 +86,13 @@ class AbstractResourceTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Exception - * @expectedExceptionMessage array_keys() expects parameter 1 to be array, null given */ public function testSyncDataException() { $connectionMock = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface', [], [], '', false); $this->_resourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock)); $this->_resourceMock->expects($this->any())->method('getTableName')->will($this->returnArgument(0)); + $connectionMock->expects($this->once())->method('rollback'); $this->model->syncData(); } diff --git a/app/code/Magento/Indexer/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index 4105ec2268543b68e0694380f2337541e7e3a8e7..f03aca19f0cc4ce32b6ce1b4b168d3d1ab391c37 100644 --- a/app/code/Magento/Indexer/etc/module.xml +++ b/app/code/Magento/Indexer/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Indexer" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Integration/Service/V1/AdminTokenService.php b/app/code/Magento/Integration/Service/V1/AdminTokenService.php index 5393184ff9bceb5e8386194049b9b8ed1161b1bf..12beccdb3bb4e04ee3c1851a4909f5b5c5445d0b 100644 --- a/app/code/Magento/Integration/Service/V1/AdminTokenService.php +++ b/app/code/Magento/Integration/Service/V1/AdminTokenService.php @@ -22,7 +22,7 @@ class AdminTokenService implements AdminTokenServiceInterface { /** * Token Model - * + *a * @var TokenModelFactory */ private $tokenModelFactory; diff --git a/app/code/Magento/Integration/etc/config.xml b/app/code/Magento/Integration/etc/config.xml index 8f525ccda1b7c6fa654df5a6b79fc1792df0f25c..6223b5bdc2d90b1dcd5c7facf13b46fa189589c8 100644 --- a/app/code/Magento/Integration/etc/config.xml +++ b/app/code/Magento/Integration/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <oauth> <cleanup> diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index 7ae7bc0918f138db78083e39678ac75e08ee10a9..ca7838bfbb11cdfa6f9b6eeddf527786b87493f5 100644 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Integration" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> <module name="Magento_User"/> </sequence> diff --git a/app/code/Magento/LayeredNavigation/etc/config.xml b/app/code/Magento/LayeredNavigation/etc/config.xml index 21e2b707da9e34d6b927bfc2c9ff47b42af2d01d..d8cfd0f552c797148358e62578f119f794cf695a 100644 --- a/app/code/Magento/LayeredNavigation/etc/config.xml +++ b/app/code/Magento/LayeredNavigation/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <catalog> <layered_navigation> diff --git a/app/code/Magento/Log/Block/Adminhtml/Customer/Edit/Tab/View/Status.php b/app/code/Magento/Log/Block/Adminhtml/Customer/Edit/Tab/View/Status.php deleted file mode 100644 index 0a6d8f2b1c8255a3db0b538695d7b25d6ba2adb5..0000000000000000000000000000000000000000 --- a/app/code/Magento/Log/Block/Adminhtml/Customer/Edit/Tab/View/Status.php +++ /dev/null @@ -1,151 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Log\Block\Adminhtml\Customer\Edit\Tab\View; - -/** - * Class Status - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class Status extends \Magento\Backend\Block\Template -{ - /** - * @var \Magento\Customer\Api\Data\CustomerInterface - */ - protected $customer; - - /** - * @var \Magento\Log\Model\Customer - */ - protected $customerLog; - - /** - * @var \Magento\Log\Model\Visitor - */ - protected $modelLog; - - /** - * @var \Magento\Log\Model\CustomerFactory - */ - protected $logFactory; - - /** - * @var \Magento\Customer\Api\Data\CustomerInterfaceFactory - */ - protected $customerFactory; - - /** - * @var \Magento\Framework\Api\DataObjectHelper - */ - protected $dataObjectHelper; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Log\Model\CustomerFactory $logFactory - * @param \Magento\Log\Model\Log $modelLog - * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory - * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Log\Model\CustomerFactory $logFactory, - \Magento\Log\Model\Log $modelLog, - \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Customer\Api\Data\CustomerInterfaceFactory $customerFactory, - \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, - array $data = [] - ) { - $this->logFactory = $logFactory; - $this->modelLog = $modelLog; - $this->dateTime = $dateTime; - $this->customerFactory = $customerFactory; - $this->dataObjectHelper = $dataObjectHelper; - parent::__construct($context, $data); - } - - /** - * @return string - */ - public function getStoreLastLoginDateTimezone() - { - return $this->_scopeConfig->getValue( - $this->_localeDate->getDefaultTimezonePath(), - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, - $this->getCustomer()->getStoreId() - ); - } - - /** - * @return \Magento\Customer\Api\Data\CustomerInterface - */ - public function getCustomer() - { - if (!$this->customer) { - $this->customer = $this->customerFactory->create(); - $this->dataObjectHelper - ->populateWithArray($this->customer, $this->_backendSession->getCustomerData()['account']); - } - return $this->customer; - } - - /** - * Get customer's current status - * - * @return \Magento\Framework\Phrase - */ - public function getCurrentStatus() - { - $log = $this->getCustomerLog(); - $interval = $this->modelLog->getOnlineMinutesInterval(); - if ($log->getLogoutAt() || - (new \DateTime())->getTimestamp() - strtotime($log->getLastVisitAt()) > $interval * 60 - ) { - return __('Offline'); - } - return __('Online'); - } - - /** - * Get customer last login date - * - * @return \Magento\Framework\Phrase|string - */ - public function getLastLoginDate() - { - $date = $this->getCustomerLog()->getLoginAt(); - if ($date) { - return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true); - } - return __('Never'); - } - - /** - * @return \Magento\Framework\Phrase|string - */ - public function getStoreLastLoginDate() - { - $date = $this->getCustomerLog()->getLoginAtTimestamp(); - if ($date) { - $date = $this->_localeDate->scopeDate($this->getCustomer()->getStoreId(), $date, true); - return $this->formatDate($date, \IntlDateFormatter::MEDIUM, true); - } - return __('Never'); - } - - /** - * Load Customer Log model - * - * @return \Magento\Log\Model\Customer - */ - public function getCustomerLog() - { - if (!$this->customerLog) { - $this->customerLog = $this->logFactory->create()->loadByCustomer($this->getCustomer()->getId()); - } - return $this->customerLog; - } -} diff --git a/app/code/Magento/Log/Test/Unit/Block/Adminhtml/Customer/Edit/Tab/View/StatusTest.php b/app/code/Magento/Log/Test/Unit/Block/Adminhtml/Customer/Edit/Tab/View/StatusTest.php deleted file mode 100644 index c155c22aca514c592d5a87f4b04c3d99ef491e35..0000000000000000000000000000000000000000 --- a/app/code/Magento/Log/Test/Unit/Block/Adminhtml/Customer/Edit/Tab/View/StatusTest.php +++ /dev/null @@ -1,162 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Log\Test\Unit\Block\Adminhtml\Customer\Edit\Tab\View; - -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; - -/** - * Class StatusTest - * @package Magento\Log\Block\Adminhtml\Edit\Tab\View - */ -class StatusTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Log\Block\Adminhtml\Customer\Edit\Tab\View\Status - */ - protected $block; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $logFactory; - - /** - * @var \Magento\Log\Model\Customer|\PHPUnit_Framework_MockObject_MockObject - */ - protected $customerLog; - - /** - * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $localeDate; - - /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $scopeConfig; - - protected function setUp() - { - $log = $this->getMock('Magento\Log\Model\Log', ['getOnlineMinutesInterval'], [], '', false); - $log->expects($this->any())->method('getOnlineMinutesInterval')->will($this->returnValue(1)); - - $this->customerLog = $this->getMockBuilder('Magento\Log\Model\Customer')->disableOriginalConstructor() - ->setMethods(['getLoginAt', 'getLoginAtTimestamp', 'loadByCustomer', 'getLogoutAt', 'getLastVisitAt']) - ->getMock(); - $this->customerLog->expects($this->any())->method('loadByCustomer')->will($this->returnSelf()); - - $this->logFactory = $this->getMockBuilder('Magento\Log\Model\CustomerFactory')->setMethods(['create']) - ->disableOriginalConstructor() - ->getMock(); - $this->logFactory->expects($this->any())->method('create')->will($this->returnValue($this->customerLog)); - - $dateTime = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime')->setMethods(['now']) - ->disableOriginalConstructor() - ->getMock(); - $dateTime->expects($this->any())->method('now')->will($this->returnCallback(function () { - return date('Y-m-d H:i:s'); - })); - - $customer = $this->getMock('\Magento\Customer\Api\Data\CustomerInterface'); - $customer->expects($this->any())->method('getId')->will($this->returnValue(1)); - $customer->expects($this->any())->method('getStoreId')->will($this->returnValue(1)); - - $customerFactory = $this->getMockBuilder('\Magento\Customer\Api\Data\CustomerInterfaceFactory') - ->setMethods(['create']) - ->disableOriginalConstructor() - ->getMock(); - $customerFactory->expects($this->any())->method('create') - ->will($this->returnValue($customer)); - - $customerData = ['account' => ['id' => 1, 'store_id' => 1]]; - $backendSession = $this->getMockBuilder('\Magento\Backend\Model\Session') - ->setMethods(['getCustomerData'])->disableOriginalConstructor()->getMock(); - $backendSession->expects($this->any())->method('getCustomerData')->will($this->returnValue($customerData)); - - $this->localeDate = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\Timezone') - ->setMethods(['scopeDate', 'formatDateTime', 'getDefaultTimezonePath']) - ->disableOriginalConstructor()->getMock(); - $this->localeDate->expects($this->any())->method('getDefaultTimezonePath') - ->will($this->returnValue('path/to/default/timezone')); - - $this->scopeConfig = $this->getMockBuilder('Magento\Framework\App\Config') - ->setMethods(['getValue']) - ->disableOriginalConstructor()->getMock(); - - $objectManagerHelper = new ObjectManagerHelper($this); - $this->block = $objectManagerHelper->getObject( - 'Magento\Log\Block\Adminhtml\Customer\Edit\Tab\View\Status', - [ - 'logFactory' => $this->logFactory, - 'localeDate' => $this->localeDate, - 'scopeConfig' => $this->scopeConfig, - 'modelLog' => $log, - 'dateTime' => $dateTime, - 'customerFactory' => $customerFactory, - 'backendSession' => $backendSession - ] - ); - } - - public function testGetCustomerLog() - { - $this->logFactory->expects($this->once())->method('create')->will($this->returnValue($this->customerLog)); - $this->assertSame($this->customerLog, $this->block->getCustomerLog()); - } - - public function testGetCurrentStatusOffline() - { - $date = date('Y-m-d H:i:s'); - $this->customerLog->expects($this->any())->method('getLogoutAt')->will($this->returnValue($date)); - $this->assertEquals('Offline', $this->block->getCurrentStatus()); - } - - public function testGetCurrentStatusOnline() - { - $date = date('Y-m-d H:i:s'); - $this->customerLog->expects($this->any())->method('getLogoutAt')->will($this->returnValue(0)); - $this->customerLog->expects($this->any())->method('getLastVisitAt')->will($this->returnValue($date)); - $this->assertEquals('Online', $this->block->getCurrentStatus()); - } - - public function testGetLastLoginDate() - { - $date = date('Y-m-d H:i:s'); - $this->customerLog->expects($this->any())->method('getLoginAt')->will($this->returnValue($date)); - $this->localeDate->expects($this->once())->method('formatDateTime')->will($this->returnValue($date)); - $this->assertEquals($date, $this->block->getLastLoginDate()); - } - - public function testAfterGetLastLoginDateNever() - { - $this->assertEquals('Never', $this->block->getLastLoginDate()); - } - - public function testGetStoreLastLoginDate() - { - $date = date('Y-m-d H:i:s'); - $time = strtotime($date); - - $this->localeDate->expects($this->once())->method('scopeDate')->will($this->returnValue($date)); - $this->localeDate->expects($this->once())->method('formatDateTime')->will($this->returnValue($date)); - - $this->customerLog->expects($this->any())->method('getLoginAtTimestamp')->will($this->returnValue($time)); - $this->assertEquals($date, $this->block->getStoreLastLoginDate()); - } - - public function testGetStoreLastLoginDateNever() - { - $this->assertEquals('Never', $this->block->getStoreLastLoginDate()); - } - - public function testGetStoreLastLoginDateTimezone() - { - $this->scopeConfig->expects($this->once())->method('getValue') - ->with('path/to/default/timezone', 'store', 1) - ->will($this->returnValue('America/Los_Angeles')); - $this->block->getStoreLastLoginDateTimezone(); - } -} diff --git a/app/code/Magento/Log/etc/config.xml b/app/code/Magento/Log/etc/config.xml index f77e48a2099d1be7ffdd14754097719b9f701434..0ca74bb05b554e466039793a3e89238a1ac18ebe 100644 --- a/app/code/Magento/Log/etc/config.xml +++ b/app/code/Magento/Log/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <log> <visitor> diff --git a/app/code/Magento/Log/view/adminhtml/layout/customer_form.xml b/app/code/Magento/Log/view/adminhtml/layout/customer_form.xml deleted file mode 100644 index f53b7241321ea6154c32b08cab9e066644c755d2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Log/view/adminhtml/layout/customer_form.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> - <body> - <referenceBlock name="personal_info"> - <block class="Magento\Log\Block\Adminhtml\Customer\Edit\Tab\View\Status" name="view_customer_status" template="customer/status.phtml"/> - </referenceBlock> - </body> -</page> diff --git a/app/code/Magento/Log/view/adminhtml/templates/customer/status.phtml b/app/code/Magento/Log/view/adminhtml/templates/customer/status.phtml deleted file mode 100644 index 3d8c1ac2912e2e312967a447b2908791598aae14..0000000000000000000000000000000000000000 --- a/app/code/Magento/Log/view/adminhtml/templates/customer/status.phtml +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -// @codingStandardsIgnoreFile - -/** - * Template for block \Magento\Log\Block\Adminhtml\Customer\Edit\Tab\View\Status - */ - -$lastLoginDateAdmin = $block->getLastLoginDate(); -$lastLoginDateStore = $block->getStoreLastLoginDate(); -?> -<tr> - <th><?php echo __('Last Logged In:') ?></th> - <td><?php echo $lastLoginDateAdmin ?> (<?php echo $block->getCurrentStatus() ?>)</td> -</tr> -<?php if ($lastLoginDateAdmin != $lastLoginDateStore): ?> -<tr> - <th><?php echo __('Last Logged In (%1):', $block->getStoreLastLoginDateTimezone()) ?></th> - <td><?php echo $lastLoginDateStore ?> (<?php echo $block->getCurrentStatus() ?>)</td> -</tr> -<?php endif; ?> diff --git a/app/code/Magento/Core/LICENSE.txt b/app/code/Magento/MediaStorage/LICENSE.txt similarity index 100% rename from app/code/Magento/Core/LICENSE.txt rename to app/code/Magento/MediaStorage/LICENSE.txt diff --git a/app/code/Magento/Core/LICENSE_AFL.txt b/app/code/Magento/MediaStorage/LICENSE_AFL.txt similarity index 100% rename from app/code/Magento/Core/LICENSE_AFL.txt rename to app/code/Magento/MediaStorage/LICENSE_AFL.txt diff --git a/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/_files/config.xml b/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/_files/config.xml index beb583cb58d9941ab51927d7f124495d0547f07c..4cffed1a1cc9e003d9a125797275c1787eca1afc 100644 --- a/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/_files/config.xml +++ b/app/code/Magento/MediaStorage/Test/Unit/Model/File/Storage/_files/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> <default> <resources> <fixture_module_setup> diff --git a/app/code/Magento/MediaStorage/composer.json b/app/code/Magento/MediaStorage/composer.json index bfd1965a73ff2009fb06f04efa3d4d43a4620706..ccc5a944717a31326fcdcb7af0248c7781ab14ce 100644 --- a/app/code/Magento/MediaStorage/composer.json +++ b/app/code/Magento/MediaStorage/composer.json @@ -5,7 +5,6 @@ "php": "~5.5.0|~5.6.0", "magento/module-store": "0.42.0-beta11", "magento/module-backend": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-config": "0.42.0-beta11", "magento/framework": "0.42.0-beta11", "magento/magento-composer-installer": "*" diff --git a/app/code/Magento/MediaStorage/i18n/de_DE.csv b/app/code/Magento/MediaStorage/i18n/de_DE.csv new file mode 100644 index 0000000000000000000000000000000000000000..7cfc4ae6c12b63ecc839587142d3f9d8c6c9f8f6 --- /dev/null +++ b/app/code/Magento/MediaStorage/i18n/de_DE.csv @@ -0,0 +1,10 @@ +"Requested resource not found","Requested resource not found" +"File %1 does not exist","File %1 does not exist" +"File %1 is not readable","File %1 is not readable" +"Parent directory does not exist: %1","Parent directory does not exist: %1" +"File system",Dateisystem +"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" +"Wrong file info format","Falsches Format Dateiinfo" +"Please set available and/or protected paths list(s) before validation.","Bitte stellen Sie vor der Bestätigung die Liste(n) der verfügbaren und/oder geschützten Pfade ein." +"Unable to create directory: %1","Unable to create directory: %1" +"Unable to save file: %1","Unable to save file: %1" diff --git a/app/code/Magento/MediaStorage/i18n/en_US.csv b/app/code/Magento/MediaStorage/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..b5cc34a4d49630ed633b764052b2d4e443bb615e --- /dev/null +++ b/app/code/Magento/MediaStorage/i18n/en_US.csv @@ -0,0 +1,10 @@ +"Requested resource not found","Requested resource not found" +"File %1 does not exist","File %1 does not exist" +"File %1 is not readable","File %1 is not readable" +"Parent directory does not exist: %1","Parent directory does not exist: %1" +"File system","File system" +"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" +"Wrong file info format","Wrong file info format" +"Please set available and/or protected paths list(s) before validation.","Please set available and/or protected paths list(s) before validation." +"Unable to create directory: %1","Unable to create directory: %1" +"Unable to save file: %1","Unable to save file: %1" diff --git a/app/code/Magento/MediaStorage/i18n/es_ES.csv b/app/code/Magento/MediaStorage/i18n/es_ES.csv new file mode 100644 index 0000000000000000000000000000000000000000..0ad1da242f2a656889e6444a114fb019844bd88f --- /dev/null +++ b/app/code/Magento/MediaStorage/i18n/es_ES.csv @@ -0,0 +1,10 @@ +"Requested resource not found","Requested resource not found" +"File %1 does not exist","File %1 does not exist" +"File %1 is not readable","File %1 is not readable" +"Parent directory does not exist: %1","Parent directory does not exist: %1" +"File system","Sistema de archivos" +"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" +"Wrong file info format","Formato de información del archivo incorrecto" +"Please set available and/or protected paths list(s) before validation.","Por favor, indique la(s) lista(s) de rutas disponibles y/o protegidas antes de la validación." +"Unable to create directory: %1","Unable to create directory: %1" +"Unable to save file: %1","Unable to save file: %1" diff --git a/app/code/Magento/MediaStorage/i18n/fr_FR.csv b/app/code/Magento/MediaStorage/i18n/fr_FR.csv new file mode 100644 index 0000000000000000000000000000000000000000..0d2d7dab58b82227c16c77ffbf4bee0805edb2e9 --- /dev/null +++ b/app/code/Magento/MediaStorage/i18n/fr_FR.csv @@ -0,0 +1,10 @@ +"Requested resource not found","Requested resource not found" +"File %1 does not exist","File %1 does not exist" +"File %1 is not readable","File %1 is not readable" +"Parent directory does not exist: %1","Parent directory does not exist: %1" +"File system","Système de fichiers" +"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" +"Wrong file info format","Informations du format de fichiers incorrectes" +"Please set available and/or protected paths list(s) before validation.","Veuillez définir la/les liste(s) de chemins disponibles et/ou protégés avant la validation." +"Unable to create directory: %1","Unable to create directory: %1" +"Unable to save file: %1","Unable to save file: %1" diff --git a/app/code/Magento/MediaStorage/i18n/nl_NL.csv b/app/code/Magento/MediaStorage/i18n/nl_NL.csv new file mode 100644 index 0000000000000000000000000000000000000000..abedda328cd459219fe19ec933cbaebc8d7115bd --- /dev/null +++ b/app/code/Magento/MediaStorage/i18n/nl_NL.csv @@ -0,0 +1,10 @@ +"Requested resource not found","Requested resource not found" +"File %1 does not exist","File %1 does not exist" +"File %1 is not readable","File %1 is not readable" +"Parent directory does not exist: %1","Parent directory does not exist: %1" +"File system",Bestandssysteem +"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" +"Wrong file info format","Verkeerde bestandsinformatiebestand" +"Please set available and/or protected paths list(s) before validation.","Stel beschikbare en/of beschermde pad lijst(en) in voor validatie." +"Unable to create directory: %1","Unable to create directory: %1" +"Unable to save file: %1","Unable to save file: %1" diff --git a/app/code/Magento/MediaStorage/i18n/pt_BR.csv b/app/code/Magento/MediaStorage/i18n/pt_BR.csv new file mode 100644 index 0000000000000000000000000000000000000000..d9022058d08f66c809ffd2c697aff9cea6bf7e56 --- /dev/null +++ b/app/code/Magento/MediaStorage/i18n/pt_BR.csv @@ -0,0 +1,10 @@ +"Requested resource not found","Requested resource not found" +"File %1 does not exist","File %1 does not exist" +"File %1 is not readable","File %1 is not readable" +"Parent directory does not exist: %1","Parent directory does not exist: %1" +"File system","Sistema de arquivo" +"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" +"Wrong file info format","Formato de arquivo de informação errado" +"Please set available and/or protected paths list(s) before validation.","Por favor defina lista(s) de caminhos disponÃveis e/ou protegidos antes da validação." +"Unable to create directory: %1","Unable to create directory: %1" +"Unable to save file: %1","Unable to save file: %1" diff --git a/app/code/Magento/MediaStorage/i18n/zh_CN.csv b/app/code/Magento/MediaStorage/i18n/zh_CN.csv new file mode 100644 index 0000000000000000000000000000000000000000..c0847a9f4600e53e9662f2b682a52efa1b48d1f1 --- /dev/null +++ b/app/code/Magento/MediaStorage/i18n/zh_CN.csv @@ -0,0 +1,10 @@ +"Requested resource not found","Requested resource not found" +"File %1 does not exist","File %1 does not exist" +"File %1 is not readable","File %1 is not readable" +"Parent directory does not exist: %1","Parent directory does not exist: %1" +"File system",文件系统 +"Unable to save file ""%1"" at ""%2""","Unable to save file ""%1"" at ""%2""" +"Wrong file info format",é”™è¯¯çš„æ–‡ä»¶ä¿¡æ¯æ ¼å¼ +"Please set available and/or protected paths list(s) before validation.",请设置有效并/或å—ä¿æŠ¤çš„è·¯å¾„åˆ—è¡¨ï¼ŒéšåŽå†éªŒè¯ã€‚ +"Unable to create directory: %1","Unable to create directory: %1" +"Unable to save file: %1","Unable to save file: %1" diff --git a/app/code/Magento/Msrp/etc/config.xml b/app/code/Magento/Msrp/etc/config.xml index e0a72f95dab6a9f8cf3dff985f3561407f87a41d..dd50e9de8178b9fb198156ab16074b9eede44a8f 100644 --- a/app/code/Magento/Msrp/etc/config.xml +++ b/app/code/Magento/Msrp/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <sales> <msrp> diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/Plugin.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/Plugin.php index fb09bbfca7410a68c6ea4b2395792af9c6dfd3b7..d0fe99eda0571a212c1c5657dbba5721a3b8d8c6 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/Plugin.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/Plugin.php @@ -31,7 +31,7 @@ class Plugin * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeInit(\Magento\Checkout\Model\Cart $subject) + public function beforeSave(\Magento\Checkout\Model\Cart $subject) { if ($this->checkoutSession->getCheckoutState() === State::STEP_SELECT_ADDRESSES) { $this->checkoutSession->setCheckoutState(\Magento\Checkout\Model\Session::CHECKOUT_STATE_BEGIN); diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/Multishipping/PluginTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/Multishipping/PluginTest.php index 10f158e0e893817f76c1b1e637054a70957895d0..a0eea6088d081f56dc27ae3c79fcda9e06def353 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/Multishipping/PluginTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/Multishipping/PluginTest.php @@ -44,7 +44,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase ->willReturn(State::STEP_SELECT_ADDRESSES); $this->checkoutSessionMock->expects($this->once())->method('setCheckoutState') ->with(Session::CHECKOUT_STATE_BEGIN); - $this->model->beforeInit($this->cartMock); + $this->model->beforeSave($this->cartMock); } public function testBeforeInitCaseFalse() @@ -52,6 +52,6 @@ class PluginTest extends \PHPUnit_Framework_TestCase $this->checkoutSessionMock->expects($this->once())->method('getCheckoutState') ->willReturn(''); $this->checkoutSessionMock->expects($this->never())->method('setCheckoutState'); - $this->model->beforeInit($this->cartMock); + $this->model->beforeSave($this->cartMock); } } diff --git a/app/code/Magento/Multishipping/etc/config.xml b/app/code/Magento/Multishipping/etc/config.xml index 76621b4a03bff0de66ee39c828fbb18e6feabce5..c08c0590401b67429190c650e3ae3f80a9d728f7 100644 --- a/app/code/Magento/Multishipping/etc/config.xml +++ b/app/code/Magento/Multishipping/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <multishipping> <options> diff --git a/app/code/Magento/Multishipping/etc/frontend/page_types.xml b/app/code/Magento/Multishipping/etc/frontend/page_types.xml index 11be8441bb63b38b3ba5fc75319e8b988f241ab3..f58e8c5bb6a69f2c9d05fb543fd08eec5f1fd284 100644 --- a/app/code/Magento/Multishipping/etc/frontend/page_types.xml +++ b/app/code/Magento/Multishipping/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="checkout_cart_multishipping" label="Catalog Quick Search Form Suggestions"/> <type id="checkout_cart_multishipping_address_editaddress" label="Multishipping Checkout One Address Edit Form"/> <type id="checkout_cart_multishipping_address_editbilling" label="Multishipping Checkout Billing Address Edit Form"/> diff --git a/app/code/Magento/Multishipping/etc/module.xml b/app/code/Magento/Multishipping/etc/module.xml index 3ea0ac29db5ebb261f3a9dd4a7d17704bac1acfc..b6ea0b6ce80cad9020365e8fc77bfe09629ddbb9 100644 --- a/app/code/Magento/Multishipping/etc/module.xml +++ b/app/code/Magento/Multishipping/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Multishipping" setup_version="2.0.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> <module name="Magento_Catalog"/> </sequence> diff --git a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_overview.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_overview.xml index b71e35b9b4c706d22a15c6ae0e40b994c2a253b7..8ea4f26cae9086940879b09517d88a63951acce2 100644 --- a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_overview.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_overview.xml @@ -15,7 +15,7 @@ </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Multishipping\Block\Checkout\Overview" name="checkout_overview" template="checkout/overview.phtml"> + <block class="Magento\Multishipping\Block\Checkout\Overview" name="checkout_overview" template="checkout/overview.phtml" cacheable="false"> <arguments> <argument name="renderer_template" xsi:type="string">Magento_Multishipping::checkout/item/default.phtml</argument> <argument name="row_renderer_template" xsi:type="string">Magento_Multishipping::checkout/overview/item.phtml</argument> diff --git a/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml b/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml index c2a224258c246cce788667ba43ce9b636039be13..8d711654da66d079380348542d5680d39a73df0f 100644 --- a/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml +++ b/app/code/Magento/Multishipping/view/frontend/templates/checkout/address/select.phtml @@ -39,13 +39,13 @@ </div> </div> </div> -<script> -require(['jquery', 'mage/mage'], function(jQuery){ - - jQuery('.actions').mage('address', { - addAddress: "button[role='add-address']", - addAddressLocation: '<?php echo $block->getAddNewUrl() ?>' - }); - -}); +<script type="text/x-magento-init"> + { + ".actions": { + "address": { + "addAddress": "button[role='add-address']", + "addAddressLocation": "<?php echo $block->getAddNewUrl() ?>" + } + } + } </script> diff --git a/app/code/Magento/Newsletter/Block/Subscribe.php b/app/code/Magento/Newsletter/Block/Subscribe.php index 66ecb517455a96c3c46816e9b789144587d67b3e..ae9549930d6b67849ffa9b0079b513622c1db053 100644 --- a/app/code/Magento/Newsletter/Block/Subscribe.php +++ b/app/code/Magento/Newsletter/Block/Subscribe.php @@ -13,48 +13,6 @@ namespace Magento\Newsletter\Block; class Subscribe extends \Magento\Framework\View\Element\Template { - /** - * Newsletter session - * - * @var \Magento\Newsletter\Model\Session - */ - protected $_newsletterSession; - - /** - * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Newsletter\Model\Session $newsletterSession - * @param array $data - */ - public function __construct( - \Magento\Framework\View\Element\Template\Context $context, - \Magento\Newsletter\Model\Session $newsletterSession, - array $data = [] - ) { - parent::__construct($context, $data); - $this->_newsletterSession = $newsletterSession; - $this->_isScopePrivate = true; - } - - /** - * Get success message - * - * @return string - */ - public function getSuccessMessage() - { - return $this->_newsletterSession->getSuccess(); - } - - /** - * Get error message - * - * @return string - */ - public function getErrorMessage() - { - return $this->_newsletterSession->getError(); - } - /** * Retrieve form action url and set "secure" param to avoid confirm * message when we submit form from secure page to unsecure diff --git a/app/code/Magento/Newsletter/etc/config.xml b/app/code/Magento/Newsletter/etc/config.xml index 1ee0d4f45b4dbc1eb4560a5d34128003dd4b30ec..92b70813d46942884b7a4a55c7c69627612fef32 100644 --- a/app/code/Magento/Newsletter/etc/config.xml +++ b/app/code/Magento/Newsletter/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <newsletter> <subscription> diff --git a/app/code/Magento/Newsletter/etc/frontend/page_types.xml b/app/code/Magento/Newsletter/etc/frontend/page_types.xml index 39889513a5efc5bd26ece50a48f04713cd008cfc..f6976324e9a862bec0d095ce8ada89ced4ee086f 100644 --- a/app/code/Magento/Newsletter/etc/frontend/page_types.xml +++ b/app/code/Magento/Newsletter/etc/frontend/page_types.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="newsletter_manage_index" label="Customer My Account Newsletter Subscriptions"/> </page_types> diff --git a/app/code/Magento/Newsletter/etc/module.xml b/app/code/Magento/Newsletter/etc/module.xml index 13a4697cc7900c7ff670756ad6768ca439988b36..7d5356b547755df7fd21858f504d8208d1339fd8 100644 --- a/app/code/Magento/Newsletter/etc/module.xml +++ b/app/code/Magento/Newsletter/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Newsletter" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> <module name="Magento_Customer"/> <module name="Magento_Eav"/> diff --git a/app/code/Magento/OfflinePayments/Model/Banktransfer.php b/app/code/Magento/OfflinePayments/Model/Banktransfer.php index 4cc48a575272039644fe0c1211c4172249647f60..9eee92e1e2478a960e71e599bc4d78bea4d97334 100644 --- a/app/code/Magento/OfflinePayments/Model/Banktransfer.php +++ b/app/code/Magento/OfflinePayments/Model/Banktransfer.php @@ -7,6 +7,8 @@ namespace Magento\OfflinePayments\Model; /** * Bank Transfer payment method model + * + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() */ class Banktransfer extends \Magento\Payment\Model\Method\AbstractMethod { diff --git a/app/code/Magento/OfflinePayments/Model/Cashondelivery.php b/app/code/Magento/OfflinePayments/Model/Cashondelivery.php index c1a125463d926cf328e42fb4b9c43b9102112430..06f2862acd07e6e7ed30da8a1dd3351e639014d8 100644 --- a/app/code/Magento/OfflinePayments/Model/Cashondelivery.php +++ b/app/code/Magento/OfflinePayments/Model/Cashondelivery.php @@ -7,6 +7,8 @@ namespace Magento\OfflinePayments\Model; /** * Cash on delivery payment method model + * + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() */ class Cashondelivery extends \Magento\Payment\Model\Method\AbstractMethod { diff --git a/app/code/Magento/OfflinePayments/Model/Checkmo.php b/app/code/Magento/OfflinePayments/Model/Checkmo.php index 2de8ab28e97bc2e099d3579e75965cb49726fbd3..e282b502979df74feecf1ffc6a6509e7de651a71 100644 --- a/app/code/Magento/OfflinePayments/Model/Checkmo.php +++ b/app/code/Magento/OfflinePayments/Model/Checkmo.php @@ -5,6 +5,11 @@ */ namespace Magento\OfflinePayments\Model; +/** + * Class Checkmo + * + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() + */ class Checkmo extends \Magento\Payment\Model\Method\AbstractMethod { /** diff --git a/app/code/Magento/OfflinePayments/Model/Purchaseorder.php b/app/code/Magento/OfflinePayments/Model/Purchaseorder.php index 180ec57133db7e6eadf0964a33cea8797fd60eca..3a4aa15d089031bbb5aafd87523d4bba1999516f 100644 --- a/app/code/Magento/OfflinePayments/Model/Purchaseorder.php +++ b/app/code/Magento/OfflinePayments/Model/Purchaseorder.php @@ -5,6 +5,11 @@ */ namespace Magento\OfflinePayments\Model; +/** + * Class Purchaseorder + * + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() + */ class Purchaseorder extends \Magento\Payment\Model\Method\AbstractMethod { /** diff --git a/app/code/Magento/OfflinePayments/etc/config.xml b/app/code/Magento/OfflinePayments/etc/config.xml index 3aac1bcdd6ca892ca4fa3c7a4f766f22963f84e6..67b15cb57e22d428d611630b43dd3fbf39af3c83 100644 --- a/app/code/Magento/OfflinePayments/etc/config.xml +++ b/app/code/Magento/OfflinePayments/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <payment> <checkmo> diff --git a/app/code/Magento/OfflinePayments/etc/module.xml b/app/code/Magento/OfflinePayments/etc/module.xml index e458b0120953520956ab910a5e7a0ad7f49b54b6..c6cc2bf889da1d50dd65d60f2205c291d3f94b8d 100644 --- a/app/code/Magento/OfflinePayments/etc/module.xml +++ b/app/code/Magento/OfflinePayments/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_OfflinePayments" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> <module name="Magento_Catalog"/> </sequence> diff --git a/app/code/Magento/OfflineShipping/etc/config.xml b/app/code/Magento/OfflineShipping/etc/config.xml index e10269983be960658e0244257c2e3a513dfe1434..09dd89a88e3aa8da935ca5297094b58f1b67ee05 100644 --- a/app/code/Magento/OfflineShipping/etc/config.xml +++ b/app/code/Magento/OfflineShipping/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <carriers> <flatrate> diff --git a/app/code/Magento/PageCache/etc/config.xml b/app/code/Magento/PageCache/etc/config.xml index 8bb6fd48f64a1ef1e00e1400ac914a63cb11d3c2..a1530794673bb554448856fb64d4346d5a44c40b 100644 --- a/app/code/Magento/PageCache/etc/config.xml +++ b/app/code/Magento/PageCache/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <system> <full_page_cache> diff --git a/app/code/Magento/PageCache/etc/module.xml b/app/code/Magento/PageCache/etc/module.xml index 27fb178b409af4f29751c943930b30bd3edaac66..bd152d0a9e584b886647f50874c10a515eccd8d6 100644 --- a/app/code/Magento/PageCache/etc/module.xml +++ b/app/code/Magento/PageCache/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_PageCache" setup_version="1.6.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index f00d9117f4f5792fbc69b4236c278889e47f9cb6..0fd732033538183850c40b55d5bf32f233362def 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -5,7 +5,6 @@ */ namespace Magento\Payment\Model; -use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Model\AbstractExtensibleModel; /** @@ -35,8 +34,8 @@ class Info extends AbstractExtensibleModel /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -46,8 +45,8 @@ class Info extends AbstractExtensibleModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -59,7 +58,7 @@ class Info extends AbstractExtensibleModel parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index fa331dd477414a2113dceee2ed2a447f2c7c8a07..926017b8bcce80f53a492ad3cb6849d4cbc2d2eb 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -222,7 +222,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -233,7 +233,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, @@ -244,7 +244,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -848,4 +848,25 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl { $this->_debug($debugData); } + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\PaymentMethodExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\PaymentMethodExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\PaymentMethodExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 23e7dfda59a9b40a4da2e115d01deb1ff1017307..8fdec55da4492bdcbe1c38fd2c3587bcf4a830eb 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -6,6 +6,7 @@ namespace Magento\Payment\Model\Method; /** + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Cc extends \Magento\Payment\Model\Method\AbstractMethod @@ -45,7 +46,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -60,7 +61,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, @@ -74,7 +75,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $paymentData, $scopeConfig, diff --git a/app/code/Magento/Payment/Model/Method/Free.php b/app/code/Magento/Payment/Model/Method/Free.php index 00c4145d7ba58687e1361b1d109a2645c79775c4..3793669383195a50c582674ed89ce19c634f6e82 100644 --- a/app/code/Magento/Payment/Model/Method/Free.php +++ b/app/code/Magento/Payment/Model/Method/Free.php @@ -9,6 +9,7 @@ use Magento\Framework\Pricing\PriceCurrencyInterface; /** * Free payment method + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() */ class Free extends \Magento\Payment\Model\Method\AbstractMethod { @@ -43,7 +44,7 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -56,7 +57,7 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, @@ -68,7 +69,7 @@ class Free extends \Magento\Payment\Model\Method\AbstractMethod parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $paymentData, $scopeConfig, diff --git a/app/code/Magento/Payment/Model/Method/Substitution.php b/app/code/Magento/Payment/Model/Method/Substitution.php index 98563e5092d778de27d06e54b523c7e5753bf216..819ecc267d130dee4be334565a961cb5a8184d9d 100644 --- a/app/code/Magento/Payment/Model/Method/Substitution.php +++ b/app/code/Magento/Payment/Model/Method/Substitution.php @@ -8,6 +8,8 @@ namespace Magento\Payment\Model\Method; /** * Substitution payment method for non-existing payments + * + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() */ class Substitution extends AbstractMethod { diff --git a/app/code/Magento/Payment/Test/Unit/Model/Method/FreeTest.php b/app/code/Magento/Payment/Test/Unit/Model/Method/FreeTest.php index 064beb8b5428e3468b0c12a64e5652412d8d49ef..9976a46c96dee56bd06824421b160a98ef2e91e2 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/Method/FreeTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/Method/FreeTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Payment\Test\Unit\Model\Method; class FreeTest extends \PHPUnit_Framework_TestCase @@ -27,13 +30,19 @@ class FreeTest extends \PHPUnit_Framework_TestCase $context->expects($this->any())->method('getEventDispatcher')->willReturn($eventManagerMock); $registry = $this->getMock('\Magento\Framework\Registry', [], [], '', false); - $metadataService = $this->getMock('\Magento\Framework\Api\MetadataServiceInterface'); + $extensionAttributesFactory = $this->getMock( + 'Magento\Framework\Api\ExtensionAttributesFactory', + [], + [], + '', + false + ); $customAttributeFactory = $this->getMock('\Magento\Framework\Api\AttributeValueFactory', [], [], '', false); $this->methodFree = new \Magento\Payment\Model\Method\Free( $context, $registry, - $metadataService, + $extensionAttributesFactory, $customAttributeFactory, $paymentData, $this->scopeConfig, diff --git a/app/code/Magento/Payment/etc/config.xml b/app/code/Magento/Payment/etc/config.xml index 79f703ef82aa1d1b1d7654b66f348ceac4c51a99..3fc78a9194a2cb6e78fc764c2734fa904cb8664d 100644 --- a/app/code/Magento/Payment/etc/config.xml +++ b/app/code/Magento/Payment/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <payment> <free> diff --git a/app/code/Magento/Persistent/etc/config.xml b/app/code/Magento/Persistent/etc/config.xml index 0dd16042c81fe4e9c0cac6dd176c65a1faedc591..c34916a7735a29fff1ff7e2c9c6dbc90face6310 100644 --- a/app/code/Magento/Persistent/etc/config.xml +++ b/app/code/Magento/Persistent/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <persistent> <options> diff --git a/app/code/Magento/ProductAlert/etc/config.xml b/app/code/Magento/ProductAlert/etc/config.xml index 23edc92c8f01e34aa136710ef54008f2382c9ea2..aae9903bfd345db05443b7180a285e3026c85aa5 100644 --- a/app/code/Magento/ProductAlert/etc/config.xml +++ b/app/code/Magento/ProductAlert/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <catalog> <productalert> diff --git a/app/code/Magento/Quote/Api/Data/AddressInterface.php b/app/code/Magento/Quote/Api/Data/AddressInterface.php index 689ec768e2b5a8082057fed91962eceffa03b780..4b0487a3431dcb3859814f8bcdaefe14a2c8719a 100644 --- a/app/code/Magento/Quote/Api/Data/AddressInterface.php +++ b/app/code/Magento/Quote/Api/Data/AddressInterface.php @@ -334,4 +334,19 @@ interface AddressInterface extends \Magento\Framework\Api\ExtensibleDataInterfac * @return $this */ public function setEmail($email); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\AddressExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\AddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\AddressExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Quote/Api/Data/CartInterface.php b/app/code/Magento/Quote/Api/Data/CartInterface.php index 1fe5372c518bb2fabc106f13a11ef7d289181e65..2a56c448336bf4f8ad5bd9da2b588b6ac7582598 100644 --- a/app/code/Magento/Quote/Api/Data/CartInterface.php +++ b/app/code/Magento/Quote/Api/Data/CartInterface.php @@ -345,4 +345,19 @@ interface CartInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setCustomerTaxClassId($customerTaxClassId); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\CartExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\CartExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\CartExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Quote/Api/Data/CartItemInterface.php b/app/code/Magento/Quote/Api/Data/CartItemInterface.php index 511184992ab89c18d0177a9eca99ce3312bfb20f..4951fe1698006419285934bc95c4645537394e1c 100644 --- a/app/code/Magento/Quote/Api/Data/CartItemInterface.php +++ b/app/code/Magento/Quote/Api/Data/CartItemInterface.php @@ -130,4 +130,19 @@ interface CartItemInterface extends \Magento\Framework\Api\ExtensibleDataInterfa * @return $this */ public function setQuoteId($quoteId); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\CartItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\CartItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\CartItemExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php b/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php index bfad641fd0a04d326c6ccb6312c26ac0580fde42..f3683415e7580eed924e5270f6676da8fcc73ff7 100644 --- a/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php +++ b/app/code/Magento/Quote/Api/Data/CartSearchResultsInterface.php @@ -46,7 +46,7 @@ interface CartSearchResultsInterface extends \Magento\Framework\Api\SearchResult * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return $this */ - public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); + public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null); /** * Get total count. diff --git a/app/code/Magento/Quote/Api/Data/CurrencyInterface.php b/app/code/Magento/Quote/Api/Data/CurrencyInterface.php index b00350c5f600c2fc3917dbaa33c4315f56bf8c03..81a0ff8d3fad21400625f7c51c0634ede6dc2901 100644 --- a/app/code/Magento/Quote/Api/Data/CurrencyInterface.php +++ b/app/code/Magento/Quote/Api/Data/CurrencyInterface.php @@ -147,4 +147,19 @@ interface CurrencyInterface extends \Magento\Framework\Api\ExtensibleDataInterfa * @return $this */ public function setBaseToQuoteRate($baseToQuoteRate); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\CurrencyExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\CurrencyExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\CurrencyExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Quote/Api/Data/PaymentInterface.php b/app/code/Magento/Quote/Api/Data/PaymentInterface.php index 7d437b97e2326a9044b57a481e06ce8393346f77..7f0704edbfe32782368afd6ff87d0d633037dbd5 100644 --- a/app/code/Magento/Quote/Api/Data/PaymentInterface.php +++ b/app/code/Magento/Quote/Api/Data/PaymentInterface.php @@ -147,4 +147,19 @@ interface PaymentInterface extends \Magento\Framework\Api\ExtensibleDataInterfac * @return $this */ public function setAdditionalData($additionalData); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\PaymentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\PaymentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\PaymentExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Quote/Api/Data/PaymentMethodInterface.php b/app/code/Magento/Quote/Api/Data/PaymentMethodInterface.php index 3be900400f305ed076761bfab80a498dd7637d24..4ae7a9100508b4dadbaad4713f342061c7c93e93 100644 --- a/app/code/Magento/Quote/Api/Data/PaymentMethodInterface.php +++ b/app/code/Magento/Quote/Api/Data/PaymentMethodInterface.php @@ -20,4 +20,21 @@ interface PaymentMethodInterface extends \Magento\Framework\Api\ExtensibleDataIn * @return string */ public function getTitle(); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\PaymentMethodExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\PaymentMethodExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Quote\Api\Data\PaymentMethodExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php b/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php index 92a60cbb3ad1f70d1d80391f89d4b156e0df33f7..ccebbdaa679e0a002971379aa4d5b6206bbd88b0 100644 --- a/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php +++ b/app/code/Magento/Quote/Api/Data/ShippingMethodInterface.php @@ -147,4 +147,21 @@ interface ShippingMethodInterface extends \Magento\Framework\Api\ExtensibleDataI * @return $this */ public function setAvailable($available); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\ShippingMethodExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\ShippingMethodExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Quote\Api\Data\ShippingMethodExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Quote/Api/Data/TotalsInterface.php b/app/code/Magento/Quote/Api/Data/TotalsInterface.php index b3594a9209f6bb063537a6cda701ce4ad5cf09c4..76684c5a75e196a29cec604f56cd5d5ca5a5402e 100644 --- a/app/code/Magento/Quote/Api/Data/TotalsInterface.php +++ b/app/code/Magento/Quote/Api/Data/TotalsInterface.php @@ -402,4 +402,19 @@ interface TotalsInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setItems(array $items = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\TotalsExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\TotalsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\TotalsExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Quote/Api/Data/TotalsItemInterface.php b/app/code/Magento/Quote/Api/Data/TotalsItemInterface.php index a37c78802f8ae767b08cc4fb0c3e4ae00faffa94..21b895553a4daeb6438b6000cd117f7a112bdf88 100644 --- a/app/code/Magento/Quote/Api/Data/TotalsItemInterface.php +++ b/app/code/Magento/Quote/Api/Data/TotalsItemInterface.php @@ -332,4 +332,19 @@ interface TotalsItemInterface extends \Magento\Framework\Api\ExtensibleDataInter * @return $this */ public function setBaseRowTotalInclTax($baseRowTotalInclTax); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Quote\Api\Data\TotalsItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Quote/Model/Cart/Currency.php b/app/code/Magento/Quote/Model/Cart/Currency.php index 67e6e95b32a572717dfd6b8ff4f1ead6a06ba184..5f7b57a9508168e2b6f4ab136aa0c716fd30806c 100644 --- a/app/code/Magento/Quote/Model/Cart/Currency.php +++ b/app/code/Magento/Quote/Model/Cart/Currency.php @@ -162,4 +162,25 @@ class Currency extends \Magento\Framework\Model\AbstractExtensibleModel implemen { return $this->setData(self::KEY_BASE_TO_QUOTE_RATE, $baseToQuoteRate); } + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\CurrencyExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\CurrencyExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\CurrencyExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Model/Cart/ShippingMethod.php b/app/code/Magento/Quote/Model/Cart/ShippingMethod.php index da61bf9820df6263a6d079a7b30ec6a3644818ec..75cba2f03cad98c8b53e727e1f4c0e699dde4bdd 100644 --- a/app/code/Magento/Quote/Model/Cart/ShippingMethod.php +++ b/app/code/Magento/Quote/Model/Cart/ShippingMethod.php @@ -162,4 +162,26 @@ class ShippingMethod extends \Magento\Framework\Api\AbstractExtensibleObject imp { return $this->setData(self::KEY_AVAILABLE, $available); } + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\ShippingMethodExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\ShippingMethodExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Quote\Api\Data\ShippingMethodExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Model/Cart/Totals.php b/app/code/Magento/Quote/Model/Cart/Totals.php index a1c8969dc954b50b4efd34192860fa855ee839c7..4612824f9cebb05dc6c4dedbb00bd8827e4019a3 100644 --- a/app/code/Magento/Quote/Model/Cart/Totals.php +++ b/app/code/Magento/Quote/Model/Cart/Totals.php @@ -498,4 +498,25 @@ class Totals extends AbstractExtensibleModel implements TotalsInterface { return $this->setData(self::KEY_ITEMS, $items); } + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\TotalsExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\TotalsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\TotalsExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Model/Cart/Totals/Item.php b/app/code/Magento/Quote/Model/Cart/Totals/Item.php index 1cd39994d7c644a1277d83906765625c5fbfc79c..0cd716b5082d7ae9f7ef82f82806a2b894959dd3 100644 --- a/app/code/Magento/Quote/Model/Cart/Totals/Item.php +++ b/app/code/Magento/Quote/Model/Cart/Totals/Item.php @@ -350,4 +350,25 @@ class Item extends AbstractExtensibleObject implements TotalsItemInterface { return $this->setData(self::KEY_BASE_ROW_TOTAL_INCL_TAX, $baseRowTotalInclTax); } + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\TotalsItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\TotalsItemExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php index 22971a88af7530ee0c4c254d1a6d97b4d744b846..91cc54e548ff163128c24a00337041b43671e6ce 100644 --- a/app/code/Magento/Quote/Model/Quote.php +++ b/app/code/Magento/Quote/Model/Quote.php @@ -325,7 +325,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param QuoteValidator $quoteValidator * @param \Magento\Catalog\Helper\Product $catalogProduct @@ -363,7 +363,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Quote\Model\QuoteValidator $quoteValidator, \Magento\Catalog\Helper\Product $catalogProduct, @@ -428,7 +428,7 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -2525,4 +2525,25 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C { return \count($this->getAllShippingAddresses()) > 1; } + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\CartExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\CartExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\CartExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php index 69a06b6c03312beac1f1f57e27a49f98a25e0929..c57a8d0d5e8163661cdb1e240d60924801c3e5bb 100644 --- a/app/code/Magento/Quote/Model/Quote/Address.php +++ b/app/code/Magento/Quote/Model/Quote/Address.php @@ -8,7 +8,6 @@ namespace Magento\Quote\Model\Quote; use Magento\Customer\Api\AddressMetadataInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\RegionInterfaceFactory; -use Magento\Framework\Api\AttributeValueFactory; /** * Sales Quote address model @@ -228,14 +227,14 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Customer\Model\Address\Config $addressConfig * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param AddressMetadataInterface $addressMetadataService + * @param AddressMetadataInterface $metadataService * @param AddressInterfaceFactory $addressDataFactory * @param RegionInterfaceFactory $regionDataFactory * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper @@ -260,14 +259,14 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Directory\Helper\Data $directoryData, \Magento\Eav\Model\Config $eavConfig, \Magento\Customer\Model\Address\Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - AddressMetadataInterface $addressMetadataService, + AddressMetadataInterface $metadataService, AddressInterfaceFactory $addressDataFactory, RegionInterfaceFactory $regionDataFactory, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, @@ -305,14 +304,14 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $directoryData, $eavConfig, $addressConfig, $regionFactory, $countryFactory, - $addressMetadataService, + $metadataService, $addressDataFactory, $regionDataFactory, $dataObjectHelper, @@ -513,7 +512,11 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements $customerAddressData = array_merge($customerAddressData, $customerAddressDataWithRegion); $addressDataObject = $this->addressDataFactory->create(); - $this->dataObjectHelper->populateWithArray($addressDataObject, $customerAddressData); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $customerAddressData, + '\Magento\Customer\Api\Data\AddressInterface' + ); return $addressDataObject; } @@ -1607,4 +1610,25 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements return $this->setData(self::KEY_REGION_CODE, $regionCode); } //@codeCoverageIgnoreEnd + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\AddressExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\AddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\AddressExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Model/Quote/Item.php b/app/code/Magento/Quote/Model/Quote/Item.php index 8f48eadab4877255c12fe54372edda53fed1947e..8dab6a6d2bf42f326b6397b3e239e943003954a0 100644 --- a/app/code/Magento/Quote/Model/Quote/Item.php +++ b/app/code/Magento/Quote/Model/Quote/Item.php @@ -9,7 +9,7 @@ namespace Magento\Quote\Model\Quote; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Api\MetadataServiceInterface; +use Magento\Framework\Api\ExtensionAttributesFactory; /** * Sales Quote Item Model @@ -181,7 +181,7 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param MetadataServiceInterface $metadataService + * @param ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency @@ -199,7 +199,7 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - MetadataServiceInterface $metadataService, + ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, @@ -220,7 +220,7 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $productRepository, $priceCurrency, @@ -1002,4 +1002,25 @@ class Item extends \Magento\Quote\Model\Quote\Item\AbstractItem implements \Mage return $this->setData(self::KEY_QUOTE_ID, $quoteId); } //@codeCoverageIgnoreEnd + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\CartItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\CartItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\CartItemExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php b/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php index 5a689e03d994a9afb8185c9fe8b6ea5a5c5034bf..8542ee1e6abb22406a447ba1386c372fc564a7db 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php +++ b/app/code/Magento/Quote/Model/Quote/Item/AbstractItem.php @@ -83,7 +83,7 @@ abstract class AbstractItem extends \Magento\Framework\Model\AbstractExtensibleM /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency @@ -94,7 +94,7 @@ abstract class AbstractItem extends \Magento\Framework\Model\AbstractExtensibleM public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, @@ -105,7 +105,7 @@ abstract class AbstractItem extends \Magento\Framework\Model\AbstractExtensibleM parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, diff --git a/app/code/Magento/Quote/Model/Quote/Payment.php b/app/code/Magento/Quote/Model/Quote/Payment.php index f420bad2202e58d972379a4202203b1a3f210ac7..f071b845cbb1fe3509696882da93882829db3f2a 100644 --- a/app/code/Magento/Quote/Model/Quote/Payment.php +++ b/app/code/Magento/Quote/Model/Quote/Payment.php @@ -5,8 +5,6 @@ */ namespace Magento\Quote\Model\Quote; -use Magento\Framework\Api\AttributeValueFactory; - /** * Quote payment information * @@ -63,8 +61,8 @@ class Payment extends \Magento\Payment\Model\Info implements \Magento\Quote\Api\ /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory @@ -76,8 +74,8 @@ class Payment extends \Magento\Payment\Model\Info implements \Magento\Quote\Api\ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory, @@ -89,7 +87,7 @@ class Payment extends \Magento\Payment\Model\Info implements \Magento\Quote\Api\ parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $paymentData, $encryptor, @@ -414,4 +412,25 @@ class Payment extends \Magento\Payment\Model\Info implements \Magento\Quote\Api\ return $this->setData(self::KEY_ADDITIONAL_DATA, $additionalData); } //@codeCoverageIgnoreEnd + + /** + * {@inheritdoc} + * + * @return \Magento\Quote\Api\Data\PaymentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Quote\Api\Data\PaymentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Quote\Api\Data\PaymentExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php index 8349a6e8f19e669d1b664c1f627616934d3e9da2..b68aeb602acb6cfd7d7d8af9cf45b60595dcd6c6 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Payment/ToOrderPaymentTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Quote\Test\Unit\Model\Quote\Payment; use Magento\Payment\Model\Method\Substitution; @@ -79,7 +81,7 @@ class ToOrderPaymentTest extends \PHPUnit_Framework_TestCase $data = ['some_id' => 1]; $paymentMethodTitle = 'TestTitle'; $additionalInfo = ['token' => 'TOKEN-123']; - + $this->paymentMock->expects($this->once())->method('getMethodInstance')->willReturn($methodInterface); $methodInterface->expects($this->once())->method('getTitle')->willReturn($paymentMethodTitle); $this->objectCopyMock->expects($this->once())->method('getDataFromFieldset')->with( diff --git a/app/code/Magento/Quote/etc/webapi.xml b/app/code/Magento/Quote/etc/webapi.xml index e1502c718e95058cd007262ba45d5339598673a4..412dab6361b1f7ef5e24168ebcb9b1b980a32c48 100644 --- a/app/code/Magento/Quote/etc/webapi.xml +++ b/app/code/Magento/Quote/etc/webapi.xml @@ -13,7 +13,7 @@ <resource ref="anonymous" /> </resources> </route> - <route url="/V1/carts" method="PUT"> + <route url="/V1/carts" method="GET"> <service class="Magento\Quote\Api\CartRepositoryInterface" method="getList"/> <resources> <resource ref="anonymous" /> diff --git a/app/code/Magento/Reports/etc/config.xml b/app/code/Magento/Reports/etc/config.xml index c9147001358680ef25a77c435a07519271a7cf79..d17146e739d84bf0c22e62bfc25178beec63eac4 100644 --- a/app/code/Magento/Reports/etc/config.xml +++ b/app/code/Magento/Reports/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <catalog> <recently_products> diff --git a/app/code/Magento/Review/Block/Customer/ListCustomer.php b/app/code/Magento/Review/Block/Customer/ListCustomer.php index 30a856c8384f419fb2e11d46bbdf888c7c3940ac..eee22e93bf790cb6b5bc5fd23e44861eb89ae8b5 100644 --- a/app/code/Magento/Review/Block/Customer/ListCustomer.php +++ b/app/code/Magento/Review/Block/Customer/ListCustomer.php @@ -62,31 +62,7 @@ class ListCustomer extends \Magento\Customer\Block\Account\Dashboard $data ); $this->currentCustomer = $currentCustomer; - } - - /** - * Initialize review collection - * - * @return $this - */ - protected function _initCollection() - { - $this->_collection = $this->_collectionFactory->create(); - $this->_collection - ->addStoreFilter($this->_storeManager->getStore()->getId()) - ->addCustomerFilter($this->currentCustomer->getCustomerId()) - ->setDateOrder(); - return $this; - } - - /** - * Gets collection items count - * - * @return int - */ - public function count() - { - return $this->_getCollection()->getSize(); + $this->_isScopePrivate = true; } /** @@ -106,40 +82,39 @@ class ListCustomer extends \Magento\Customer\Block\Account\Dashboard */ protected function _prepareLayout() { - $toolbar = $this->getLayout()->createBlock( - 'Magento\Theme\Block\Html\Pager', - 'customer_review_list.toolbar' - )->setCollection( - $this->getCollection() - ); - - $this->setChild('toolbar', $toolbar); + if ($this->getReviews()) { + $toolbar = $this->getLayout()->createBlock( + 'Magento\Theme\Block\Html\Pager', + 'customer_review_list.toolbar' + )->setCollection( + $this->getReviews() + ); + + $this->setChild('toolbar', $toolbar); + } return parent::_prepareLayout(); } /** - * Get collection + * Get reviews * - * @return \Magento\Review\Model\Resource\Review\Product\Collection + * @return bool|\Magento\Review\Model\Resource\Review\Product\Collection */ - protected function _getCollection() + public function getReviews() { + if (!($customerId = $this->currentCustomer->getCustomerId())) { + return false; + } if (!$this->_collection) { - $this->_initCollection(); + $this->_collection = $this->_collectionFactory->create(); + $this->_collection + ->addStoreFilter($this->_storeManager->getStore()->getId()) + ->addCustomerFilter($customerId) + ->setDateOrder(); } return $this->_collection; } - /** - * Get collection - * - * @return \Magento\Review\Model\Resource\Review\Product\Collection - */ - public function getCollection() - { - return $this->_getCollection(); - } - /** * Get review link * @@ -178,7 +153,10 @@ class ListCustomer extends \Magento\Customer\Block\Account\Dashboard */ protected function _beforeToHtml() { - $this->_getCollection()->load()->addReviewSummary(); + $reviews = $this->getReviews(); + if ($reviews) { + $reviews->load()->addReviewSummary(); + } return parent::_beforeToHtml(); } } diff --git a/app/code/Magento/Review/Block/Customer/Recent.php b/app/code/Magento/Review/Block/Customer/Recent.php index bbb8cf71cb44bb7af39c2ca26cb7d8984c1a20ba..7cd61cd717e8e489ea25a4cb2c152b36bf99b659 100644 --- a/app/code/Magento/Review/Block/Customer/Recent.php +++ b/app/code/Magento/Review/Block/Customer/Recent.php @@ -53,6 +53,7 @@ class Recent extends \Magento\Framework\View\Element\Template $this->_collectionFactory = $collectionFactory; parent::__construct($context, $data); $this->currentCustomer = $currentCustomer; + $this->_isScopePrivate = true; } /** @@ -74,54 +75,28 @@ class Recent extends \Magento\Framework\View\Element\Template } /** - * Initialize review collection - * @return $this - */ - protected function _initCollection() - { - $this->_collection = $this->_collectionFactory->create(); - $this->_collection - ->addStoreFilter($this->_storeManager->getStore()->getId()) - ->addCustomerFilter($this->currentCustomer->getCustomerId()) - ->setDateOrder() - ->setPageSize(5) - ->load() - ->addReviewSummary(); - return $this; - } - - /** - * Get number of reviews + * Return collection of reviews * - * @return int + * @return array|\Magento\Review\Model\Resource\Review\Product\Collection */ - public function count() - { - return $this->_getCollection()->getSize(); - } - - /** - * Initialize and return collection of reviews - * @return Collection - */ - protected function _getCollection() + public function getReviews() { + if (!($customerId = $this->currentCustomer->getCustomerId())) { + return []; + } if (!$this->_collection) { - $this->_initCollection(); + $this->_collection = $this->_collectionFactory->create(); + $this->_collection + ->addStoreFilter($this->_storeManager->getStore()->getId()) + ->addCustomerFilter($customerId) + ->setDateOrder() + ->setPageSize(5) + ->load() + ->addReviewSummary(); } return $this->_collection; } - /** - * Return collection of reviews - * - * @return Collection - */ - public function getCollection() - { - return $this->_getCollection(); - } - /** * Return review customer view url * diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php index 7ca1541ba9842f61f3454f6a4a1babc4a46cf5db..3bab2ed7c7c7957fb68224a912a77e4a8a748022 100644 --- a/app/code/Magento/Review/Block/Customer/View.php +++ b/app/code/Magento/Review/Block/Customer/View.php @@ -79,11 +79,11 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $this->_voteFactory = $voteFactory; $this->_ratingFactory = $ratingFactory; $this->currentCustomer = $currentCustomer; - parent::__construct( $context, $data ); + $this->_isScopePrivate = true; } /** @@ -199,16 +199,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct return $this->formatDate($date, \IntlDateFormatter::LONG); } - /** - * Check whether current customer is review owner - * - * @return bool - */ - public function isReviewOwner() - { - return ($this->getReviewData()->getCustomerId() == $this->currentCustomer->getCustomerId()); - } - /** * Get product reviews summary * @@ -227,4 +217,12 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct } return parent::getReviewsSummaryHtml($product, $templateType, $displayIfNoReviews); } + + /** + * @return string + */ + protected function _toHtml() + { + return $this->currentCustomer->getCustomerId() ? parent::_toHtml() : ''; + } } diff --git a/app/code/Magento/Review/Block/Form.php b/app/code/Magento/Review/Block/Form.php index 88429e9c1195415d153f9b0ad4e7b0a9fe46bb07..9682f444c4100126155f6daa0ecde88b656ce156 100644 --- a/app/code/Magento/Review/Block/Form.php +++ b/app/code/Magento/Review/Block/Form.php @@ -112,6 +112,7 @@ class Form extends \Magento\Framework\View\Element\Template $this->httpContext = $httpContext; $this->customerUrl = $customerUrl; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Review/Controller/Customer/View.php b/app/code/Magento/Review/Controller/Customer/View.php index 8470249f465e4f6501a7eb46ab588a65fee56a90..d1ea95e7afc90d83b7b9d44fd020297f57488e1d 100644 --- a/app/code/Magento/Review/Controller/Customer/View.php +++ b/app/code/Magento/Review/Controller/Customer/View.php @@ -8,6 +8,22 @@ namespace Magento\Review\Controller\Customer; class View extends \Magento\Review\Controller\Customer { + /** @var \Magento\Review\Model\ReviewFactory */ + protected $reviewFactory; + + /** + * @param \Magento\Framework\App\Action\Context $context + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Review\Model\ReviewFactory $reviewFactory + */ + public function __construct( + \Magento\Framework\App\Action\Context $context, + \Magento\Customer\Model\Session $customerSession, + \Magento\Review\Model\ReviewFactory $reviewFactory + ) { + parent::__construct($context, $customerSession); + $this->reviewFactory = $reviewFactory; + } /** * Render review details * @@ -15,6 +31,10 @@ class View extends \Magento\Review\Controller\Customer */ public function execute() { + $review = $this->reviewFactory->create()->load($this->getRequest()->getParam('id')); + if ($review->getCustomerId() != $this->_customerSession->getCustomerId()) { + return $this->_forward('noroute'); + } $this->_view->loadLayout(); if ($navigationBlock = $this->_view->getLayout()->getBlock('customer_account_navigation')) { $navigationBlock->setActive('review/customer'); diff --git a/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php b/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php index f3d2edd7e4095750ec79a998ef37c214f9dfc97c..b04e90e9cc7c194bb55058040fb2fb5684fc018d 100644 --- a/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php +++ b/app/code/Magento/Review/Test/Unit/Block/Customer/RecentTest.php @@ -135,6 +135,6 @@ class RecentTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->collection) ); - $this->assertSame($this->collection, $this->object->getCollection()); + $this->assertSame($this->collection, $this->object->getReviews()); } } diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json index 8f961213f7b34a0da431534a402c1b818d09a957..3ac2d8c5deab3948d3df18d6cea4946bdac565c4 100644 --- a/app/code/Magento/Review/composer.json +++ b/app/code/Magento/Review/composer.json @@ -15,8 +15,7 @@ "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-cookie": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11" + "magento/module-cookie": "0.42.0-beta11" }, "type": "magento2-module", "version": "0.42.0-beta11", diff --git a/app/code/Magento/Review/etc/config.xml b/app/code/Magento/Review/etc/config.xml index 0dc643e9ea43169759e13fcc12adee5f6da4de9a..1e46875b6f3d5b5d7039771ee813f121bacbc029 100644 --- a/app/code/Magento/Review/etc/config.xml +++ b/app/code/Magento/Review/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <catalog> <review> diff --git a/app/code/Magento/Review/etc/frontend/page_types.xml b/app/code/Magento/Review/etc/frontend/page_types.xml index 113b431de418f9aeb97c2b31649fcd7b14b376b1..63fc47b5e2400951e22f07e860cd19cabb7dc541 100644 --- a/app/code/Magento/Review/etc/frontend/page_types.xml +++ b/app/code/Magento/Review/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="review_customer_index" label="Customer My Account Product Reviews"/> <type id="review_customer_view" label="Customer My Account Review Details"/> <type id="review_product_list" label="Catalog Product Reviews List"/> diff --git a/app/code/Magento/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index ee43b6223153ea479b1e96ffd2b62e218223779c..226eb11213df86f11563660935e6075c5767608c 100644 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -9,7 +9,6 @@ <module name="Magento_Review" setup_version="2.0.0"> <sequence> <module name="Magento_Catalog"/> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml b/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml index 799a455f7e0f463ec93837c756085fbd45cfb0f8..7434c634ab44c53c0c10f2180e82d42031f0b390 100644 --- a/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml +++ b/app/code/Magento/Review/view/frontend/layout/customer_account_index.xml @@ -8,7 +8,7 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> - <block class="Magento\Review\Block\Customer\Recent" name="customer_account_dashboard_info1" template="customer/recent.phtml" after="customer_account_dashboard_address" cacheable="false"/> + <block class="Magento\Review\Block\Customer\Recent" name="customer_account_dashboard_info1" template="customer/recent.phtml" after="customer_account_dashboard_address"/> </referenceContainer> </body> </page> 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 01a6340b9f2bc125783abc69f20482a0abae4b59..23bfd524f3265ceaccef483e8a9e7465895523cb 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 @@ -9,7 +9,7 @@ <update handle="customer_account"/> <body> <referenceContainer name="content"> - <block class="Magento\Review\Block\Customer\ListCustomer" name="review_customer_list" template="customer/list.phtml" cacheable="false"/> + <block class="Magento\Review\Block\Customer\ListCustomer" name="review_customer_list" template="customer/list.phtml"/> </referenceContainer> </body> </page> 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 43e7ba2afa619b3219ee10e1a3d447dd0259ee13..5895da97549768a18e46377139534f4c378436c6 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 @@ -9,7 +9,7 @@ <update handle="customer_account"/> <body> <referenceContainer name="content"> - <block class="Magento\Review\Block\Customer\View" name="customers_review" cacheable="false"/> + <block class="Magento\Review\Block\Customer\View" name="customers_review"/> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Review/view/frontend/templates/customer/list.phtml b/app/code/Magento/Review/view/frontend/templates/customer/list.phtml index 4b28025a528c3a417e8a9636f7c33963e3d5eb78..e90990095151a90e6277319328689994401f1534 100644 --- a/app/code/Magento/Review/view/frontend/templates/customer/list.phtml +++ b/app/code/Magento/Review/view/frontend/templates/customer/list.phtml @@ -5,9 +5,9 @@ */ // @codingStandardsIgnoreFile - +/** @var \Magento\Review\Block\Customer\ListCustomer $block */ ?> -<?php if ($block->getCollection() && $block->count()): ?> +<?php if ($block->getReviews() && count($block->getReviews())): ?> <div class="table-wrapper reviews"> <table class="data table table-reviews" id="my-reviews-table"> <caption class="table-caption"><?php echo __('Product Reviews') ?></caption> @@ -21,7 +21,7 @@ </tr> </thead> <tbody> - <?php foreach ($block->getCollection() as $_review): ?> + <?php foreach ($block->getReviews() as $_review): ?> <tr> <td data-th="<?php echo $block->escapeHtml(__('Created')) ?>" class="col date"><?php echo $block->dateFormat($_review->getReviewCreatedAt()); ?></td> <td data-th="<?php echo $block->escapeHtml(__('Product Name')) ?>" class="col item"> diff --git a/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml b/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml index 84a83bedefb087cc0582deebf44d6ea54e00d00b..6bb7aa429fcef85f443be27e2634faaded6e10f8 100644 --- a/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml +++ b/app/code/Magento/Review/view/frontend/templates/customer/recent.phtml @@ -12,7 +12,7 @@ /** @var $block \Magento\Review\Block\Customer\Recent */ ?> -<?php if ($block->getCollection() && $block->count()): ?> +<?php if ($block->getReviews() && count($block->getReviews())): ?> <div class="block block-reviews-dashboard"> <div class="block-title"> <strong><?php echo __('My Recent Reviews') ?></strong> @@ -20,7 +20,7 @@ </div> <div class="block-content"> <ol class="items"> - <?php foreach ($block->getCollection() as $_review): ?> + <?php foreach ($block->getReviews() as $_review): ?> <li class="item"> <strong class="product-name"><a href="<?php echo $block->getReviewUrl($_review->getReviewId()) ?>"><?php echo $block->escapeHtml($_review->getName()) ?></a></strong> <?php if ($_review->getSum()): ?> diff --git a/app/code/Magento/Review/view/frontend/templates/customer/view.phtml b/app/code/Magento/Review/view/frontend/templates/customer/view.phtml index 34ab7ba21d39baffbcdf091d9127fb2cefb0e8d7..0a260e7c57a3fbe4398747fb6432f7518bf0dbdc 100644 --- a/app/code/Magento/Review/view/frontend/templates/customer/view.phtml +++ b/app/code/Magento/Review/view/frontend/templates/customer/view.phtml @@ -29,7 +29,7 @@ <div class="review-details"> <?php if ($block->getRating() && $block->getRating()->getSize()): ?> <div class="title"> - <strong><?php echo($block->isReviewOwner()) ? __('Your Review') : __('Review'); ?></strong> + <strong><?php echo __('Your Review'); ?></strong> </div> <div class="customer-review-rating"> <?php foreach ($block->getRating() as $_rating): ?> diff --git a/app/code/Magento/Rss/etc/frontend/page_types.xml b/app/code/Magento/Rss/etc/frontend/page_types.xml index b252b8816bb399134cb281360e6e1927cfc09cb2..f834bd2faf9f9ccd1fa13abd01929bccde29db45 100644 --- a/app/code/Magento/Rss/etc/frontend/page_types.xml +++ b/app/code/Magento/Rss/etc/frontend/page_types.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="rss_index_index" label="RSS Feeds List"/> </page_types> diff --git a/app/code/Magento/Rule/etc/module.xml b/app/code/Magento/Rule/etc/module.xml index b1ee185e3ec299014f691f1cb80ea6f8220fc61f..3a3987c2fb25336a2a7d1e174c36bfd051e7f9ce 100644 --- a/app/code/Magento/Rule/etc/module.xml +++ b/app/code/Magento/Rule/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Rule" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoCommentInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoCommentInterface.php index 0e0e7160582e7cc10aa401a35b4891bb22fa998a..28afae3c0f9528343770c22dfe283b82324a7c5a 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoCommentInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoCommentInterface.php @@ -64,6 +64,14 @@ interface CreditmemoCommentInterface extends \Magento\Framework\Api\ExtensibleDa */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the is-customer-notified flag value for the credit memo. * @@ -116,4 +124,21 @@ interface CreditmemoCommentInterface extends \Magento\Framework\Api\ExtensibleDa * @return $this */ public function setComment($comment); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\CreditmemoCommentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\CreditmemoCommentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\CreditmemoCommentExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php index 962865788bf5ee8f256011624f9a0e30f28221ae..71ad928a2a8b87fa0e0bba5180529a2b18ce896a 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php @@ -21,4 +21,12 @@ interface CreditmemoCommentSearchResultInterface extends \Magento\Framework\Api\ * @return \Magento\Sales\Api\Data\CreditmemoCommentInterface[] Array of collection items. */ public function getItems(); + + /** + * Sets collection items. + * + * @param \Magento\Sales\Api\Data\CreditmemoCommentInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php index 8c0e875ead18eda66304c5ec6af3a65f73c9b998..205d5c37b3f1033132c9679a240e036223a2e5e8 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoInterface.php @@ -256,6 +256,14 @@ interface CreditmemoInterface extends \Magento\Framework\Api\ExtensibleDataInter */ public function getBaseAdjustmentNegative(); + /** + * Sets the credit memo negative base adjustment. + * + * @param float $baseAdjustmentNegative + * @return $this + */ + public function setBaseAdjustmentNegative($baseAdjustmentNegative); + /** * Gets the credit memo positive base adjustment. * @@ -263,6 +271,14 @@ interface CreditmemoInterface extends \Magento\Framework\Api\ExtensibleDataInter */ public function getBaseAdjustmentPositive(); + /** + * Sets the credit memo positive base adjustment. + * + * @param float $baseAdjustmentPositive + * @return $this + */ + public function setBaseAdjustmentPositive($baseAdjustmentPositive); + /** * Gets the credit memo base currency code. * @@ -401,6 +417,15 @@ interface CreditmemoInterface extends \Magento\Framework\Api\ExtensibleDataInter * @return int Credit memo ID. */ public function getEntityId(); + + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the credit memo global currency code. * @@ -547,6 +572,14 @@ interface CreditmemoInterface extends \Magento\Framework\Api\ExtensibleDataInter */ public function getTransactionId(); + /** + * Sets the credit memo transaction ID. + * + * @param string $transactionId + * @return $this + */ + public function setTransactionId($transactionId); + /** * Gets the credit memo updated-at timestamp. * @@ -927,4 +960,19 @@ interface CreditmemoInterface extends \Magento\Framework\Api\ExtensibleDataInter * @return $this */ public function setDiscountDescription($description); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\CreditmemoExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\CreditmemoExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\CreditmemoExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoItemInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoItemInterface.php index 41eace4abdad8299142f514a4202fc74339efa4d..f93eedf1cff1f281cdc2ca9cbff68719cc67f6bb 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoItemInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoItemInterface.php @@ -263,6 +263,14 @@ interface CreditmemoItemInterface extends \Magento\Framework\Api\ExtensibleDataI */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the hidden tax amount for a credit memo item. * @@ -637,4 +645,21 @@ interface CreditmemoItemInterface extends \Magento\Framework\Api\ExtensibleDataI * @return $this */ public function setWeeeTaxAppliedRowAmount($amount); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\CreditmemoItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\CreditmemoItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\CreditmemoItemExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php index b9edf60f8f17c2958c737a8878678059679da448..5379dd74e78be5eaeff7e00c268327bafadf22a0 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php @@ -21,4 +21,12 @@ interface CreditmemoItemSearchResultInterface extends \Magento\Framework\Api\Sea * @return \Magento\Sales\Api\Data\CreditmemoItemInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\CreditmemoItemInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php index adc3e1131be9edd9cf801eb1746d048abb8c5929..2e3456b6b11c30e83e38fb86a26db6c223948b15 100644 --- a/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php @@ -20,4 +20,12 @@ interface CreditmemoSearchResultInterface extends \Magento\Framework\Api\SearchR * @return \Magento\Sales\Api\Data\CreditmemoInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\CreditmemoInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php index ddeff7a15307a6f4b19476a89c433f4fe5c73080..10c86a870231cd4cd0c24a165c1cc5cf022bcdaf 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php @@ -62,6 +62,14 @@ interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataI */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the is-customer-notified flag value for the invoice. * @@ -114,4 +122,21 @@ interface InvoiceCommentInterface extends \Magento\Framework\Api\ExtensibleDataI * @return $this */ public function setComment($comment); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\InvoiceCommentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\InvoiceCommentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\InvoiceCommentExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php index fc95adf84d6ed5054b372bca22ab136d16bd5719..4ba898bfedc012e4bfae657a1c15337148431012 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php @@ -19,4 +19,12 @@ interface InvoiceCommentSearchResultInterface extends \Magento\Framework\Api\Sea * @return \Magento\Sales\Api\Data\InvoiceCommentInterface[] Array of collection items. */ public function getItems(); + + /** + * Sets collection items. + * + * @param \Magento\Sales\Api\Data\InvoiceCommentInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceInterface.php index 736c490639094b4ef4b94a948022e743039e4446..e17decc98e0bbd364313f43a2d7373cbfd7990cc 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceInterface.php @@ -347,6 +347,14 @@ interface InvoiceInterface extends \Magento\Framework\Api\ExtensibleDataInterfac */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the global currency code for the invoice. * @@ -501,6 +509,14 @@ interface InvoiceInterface extends \Magento\Framework\Api\ExtensibleDataInterfac */ public function getTransactionId(); + /** + * Sets the transaction ID for the invoice. + * + * @param string $transactionId + * @return $this + */ + public function setTransactionId($transactionId); + /** * Gets the updated-at timestamp for the invoice. * @@ -865,4 +881,19 @@ interface InvoiceInterface extends \Magento\Framework\Api\ExtensibleDataInterfac * @return $this */ public function setDiscountDescription($description); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\InvoiceExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\InvoiceExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\InvoiceExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php index 68f3628b4a36453c6d4daca17319caa8f5b53066..6dc2d85022e727245aaa71475e4355f2ef05060c 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceItemInterface.php @@ -196,6 +196,14 @@ interface InvoiceItemInterface extends \Magento\Framework\Api\ExtensibleDataInte */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the hidden tax amount for the invoice item. * @@ -463,4 +471,19 @@ interface InvoiceItemInterface extends \Magento\Framework\Api\ExtensibleDataInte * @return $this */ public function setBaseHiddenTaxAmount($amount); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\InvoiceItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\InvoiceItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\InvoiceItemExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php index 904f89fb8b362e8edbd2cd563bf888c0e159f03d..6472290a10f7b98384862cdbda2c8738254b501b 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php @@ -18,4 +18,12 @@ interface InvoiceItemSearchResultInterface extends \Magento\Framework\Api\Search * @return \Magento\Sales\Api\Data\InvoiceItemInterface[] Array of collection items. */ public function getItems(); + + /** + * Sets collection items. + * + * @param \Magento\Sales\Api\Data\InvoiceItemInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php index 8421fff2884ca4de3e3f551338107fabb3111572..01fcf9d051d7fbba114abd6fe7d7b54a6046af35 100644 --- a/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php @@ -18,4 +18,12 @@ interface InvoiceSearchResultInterface extends \Magento\Framework\Api\SearchResu * @return \Magento\Sales\Api\Data\InvoiceInterface[] Array of collection items. */ public function getItems(); + + /** + * Sets collection items. + * + * @param \Magento\Sales\Api\Data\InvoiceInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/OrderAddressInterface.php b/app/code/Magento/Sales/Api/Data/OrderAddressInterface.php index 39c71fe74410db0e6e874b97d76630888ef5ee48..9e9e53f1727a00ba597fae6a2e4402c943b717c0 100644 --- a/app/code/Magento/Sales/Api/Data/OrderAddressInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderAddressInterface.php @@ -175,6 +175,14 @@ interface OrderAddressInterface extends \Magento\Framework\Api\ExtensibleDataInt */ public function getEntityId(); + /** + * Sets the ID for the order address. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the fax number for the order address. * @@ -500,4 +508,19 @@ interface OrderAddressInterface extends \Magento\Framework\Api\ExtensibleDataInt * @return $this */ public function setVatRequestSuccess($vatRequestSuccess); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\OrderAddressExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\OrderAddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderAddressExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php index 88cba66995a5f807521cca4dacd288466daa413d..1008f41c2095e83a52888548786aaf0a919fe13a 100644 --- a/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php @@ -20,4 +20,12 @@ interface OrderAddressSearchResultInterface extends \Magento\Framework\Api\Searc * @return \Magento\Sales\Api\Data\OrderAddressInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\OrderAddressInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/OrderInterface.php b/app/code/Magento/Sales/Api/Data/OrderInterface.php index a2e0b7f5b2ce5574961c80988dda1d8d1b15be1e..7bd62fbe1c3228b2241690b981a7f0ab8c2f84eb 100644 --- a/app/code/Magento/Sales/Api/Data/OrderInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderInterface.php @@ -1068,6 +1068,14 @@ interface OrderInterface extends \Magento\Framework\Api\ExtensibleDataInterface */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the external customer ID for the order. * @@ -2664,4 +2672,19 @@ interface OrderInterface extends \Magento\Framework\Api\ExtensibleDataInterface * @return $this */ public function setBaseShippingInclTax($amount); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\OrderExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/OrderItemInterface.php b/app/code/Magento/Sales/Api/Data/OrderItemInterface.php index 286f79aefd34631c48fb7d1e07e77881e3cdd8cf..6e59b03a98370feb88a6d6522c9fb84560e12bf3 100644 --- a/app/code/Magento/Sales/Api/Data/OrderItemInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderItemInterface.php @@ -1797,4 +1797,19 @@ interface OrderItemInterface extends \Magento\Framework\Api\ExtensibleDataInterf * @return $this */ public function setBaseWeeeTaxRowDisposition($baseWeeeTaxRowDisposition); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\OrderItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php index de76ac119af8e751fcf455ded73cb98fb2b5057b..d380b316080c10f678e10c53db1ba75a2224169b 100644 --- a/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php @@ -20,4 +20,12 @@ interface OrderItemSearchResultInterface extends \Magento\Framework\Api\SearchRe * @return \Magento\Sales\Api\Data\OrderItemInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\OrderItemInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/OrderPaymentInterface.php b/app/code/Magento/Sales/Api/Data/OrderPaymentInterface.php index 9ea389c850ca297c57ee2ab1e58b0c9e589bf961..44fda2cdbcc1c5424b4d8518ae9917cefb3c1932 100644 --- a/app/code/Magento/Sales/Api/Data/OrderPaymentInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderPaymentInterface.php @@ -549,6 +549,14 @@ interface OrderPaymentInterface extends \Magento\Framework\Api\ExtensibleDataInt */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the last transaction ID for the order payment. * @@ -1027,4 +1035,19 @@ interface OrderPaymentInterface extends \Magento\Framework\Api\ExtensibleDataInt * @return $this */ public function setAddressStatus($addressStatus); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\OrderPaymentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\OrderPaymentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderPaymentExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php index 13999f243c23800f22f18d3da9b00b2f2216ea28..2e0d8d19cc8866cdb50287f5c6c3f4adf38be689 100644 --- a/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php @@ -20,4 +20,12 @@ interface OrderPaymentSearchResultInterface extends \Magento\Framework\Api\Searc * @return \Magento\Sales\Api\Data\OrderPaymentInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\OrderPaymentInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/OrderStatusHistoryInterface.php b/app/code/Magento/Sales/Api/Data/OrderStatusHistoryInterface.php index 5d88187dc4ebe1a964d3249da4279f768455750c..4ef7daf322d37f0ca1b26f0ab7501e7ad5a79fcf 100644 --- a/app/code/Magento/Sales/Api/Data/OrderStatusHistoryInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderStatusHistoryInterface.php @@ -71,6 +71,14 @@ interface OrderStatusHistoryInterface extends \Magento\Framework\Api\ExtensibleD */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the entity name for the order status history. * @@ -153,4 +161,21 @@ interface OrderStatusHistoryInterface extends \Magento\Framework\Api\ExtensibleD * @return $this */ public function setEntityName($entityName); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\OrderStatusHistoryExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\OrderStatusHistoryExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\OrderStatusHistoryExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php b/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php index aef58312b999db2e2aff4494dc4a744e539ad9e3..01b15f1bf39ab7585ce6fb772de30fc5f11a5bfa 100644 --- a/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php @@ -20,4 +20,12 @@ interface OrderStatusHistorySearchResultInterface extends \Magento\Framework\Api * @return \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php index 6b7e09789811e2dad13093642e0fffe0723fe769..213b7c2e5e4931bd9f9295aee3b537f817891a68 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php @@ -62,6 +62,14 @@ interface ShipmentCommentInterface extends \Magento\Framework\Api\ExtensibleData */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the is-customer-notified flag value for the shipment comment. * @@ -114,4 +122,21 @@ interface ShipmentCommentInterface extends \Magento\Framework\Api\ExtensibleData * @return $this */ public function setComment($comment); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentCommentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentCommentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentCommentExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php index 92be1196ff41458e1bd3ca85c2c2d5a94b60fbe8..6fa9ff5b0f5dbe8fb23d26f0ca928b130a168a1a 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php @@ -19,4 +19,12 @@ interface ShipmentCommentSearchResultInterface extends \Magento\Framework\Api\Se * @return \Magento\Sales\Api\Data\ShipmentCommentInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\ShipmentCommentInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentInterface.php index 4f4b3e4d637a7407281767366c8b437cc7aa6162..3af3b16ebf66154df3527aa22d298881cab5466e 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentInterface.php @@ -124,6 +124,14 @@ interface ShipmentInterface extends \Magento\Framework\Api\ExtensibleDataInterfa */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the increment ID for the shipment. * @@ -209,6 +217,14 @@ interface ShipmentInterface extends \Magento\Framework\Api\ExtensibleDataInterfa */ public function getItems(); + /** + * Sets the items for the shipment. + * + * @param \Magento\Sales\Api\Data\ShipmentItemInterface[] $items + * @return $this + */ + public function setItems($items); + /** * Gets the tracks for the shipment. * @@ -216,6 +232,14 @@ interface ShipmentInterface extends \Magento\Framework\Api\ExtensibleDataInterfa */ public function getTracks(); + /** + * Sets the tracks for the shipment. + * + * @param \Magento\Sales\Api\Data\ShipmentTrackInterface[] $tracks + * @return $this + */ + public function setTracks($tracks); + /** * Gets the comments for the shipment. * @@ -223,6 +247,14 @@ interface ShipmentInterface extends \Magento\Framework\Api\ExtensibleDataInterfa */ public function getComments(); + /** + * Sets the comments for the shipment. + * + * @param \Magento\Sales\Api\Data\ShipmentCommentInterface[] $comments + * @return $this + */ + public function setComments(array $comments = null); + /** * Sets the store ID for the shipment. * @@ -318,4 +350,19 @@ interface ShipmentInterface extends \Magento\Framework\Api\ExtensibleDataInterfa * @return $this */ public function setUpdatedAt($timestamp); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\ShipmentExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php index fe4d8b7bf8b9ea9a60064a6032fe394138ac9ded..ad75b14cde2a155b5e684da289997b1d488b324c 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentItemInterface.php @@ -86,6 +86,14 @@ interface ShipmentItemInterface extends \Magento\Framework\Api\ExtensibleDataInt */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the name for the shipment item. * @@ -236,4 +244,19 @@ interface ShipmentItemInterface extends \Magento\Framework\Api\ExtensibleDataInt * @return $this */ public function setSku($sku); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\ShipmentItemExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php index a0a9d4e012965df4d1e52115b8b63b67db02446c..f709fe623aa57a499825e509e813748f75f63c68 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php @@ -19,4 +19,12 @@ interface ShipmentItemSearchResultInterface extends \Magento\Framework\Api\Searc * @return \Magento\Sales\Api\Data\ShipmentItemInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\ShipmentItemInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentPackageInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentPackageInterface.php index 9172405a3f7d531a9da67966c552e6a8a00b3ba9..00b79d6f50e6d725fadb4a92e2ced0a456179cd0 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentPackageInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentPackageInterface.php @@ -13,4 +13,20 @@ namespace Magento\Sales\Api\Data; */ interface ShipmentPackageInterface extends \Magento\Framework\Api\ExtensibleDataInterface { + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentPackageExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentPackageExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentPackageExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php index e6efad7c0495076dc612274dd9ab22fbd3cff6c1..828de5d7be7b406fb7efe7900d2315645e2f6238 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php @@ -21,4 +21,12 @@ interface ShipmentSearchResultInterface extends SearchResultsInterface * @return \Magento\Sales\Api\Data\ShipmentInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\ShipmentInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php index c19abc6ed0d8263ddc4fb8308a0ff6a3a5bc045a..7ace1ead4114db6c8c81c9a3921d56f1e9195727 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentTrackInterface.php @@ -90,6 +90,14 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn */ public function getEntityId(); + /** + * Sets entity ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); + /** * Gets the order_id for the shipment package. * @@ -210,4 +218,21 @@ interface ShipmentTrackInterface extends \Magento\Framework\Api\ExtensibleDataIn * @return $this */ public function setCarrierCode($code); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\ShipmentTrackExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\ShipmentTrackExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentTrackExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php index fe70e4c91a5ca04c0d1c6ff3d9b7b66cf9b78b32..26187c86ce99d7d11b69db5a13ea245c8624434b 100644 --- a/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php @@ -20,4 +20,12 @@ interface ShipmentTrackSearchResultInterface extends \Magento\Framework\Api\Sear * @return \Magento\Sales\Api\Data\ShipmentTrackInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\ShipmentTrackInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Api/Data/TransactionInterface.php b/app/code/Magento/Sales/Api/Data/TransactionInterface.php index 1e350f1388372111181a71a1b276912925274d42..224d9765582f0e3381846f159814103e72111351 100644 --- a/app/code/Magento/Sales/Api/Data/TransactionInterface.php +++ b/app/code/Magento/Sales/Api/Data/TransactionInterface.php @@ -212,4 +212,19 @@ interface TransactionInterface extends \Magento\Framework\Api\ExtensibleDataInte * @throws \Magento\Framework\Exception\LocalizedException */ public function setAdditionalInformation($key, $value); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Sales\Api\Data\TransactionExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php b/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php index 6a7f7380ef3b0e60c85ec27d46454e3caa6f3930..414b5d05d27d0592b88c24b77d836c3242036e90 100644 --- a/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php +++ b/app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php @@ -18,4 +18,12 @@ interface TransactionSearchResultInterface extends \Magento\Framework\Api\Search * @return \Magento\Sales\Api\Data\TransactionInterface[] Array of collection items. */ public function getItems(); + + /** + * Set collection items. + * + * @param \Magento\Sales\Api\Data\TransactionInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Sales/Block/Guest/Link.php b/app/code/Magento/Sales/Block/Guest/Link.php index 225a0be5f159550ecae71b6e1322117ad7799c26..4e432ceff508910699f81b2cd4bf90ca9e2cf161 100644 --- a/app/code/Magento/Sales/Block/Guest/Link.php +++ b/app/code/Magento/Sales/Block/Guest/Link.php @@ -33,7 +33,6 @@ class Link extends \Magento\Framework\View\Element\Html\Link\Current ) { parent::__construct($context, $defaultPath, $data); $this->httpContext = $httpContext; - $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Block/Order/History.php b/app/code/Magento/Sales/Block/Order/History.php index 196382cbd7ee46f1f65cd6c8d27fbe112adb2993..adee793ade5d1ffff85a5db62af7121791627c57 100644 --- a/app/code/Magento/Sales/Block/Order/History.php +++ b/app/code/Magento/Sales/Block/Order/History.php @@ -30,6 +30,9 @@ class History extends \Magento\Framework\View\Element\Template */ protected $_orderConfig; + /** @var \Magento\Sales\Model\Resource\Order\Collection */ + protected $orders; + /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Sales\Model\Resource\Order\CollectionFactory $orderCollectionFactory @@ -57,39 +60,50 @@ class History extends \Magento\Framework\View\Element\Template protected function _construct() { parent::_construct(); - - $orders = $this->_orderCollectionFactory->create()->addFieldToSelect( - '*' - )->addFieldToFilter( - 'customer_id', - $this->_customerSession->getCustomerId() - )->addFieldToFilter( - 'status', - ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()] - )->setOrder( - 'created_at', - 'desc' - ); - - $this->setOrders($orders); $this->pageConfig->getTitle()->set(__('My Orders')); } + /** + * @return bool|\Magento\Sales\Model\Resource\Order\Collection + */ + public function getOrders() + { + if (!($customerId = $this->_customerSession->getCustomerId())) { + return false; + } + if (!$this->orders) { + $this->orders = $this->_orderCollectionFactory->create()->addFieldToSelect( + '*' + )->addFieldToFilter( + 'customer_id', + $customerId + )->addFieldToFilter( + 'status', + ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()] + )->setOrder( + 'created_at', + 'desc' + ); + } + return $this->orders; + } + /** * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); - - $pager = $this->getLayout()->createBlock( - 'Magento\Theme\Block\Html\Pager', - 'sales.order.history.pager' - )->setCollection( - $this->getOrders() - ); - $this->setChild('pager', $pager); - $this->getOrders()->load(); + if ($this->getOrders()) { + $pager = $this->getLayout()->createBlock( + 'Magento\Theme\Block\Html\Pager', + 'sales.order.history.pager' + )->setCollection( + $this->getOrders() + ); + $this->setChild('pager', $pager); + $this->getOrders()->load(); + } return $this; } @@ -107,7 +121,7 @@ class History extends \Magento\Framework\View\Element\Template */ public function getViewUrl($order) { - return $this->getUrl('*/*/view', ['order_id' => $order->getId()]); + return $this->getUrl('sales/order/view', ['order_id' => $order->getId()]); } /** @@ -116,7 +130,7 @@ class History extends \Magento\Framework\View\Element\Template */ public function getTrackUrl($order) { - return $this->getUrl('*/*/track', ['order_id' => $order->getId()]); + return $this->getUrl('sales/order/track', ['order_id' => $order->getId()]); } /** @@ -125,7 +139,7 @@ class History extends \Magento\Framework\View\Element\Template */ public function getReorderUrl($order) { - return $this->getUrl('*/*/reorder', ['order_id' => $order->getId()]); + return $this->getUrl('sales/order/reorder', ['order_id' => $order->getId()]); } /** diff --git a/app/code/Magento/Sales/Model/AbstractModel.php b/app/code/Magento/Sales/Model/AbstractModel.php index b87d43e79f47cb97ceedab4e14bdd9babb13e002..a506b7efd3b3b02c5683a5ea2bc87611422c7de0 100644 --- a/app/code/Magento/Sales/Model/AbstractModel.php +++ b/app/code/Magento/Sales/Model/AbstractModel.php @@ -27,7 +27,7 @@ abstract class AbstractModel extends AbstractExtensibleModel /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -38,7 +38,7 @@ abstract class AbstractModel extends AbstractExtensibleModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -49,7 +49,7 @@ abstract class AbstractModel extends AbstractExtensibleModel parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 5194db0369e315e2608b3ace3fc17e5d3c0a862f..4327c9d91d9a645a89e91f0fe20f3a47510c423e 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -1548,7 +1548,11 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode $data = $form->extractData($request); $data = $form->restoreData($data); $customer = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray($customer, $data); + $this->dataObjectHelper->populateWithArray( + $customer, + $data, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $this->getQuote()->updateCustomerData($customer); $data = []; @@ -1666,7 +1670,11 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode } } - $this->dataObjectHelper->populateWithArray($customer, $data); + $this->dataObjectHelper->populateWithArray( + $customer, + $data, + '\Magento\Customer\Api\Data\CustomerInterface' + ); return $customer; } diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index fa437025ad8487896f2a011d7d4248e45f8025ab..6a27ad12b323da64252cbdaf0ac2005f9cbd62f9 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -9,7 +9,7 @@ use Magento\Directory\Model\Currency; use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Pricing\PriceCurrencyInterface; -use Magento\Sales\Api\Data\OrderInterface as ApiOrderInterface; +use Magento\Sales\Api\Data\OrderInterface; use Magento\Sales\Api\Data\OrderStatusHistoryInterface; use Magento\Sales\Model\Order\Payment; use Magento\Sales\Model\Resource\Order\Address\Collection; @@ -50,7 +50,7 @@ use Magento\Sales\Model\Resource\Order\Status\History\Collection as HistoryColle * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Order extends AbstractModel implements EntityInterface, ApiOrderInterface +class Order extends AbstractModel implements EntityInterface, OrderInterface { const ENTITY = 'order'; @@ -260,7 +260,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -290,7 +290,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -338,7 +338,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -1944,13 +1944,13 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getItems() { - if ($this->getData(ApiOrderInterface::ITEMS) == null) { + if ($this->getData(OrderInterface::ITEMS) == null) { $this->setData( - ApiOrderInterface::ITEMS, + OrderInterface::ITEMS, $this->getItemsCollection()->getItems() ); } - return $this->getData(ApiOrderInterface::ITEMS); + return $this->getData(OrderInterface::ITEMS); } /** @@ -1958,7 +1958,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setItems($items) { - return $this->setData(ApiOrderInterface::ITEMS, $items); + return $this->setData(OrderInterface::ITEMS, $items); } /** @@ -1966,13 +1966,13 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getPayments() { - if ($this->getData(ApiOrderInterface::PAYMENTS) == null) { + if ($this->getData(OrderInterface::PAYMENTS) == null) { $this->setData( - ApiOrderInterface::PAYMENTS, + OrderInterface::PAYMENTS, $this->getPaymentsCollection()->getItems() ); } - return $this->getData(ApiOrderInterface::PAYMENTS); + return $this->getData(OrderInterface::PAYMENTS); } /** @@ -1980,7 +1980,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setPayments(array $payments = null) { - return $this->setData(ApiOrderInterface::PAYMENTS, $payments); + return $this->setData(OrderInterface::PAYMENTS, $payments); } /** @@ -1988,13 +1988,13 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getAddresses() { - if ($this->getData(ApiOrderInterface::ADDRESSES) == null) { + if ($this->getData(OrderInterface::ADDRESSES) == null) { $this->setData( - ApiOrderInterface::ADDRESSES, + OrderInterface::ADDRESSES, $this->getAddressesCollection()->getItems() ); } - return $this->getData(ApiOrderInterface::ADDRESSES); + return $this->getData(OrderInterface::ADDRESSES); } /** @@ -2002,7 +2002,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setAddresses(array $addresses = null) { - return $this->setData(ApiOrderInterface::ADDRESSES, $addresses); + return $this->setData(OrderInterface::ADDRESSES, $addresses); } /** @@ -2012,7 +2012,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getAdjustmentNegative() { - return $this->getData(ApiOrderInterface::ADJUSTMENT_NEGATIVE); + return $this->getData(OrderInterface::ADJUSTMENT_NEGATIVE); } /** @@ -2022,7 +2022,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getAdjustmentPositive() { - return $this->getData(ApiOrderInterface::ADJUSTMENT_POSITIVE); + return $this->getData(OrderInterface::ADJUSTMENT_POSITIVE); } /** @@ -2032,7 +2032,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getAppliedRuleIds() { - return $this->getData(ApiOrderInterface::APPLIED_RULE_IDS); + return $this->getData(OrderInterface::APPLIED_RULE_IDS); } /** @@ -2042,7 +2042,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseAdjustmentNegative() { - return $this->getData(ApiOrderInterface::BASE_ADJUSTMENT_NEGATIVE); + return $this->getData(OrderInterface::BASE_ADJUSTMENT_NEGATIVE); } /** @@ -2052,7 +2052,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseAdjustmentPositive() { - return $this->getData(ApiOrderInterface::BASE_ADJUSTMENT_POSITIVE); + return $this->getData(OrderInterface::BASE_ADJUSTMENT_POSITIVE); } /** @@ -2062,7 +2062,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseCurrencyCode() { - return $this->getData(ApiOrderInterface::BASE_CURRENCY_CODE); + return $this->getData(OrderInterface::BASE_CURRENCY_CODE); } /** @@ -2072,7 +2072,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseDiscountAmount() { - return $this->getData(ApiOrderInterface::BASE_DISCOUNT_AMOUNT); + return $this->getData(OrderInterface::BASE_DISCOUNT_AMOUNT); } /** @@ -2082,7 +2082,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseDiscountCanceled() { - return $this->getData(ApiOrderInterface::BASE_DISCOUNT_CANCELED); + return $this->getData(OrderInterface::BASE_DISCOUNT_CANCELED); } /** @@ -2092,7 +2092,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseDiscountInvoiced() { - return $this->getData(ApiOrderInterface::BASE_DISCOUNT_INVOICED); + return $this->getData(OrderInterface::BASE_DISCOUNT_INVOICED); } /** @@ -2102,7 +2102,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseDiscountRefunded() { - return $this->getData(ApiOrderInterface::BASE_DISCOUNT_REFUNDED); + return $this->getData(OrderInterface::BASE_DISCOUNT_REFUNDED); } /** @@ -2112,7 +2112,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseGrandTotal() { - return $this->getData(ApiOrderInterface::BASE_GRAND_TOTAL); + return $this->getData(OrderInterface::BASE_GRAND_TOTAL); } /** @@ -2122,7 +2122,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseHiddenTaxAmount() { - return $this->getData(ApiOrderInterface::BASE_HIDDEN_TAX_AMOUNT); + return $this->getData(OrderInterface::BASE_HIDDEN_TAX_AMOUNT); } /** @@ -2132,7 +2132,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseHiddenTaxInvoiced() { - return $this->getData(ApiOrderInterface::BASE_HIDDEN_TAX_INVOICED); + return $this->getData(OrderInterface::BASE_HIDDEN_TAX_INVOICED); } /** @@ -2142,7 +2142,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseHiddenTaxRefunded() { - return $this->getData(ApiOrderInterface::BASE_HIDDEN_TAX_REFUNDED); + return $this->getData(OrderInterface::BASE_HIDDEN_TAX_REFUNDED); } /** @@ -2152,7 +2152,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingAmount() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_AMOUNT); + return $this->getData(OrderInterface::BASE_SHIPPING_AMOUNT); } /** @@ -2162,7 +2162,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingCanceled() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_CANCELED); + return $this->getData(OrderInterface::BASE_SHIPPING_CANCELED); } /** @@ -2172,7 +2172,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingDiscountAmount() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_DISCOUNT_AMOUNT); + return $this->getData(OrderInterface::BASE_SHIPPING_DISCOUNT_AMOUNT); } /** @@ -2182,7 +2182,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingHiddenTaxAmnt() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_HIDDEN_TAX_AMNT); + return $this->getData(OrderInterface::BASE_SHIPPING_HIDDEN_TAX_AMNT); } /** @@ -2192,7 +2192,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingInclTax() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_INCL_TAX); + return $this->getData(OrderInterface::BASE_SHIPPING_INCL_TAX); } /** @@ -2202,7 +2202,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingInvoiced() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_INVOICED); + return $this->getData(OrderInterface::BASE_SHIPPING_INVOICED); } /** @@ -2212,7 +2212,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingRefunded() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_REFUNDED); + return $this->getData(OrderInterface::BASE_SHIPPING_REFUNDED); } /** @@ -2222,7 +2222,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingTaxAmount() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_TAX_AMOUNT); + return $this->getData(OrderInterface::BASE_SHIPPING_TAX_AMOUNT); } /** @@ -2232,7 +2232,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseShippingTaxRefunded() { - return $this->getData(ApiOrderInterface::BASE_SHIPPING_TAX_REFUNDED); + return $this->getData(OrderInterface::BASE_SHIPPING_TAX_REFUNDED); } /** @@ -2242,7 +2242,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseSubtotal() { - return $this->getData(ApiOrderInterface::BASE_SUBTOTAL); + return $this->getData(OrderInterface::BASE_SUBTOTAL); } /** @@ -2252,7 +2252,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseSubtotalCanceled() { - return $this->getData(ApiOrderInterface::BASE_SUBTOTAL_CANCELED); + return $this->getData(OrderInterface::BASE_SUBTOTAL_CANCELED); } /** @@ -2262,7 +2262,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseSubtotalInclTax() { - return $this->getData(ApiOrderInterface::BASE_SUBTOTAL_INCL_TAX); + return $this->getData(OrderInterface::BASE_SUBTOTAL_INCL_TAX); } /** @@ -2272,7 +2272,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseSubtotalInvoiced() { - return $this->getData(ApiOrderInterface::BASE_SUBTOTAL_INVOICED); + return $this->getData(OrderInterface::BASE_SUBTOTAL_INVOICED); } /** @@ -2282,7 +2282,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseSubtotalRefunded() { - return $this->getData(ApiOrderInterface::BASE_SUBTOTAL_REFUNDED); + return $this->getData(OrderInterface::BASE_SUBTOTAL_REFUNDED); } /** @@ -2292,7 +2292,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTaxAmount() { - return $this->getData(ApiOrderInterface::BASE_TAX_AMOUNT); + return $this->getData(OrderInterface::BASE_TAX_AMOUNT); } /** @@ -2302,7 +2302,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTaxCanceled() { - return $this->getData(ApiOrderInterface::BASE_TAX_CANCELED); + return $this->getData(OrderInterface::BASE_TAX_CANCELED); } /** @@ -2312,7 +2312,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTaxInvoiced() { - return $this->getData(ApiOrderInterface::BASE_TAX_INVOICED); + return $this->getData(OrderInterface::BASE_TAX_INVOICED); } /** @@ -2322,7 +2322,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTaxRefunded() { - return $this->getData(ApiOrderInterface::BASE_TAX_REFUNDED); + return $this->getData(OrderInterface::BASE_TAX_REFUNDED); } /** @@ -2332,7 +2332,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalCanceled() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_CANCELED); + return $this->getData(OrderInterface::BASE_TOTAL_CANCELED); } /** @@ -2342,7 +2342,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalInvoiced() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_INVOICED); + return $this->getData(OrderInterface::BASE_TOTAL_INVOICED); } /** @@ -2352,7 +2352,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalInvoicedCost() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_INVOICED_COST); + return $this->getData(OrderInterface::BASE_TOTAL_INVOICED_COST); } /** @@ -2362,7 +2362,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalOfflineRefunded() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_OFFLINE_REFUNDED); + return $this->getData(OrderInterface::BASE_TOTAL_OFFLINE_REFUNDED); } /** @@ -2372,7 +2372,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalOnlineRefunded() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_ONLINE_REFUNDED); + return $this->getData(OrderInterface::BASE_TOTAL_ONLINE_REFUNDED); } /** @@ -2382,7 +2382,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalPaid() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_PAID); + return $this->getData(OrderInterface::BASE_TOTAL_PAID); } /** @@ -2392,7 +2392,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalQtyOrdered() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_QTY_ORDERED); + return $this->getData(OrderInterface::BASE_TOTAL_QTY_ORDERED); } /** @@ -2402,7 +2402,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseTotalRefunded() { - return $this->getData(ApiOrderInterface::BASE_TOTAL_REFUNDED); + return $this->getData(OrderInterface::BASE_TOTAL_REFUNDED); } /** @@ -2412,7 +2412,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseToGlobalRate() { - return $this->getData(ApiOrderInterface::BASE_TO_GLOBAL_RATE); + return $this->getData(OrderInterface::BASE_TO_GLOBAL_RATE); } /** @@ -2422,7 +2422,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBaseToOrderRate() { - return $this->getData(ApiOrderInterface::BASE_TO_ORDER_RATE); + return $this->getData(OrderInterface::BASE_TO_ORDER_RATE); } /** @@ -2432,7 +2432,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getBillingAddressId() { - return $this->getData(ApiOrderInterface::BILLING_ADDRESS_ID); + return $this->getData(OrderInterface::BILLING_ADDRESS_ID); } /** @@ -2442,7 +2442,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCanShipPartially() { - return $this->getData(ApiOrderInterface::CAN_SHIP_PARTIALLY); + return $this->getData(OrderInterface::CAN_SHIP_PARTIALLY); } /** @@ -2452,7 +2452,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCanShipPartiallyItem() { - return $this->getData(ApiOrderInterface::CAN_SHIP_PARTIALLY_ITEM); + return $this->getData(OrderInterface::CAN_SHIP_PARTIALLY_ITEM); } /** @@ -2462,7 +2462,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCouponCode() { - return $this->getData(ApiOrderInterface::COUPON_CODE); + return $this->getData(OrderInterface::COUPON_CODE); } /** @@ -2472,7 +2472,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCreatedAt() { - return $this->getData(ApiOrderInterface::CREATED_AT); + return $this->getData(OrderInterface::CREATED_AT); } /** @@ -2482,7 +2482,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerDob() { - return $this->getData(ApiOrderInterface::CUSTOMER_DOB); + return $this->getData(OrderInterface::CUSTOMER_DOB); } /** @@ -2492,7 +2492,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerEmail() { - return $this->getData(ApiOrderInterface::CUSTOMER_EMAIL); + return $this->getData(OrderInterface::CUSTOMER_EMAIL); } /** @@ -2502,7 +2502,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerFirstname() { - return $this->getData(ApiOrderInterface::CUSTOMER_FIRSTNAME); + return $this->getData(OrderInterface::CUSTOMER_FIRSTNAME); } /** @@ -2512,7 +2512,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerGender() { - return $this->getData(ApiOrderInterface::CUSTOMER_GENDER); + return $this->getData(OrderInterface::CUSTOMER_GENDER); } /** @@ -2522,7 +2522,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerGroupId() { - return $this->getData(ApiOrderInterface::CUSTOMER_GROUP_ID); + return $this->getData(OrderInterface::CUSTOMER_GROUP_ID); } /** @@ -2532,7 +2532,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerId() { - return $this->getData(ApiOrderInterface::CUSTOMER_ID); + return $this->getData(OrderInterface::CUSTOMER_ID); } /** @@ -2542,7 +2542,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerIsGuest() { - return $this->getData(ApiOrderInterface::CUSTOMER_IS_GUEST); + return $this->getData(OrderInterface::CUSTOMER_IS_GUEST); } /** @@ -2552,7 +2552,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerLastname() { - return $this->getData(ApiOrderInterface::CUSTOMER_LASTNAME); + return $this->getData(OrderInterface::CUSTOMER_LASTNAME); } /** @@ -2562,7 +2562,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerMiddlename() { - return $this->getData(ApiOrderInterface::CUSTOMER_MIDDLENAME); + return $this->getData(OrderInterface::CUSTOMER_MIDDLENAME); } /** @@ -2572,7 +2572,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerNote() { - return $this->getData(ApiOrderInterface::CUSTOMER_NOTE); + return $this->getData(OrderInterface::CUSTOMER_NOTE); } /** @@ -2582,7 +2582,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerNoteNotify() { - return $this->getData(ApiOrderInterface::CUSTOMER_NOTE_NOTIFY); + return $this->getData(OrderInterface::CUSTOMER_NOTE_NOTIFY); } /** @@ -2592,7 +2592,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerPrefix() { - return $this->getData(ApiOrderInterface::CUSTOMER_PREFIX); + return $this->getData(OrderInterface::CUSTOMER_PREFIX); } /** @@ -2602,7 +2602,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerSuffix() { - return $this->getData(ApiOrderInterface::CUSTOMER_SUFFIX); + return $this->getData(OrderInterface::CUSTOMER_SUFFIX); } /** @@ -2612,7 +2612,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getCustomerTaxvat() { - return $this->getData(ApiOrderInterface::CUSTOMER_TAXVAT); + return $this->getData(OrderInterface::CUSTOMER_TAXVAT); } /** @@ -2622,7 +2622,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getDiscountAmount() { - return $this->getData(ApiOrderInterface::DISCOUNT_AMOUNT); + return $this->getData(OrderInterface::DISCOUNT_AMOUNT); } /** @@ -2632,7 +2632,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getDiscountCanceled() { - return $this->getData(ApiOrderInterface::DISCOUNT_CANCELED); + return $this->getData(OrderInterface::DISCOUNT_CANCELED); } /** @@ -2642,7 +2642,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getDiscountDescription() { - return $this->getData(ApiOrderInterface::DISCOUNT_DESCRIPTION); + return $this->getData(OrderInterface::DISCOUNT_DESCRIPTION); } /** @@ -2652,7 +2652,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getDiscountInvoiced() { - return $this->getData(ApiOrderInterface::DISCOUNT_INVOICED); + return $this->getData(OrderInterface::DISCOUNT_INVOICED); } /** @@ -2662,7 +2662,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getDiscountRefunded() { - return $this->getData(ApiOrderInterface::DISCOUNT_REFUNDED); + return $this->getData(OrderInterface::DISCOUNT_REFUNDED); } /** @@ -2672,7 +2672,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getEditIncrement() { - return $this->getData(ApiOrderInterface::EDIT_INCREMENT); + return $this->getData(OrderInterface::EDIT_INCREMENT); } /** @@ -2682,7 +2682,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getEmailSent() { - return $this->getData(ApiOrderInterface::EMAIL_SENT); + return $this->getData(OrderInterface::EMAIL_SENT); } /** @@ -2692,7 +2692,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getExtCustomerId() { - return $this->getData(ApiOrderInterface::EXT_CUSTOMER_ID); + return $this->getData(OrderInterface::EXT_CUSTOMER_ID); } /** @@ -2702,7 +2702,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getExtOrderId() { - return $this->getData(ApiOrderInterface::EXT_ORDER_ID); + return $this->getData(OrderInterface::EXT_ORDER_ID); } /** @@ -2712,7 +2712,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getForcedShipmentWithInvoice() { - return $this->getData(ApiOrderInterface::FORCED_SHIPMENT_WITH_INVOICE); + return $this->getData(OrderInterface::FORCED_SHIPMENT_WITH_INVOICE); } /** @@ -2722,7 +2722,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getGlobalCurrencyCode() { - return $this->getData(ApiOrderInterface::GLOBAL_CURRENCY_CODE); + return $this->getData(OrderInterface::GLOBAL_CURRENCY_CODE); } /** @@ -2732,7 +2732,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getGrandTotal() { - return $this->getData(ApiOrderInterface::GRAND_TOTAL); + return $this->getData(OrderInterface::GRAND_TOTAL); } /** @@ -2742,7 +2742,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getHiddenTaxAmount() { - return $this->getData(ApiOrderInterface::HIDDEN_TAX_AMOUNT); + return $this->getData(OrderInterface::HIDDEN_TAX_AMOUNT); } /** @@ -2752,7 +2752,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getHiddenTaxInvoiced() { - return $this->getData(ApiOrderInterface::HIDDEN_TAX_INVOICED); + return $this->getData(OrderInterface::HIDDEN_TAX_INVOICED); } /** @@ -2762,7 +2762,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getHiddenTaxRefunded() { - return $this->getData(ApiOrderInterface::HIDDEN_TAX_REFUNDED); + return $this->getData(OrderInterface::HIDDEN_TAX_REFUNDED); } /** @@ -2772,7 +2772,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getHoldBeforeState() { - return $this->getData(ApiOrderInterface::HOLD_BEFORE_STATE); + return $this->getData(OrderInterface::HOLD_BEFORE_STATE); } /** @@ -2782,7 +2782,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getHoldBeforeStatus() { - return $this->getData(ApiOrderInterface::HOLD_BEFORE_STATUS); + return $this->getData(OrderInterface::HOLD_BEFORE_STATUS); } /** @@ -2792,7 +2792,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getIsVirtual() { - return $this->getData(ApiOrderInterface::IS_VIRTUAL); + return $this->getData(OrderInterface::IS_VIRTUAL); } /** @@ -2802,7 +2802,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getOrderCurrencyCode() { - return $this->getData(ApiOrderInterface::ORDER_CURRENCY_CODE); + return $this->getData(OrderInterface::ORDER_CURRENCY_CODE); } /** @@ -2812,7 +2812,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getOriginalIncrementId() { - return $this->getData(ApiOrderInterface::ORIGINAL_INCREMENT_ID); + return $this->getData(OrderInterface::ORIGINAL_INCREMENT_ID); } /** @@ -2822,7 +2822,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getPaymentAuthorizationAmount() { - return $this->getData(ApiOrderInterface::PAYMENT_AUTHORIZATION_AMOUNT); + return $this->getData(OrderInterface::PAYMENT_AUTHORIZATION_AMOUNT); } /** @@ -2832,7 +2832,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getPaymentAuthExpiration() { - return $this->getData(ApiOrderInterface::PAYMENT_AUTH_EXPIRATION); + return $this->getData(OrderInterface::PAYMENT_AUTH_EXPIRATION); } /** @@ -2842,7 +2842,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getProtectCode() { - return $this->getData(ApiOrderInterface::PROTECT_CODE); + return $this->getData(OrderInterface::PROTECT_CODE); } /** @@ -2852,7 +2852,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getQuoteAddressId() { - return $this->getData(ApiOrderInterface::QUOTE_ADDRESS_ID); + return $this->getData(OrderInterface::QUOTE_ADDRESS_ID); } /** @@ -2862,7 +2862,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getQuoteId() { - return $this->getData(ApiOrderInterface::QUOTE_ID); + return $this->getData(OrderInterface::QUOTE_ID); } /** @@ -2872,7 +2872,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getRelationChildId() { - return $this->getData(ApiOrderInterface::RELATION_CHILD_ID); + return $this->getData(OrderInterface::RELATION_CHILD_ID); } /** @@ -2882,7 +2882,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getRelationChildRealId() { - return $this->getData(ApiOrderInterface::RELATION_CHILD_REAL_ID); + return $this->getData(OrderInterface::RELATION_CHILD_REAL_ID); } /** @@ -2892,7 +2892,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getRelationParentId() { - return $this->getData(ApiOrderInterface::RELATION_PARENT_ID); + return $this->getData(OrderInterface::RELATION_PARENT_ID); } /** @@ -2902,7 +2902,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getRelationParentRealId() { - return $this->getData(ApiOrderInterface::RELATION_PARENT_REAL_ID); + return $this->getData(OrderInterface::RELATION_PARENT_REAL_ID); } /** @@ -2912,7 +2912,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getRemoteIp() { - return $this->getData(ApiOrderInterface::REMOTE_IP); + return $this->getData(OrderInterface::REMOTE_IP); } /** @@ -2922,7 +2922,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingAddressId() { - return $this->getData(ApiOrderInterface::SHIPPING_ADDRESS_ID); + return $this->getData(OrderInterface::SHIPPING_ADDRESS_ID); } /** @@ -2932,7 +2932,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingAmount() { - return $this->getData(ApiOrderInterface::SHIPPING_AMOUNT); + return $this->getData(OrderInterface::SHIPPING_AMOUNT); } /** @@ -2942,7 +2942,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingCanceled() { - return $this->getData(ApiOrderInterface::SHIPPING_CANCELED); + return $this->getData(OrderInterface::SHIPPING_CANCELED); } /** @@ -2952,7 +2952,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingDescription() { - return $this->getData(ApiOrderInterface::SHIPPING_DESCRIPTION); + return $this->getData(OrderInterface::SHIPPING_DESCRIPTION); } /** @@ -2962,7 +2962,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingDiscountAmount() { - return $this->getData(ApiOrderInterface::SHIPPING_DISCOUNT_AMOUNT); + return $this->getData(OrderInterface::SHIPPING_DISCOUNT_AMOUNT); } /** @@ -2972,7 +2972,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingHiddenTaxAmount() { - return $this->getData(ApiOrderInterface::SHIPPING_HIDDEN_TAX_AMOUNT); + return $this->getData(OrderInterface::SHIPPING_HIDDEN_TAX_AMOUNT); } /** @@ -2982,7 +2982,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingInclTax() { - return $this->getData(ApiOrderInterface::SHIPPING_INCL_TAX); + return $this->getData(OrderInterface::SHIPPING_INCL_TAX); } /** @@ -2992,7 +2992,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingInvoiced() { - return $this->getData(ApiOrderInterface::SHIPPING_INVOICED); + return $this->getData(OrderInterface::SHIPPING_INVOICED); } /** @@ -3002,7 +3002,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingRefunded() { - return $this->getData(ApiOrderInterface::SHIPPING_REFUNDED); + return $this->getData(OrderInterface::SHIPPING_REFUNDED); } /** @@ -3012,7 +3012,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingTaxAmount() { - return $this->getData(ApiOrderInterface::SHIPPING_TAX_AMOUNT); + return $this->getData(OrderInterface::SHIPPING_TAX_AMOUNT); } /** @@ -3022,7 +3022,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getShippingTaxRefunded() { - return $this->getData(ApiOrderInterface::SHIPPING_TAX_REFUNDED); + return $this->getData(OrderInterface::SHIPPING_TAX_REFUNDED); } /** @@ -3032,7 +3032,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getState() { - return $this->getData(ApiOrderInterface::STATE); + return $this->getData(OrderInterface::STATE); } /** @@ -3042,7 +3042,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getStatus() { - return $this->getData(ApiOrderInterface::STATUS); + return $this->getData(OrderInterface::STATUS); } /** @@ -3052,7 +3052,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getStoreCurrencyCode() { - return $this->getData(ApiOrderInterface::STORE_CURRENCY_CODE); + return $this->getData(OrderInterface::STORE_CURRENCY_CODE); } /** @@ -3062,7 +3062,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getStoreId() { - return $this->getData(ApiOrderInterface::STORE_ID); + return $this->getData(OrderInterface::STORE_ID); } /** @@ -3072,7 +3072,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getStoreName() { - return $this->getData(ApiOrderInterface::STORE_NAME); + return $this->getData(OrderInterface::STORE_NAME); } /** @@ -3082,7 +3082,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getStoreToBaseRate() { - return $this->getData(ApiOrderInterface::STORE_TO_BASE_RATE); + return $this->getData(OrderInterface::STORE_TO_BASE_RATE); } /** @@ -3092,7 +3092,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getStoreToOrderRate() { - return $this->getData(ApiOrderInterface::STORE_TO_ORDER_RATE); + return $this->getData(OrderInterface::STORE_TO_ORDER_RATE); } /** @@ -3102,7 +3102,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getSubtotal() { - return $this->getData(ApiOrderInterface::SUBTOTAL); + return $this->getData(OrderInterface::SUBTOTAL); } /** @@ -3112,7 +3112,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getSubtotalCanceled() { - return $this->getData(ApiOrderInterface::SUBTOTAL_CANCELED); + return $this->getData(OrderInterface::SUBTOTAL_CANCELED); } /** @@ -3122,7 +3122,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getSubtotalInclTax() { - return $this->getData(ApiOrderInterface::SUBTOTAL_INCL_TAX); + return $this->getData(OrderInterface::SUBTOTAL_INCL_TAX); } /** @@ -3132,7 +3132,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getSubtotalInvoiced() { - return $this->getData(ApiOrderInterface::SUBTOTAL_INVOICED); + return $this->getData(OrderInterface::SUBTOTAL_INVOICED); } /** @@ -3142,7 +3142,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getSubtotalRefunded() { - return $this->getData(ApiOrderInterface::SUBTOTAL_REFUNDED); + return $this->getData(OrderInterface::SUBTOTAL_REFUNDED); } /** @@ -3152,7 +3152,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTaxAmount() { - return $this->getData(ApiOrderInterface::TAX_AMOUNT); + return $this->getData(OrderInterface::TAX_AMOUNT); } /** @@ -3162,7 +3162,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTaxCanceled() { - return $this->getData(ApiOrderInterface::TAX_CANCELED); + return $this->getData(OrderInterface::TAX_CANCELED); } /** @@ -3172,7 +3172,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTaxInvoiced() { - return $this->getData(ApiOrderInterface::TAX_INVOICED); + return $this->getData(OrderInterface::TAX_INVOICED); } /** @@ -3182,7 +3182,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTaxRefunded() { - return $this->getData(ApiOrderInterface::TAX_REFUNDED); + return $this->getData(OrderInterface::TAX_REFUNDED); } /** @@ -3192,7 +3192,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalCanceled() { - return $this->getData(ApiOrderInterface::TOTAL_CANCELED); + return $this->getData(OrderInterface::TOTAL_CANCELED); } /** @@ -3202,7 +3202,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalInvoiced() { - return $this->getData(ApiOrderInterface::TOTAL_INVOICED); + return $this->getData(OrderInterface::TOTAL_INVOICED); } /** @@ -3212,7 +3212,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalItemCount() { - return $this->getData(ApiOrderInterface::TOTAL_ITEM_COUNT); + return $this->getData(OrderInterface::TOTAL_ITEM_COUNT); } /** @@ -3222,7 +3222,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalOfflineRefunded() { - return $this->getData(ApiOrderInterface::TOTAL_OFFLINE_REFUNDED); + return $this->getData(OrderInterface::TOTAL_OFFLINE_REFUNDED); } /** @@ -3232,7 +3232,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalOnlineRefunded() { - return $this->getData(ApiOrderInterface::TOTAL_ONLINE_REFUNDED); + return $this->getData(OrderInterface::TOTAL_ONLINE_REFUNDED); } /** @@ -3242,7 +3242,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalPaid() { - return $this->getData(ApiOrderInterface::TOTAL_PAID); + return $this->getData(OrderInterface::TOTAL_PAID); } /** @@ -3252,7 +3252,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalQtyOrdered() { - return $this->getData(ApiOrderInterface::TOTAL_QTY_ORDERED); + return $this->getData(OrderInterface::TOTAL_QTY_ORDERED); } /** @@ -3262,7 +3262,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getTotalRefunded() { - return $this->getData(ApiOrderInterface::TOTAL_REFUNDED); + return $this->getData(OrderInterface::TOTAL_REFUNDED); } /** @@ -3272,7 +3272,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getUpdatedAt() { - return $this->getData(ApiOrderInterface::UPDATED_AT); + return $this->getData(OrderInterface::UPDATED_AT); } /** @@ -3282,7 +3282,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getWeight() { - return $this->getData(ApiOrderInterface::WEIGHT); + return $this->getData(OrderInterface::WEIGHT); } /** @@ -3292,7 +3292,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getXForwardedFor() { - return $this->getData(ApiOrderInterface::X_FORWARDED_FOR); + return $this->getData(OrderInterface::X_FORWARDED_FOR); } /** @@ -3300,13 +3300,34 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function getStatusHistories() { - if ($this->getData(ApiOrderInterface::STATUS_HISTORIES) == null) { + if ($this->getData(OrderInterface::STATUS_HISTORIES) == null) { $this->setData( - ApiOrderInterface::STATUS_HISTORIES, + OrderInterface::STATUS_HISTORIES, $this->getStatusHistoryCollection()->getItems() ); } - return $this->getData(ApiOrderInterface::STATUS_HISTORIES); + return $this->getData(OrderInterface::STATUS_HISTORIES); + } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\OrderExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); } /** @@ -3314,7 +3335,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setStatusHistories(array $statusHistories = null) { - return $this->setData(ApiOrderInterface::STATUS_HISTORIES, $statusHistories); + return $this->setData(OrderInterface::STATUS_HISTORIES, $statusHistories); } //@codeCoverageIgnoreStart @@ -3323,7 +3344,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setStatus($status) { - return $this->setData(ApiOrderInterface::STATUS, $status); + return $this->setData(OrderInterface::STATUS, $status); } /** @@ -3331,7 +3352,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCouponCode($code) { - return $this->setData(ApiOrderInterface::COUPON_CODE, $code); + return $this->setData(OrderInterface::COUPON_CODE, $code); } /** @@ -3339,7 +3360,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setProtectCode($code) { - return $this->setData(ApiOrderInterface::PROTECT_CODE, $code); + return $this->setData(OrderInterface::PROTECT_CODE, $code); } /** @@ -3347,7 +3368,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingDescription($description) { - return $this->setData(ApiOrderInterface::SHIPPING_DESCRIPTION, $description); + return $this->setData(OrderInterface::SHIPPING_DESCRIPTION, $description); } /** @@ -3355,7 +3376,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setIsVirtual($isVirtual) { - return $this->setData(ApiOrderInterface::IS_VIRTUAL, $isVirtual); + return $this->setData(OrderInterface::IS_VIRTUAL, $isVirtual); } /** @@ -3363,7 +3384,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setStoreId($id) { - return $this->setData(ApiOrderInterface::STORE_ID, $id); + return $this->setData(OrderInterface::STORE_ID, $id); } /** @@ -3371,7 +3392,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerId($id) { - return $this->setData(ApiOrderInterface::CUSTOMER_ID, $id); + return $this->setData(OrderInterface::CUSTOMER_ID, $id); } /** @@ -3379,7 +3400,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseDiscountAmount($amount) { - return $this->setData(ApiOrderInterface::BASE_DISCOUNT_AMOUNT, $amount); + return $this->setData(OrderInterface::BASE_DISCOUNT_AMOUNT, $amount); } /** @@ -3387,7 +3408,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseDiscountCanceled($baseDiscountCanceled) { - return $this->setData(ApiOrderInterface::BASE_DISCOUNT_CANCELED, $baseDiscountCanceled); + return $this->setData(OrderInterface::BASE_DISCOUNT_CANCELED, $baseDiscountCanceled); } /** @@ -3395,7 +3416,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseDiscountInvoiced($baseDiscountInvoiced) { - return $this->setData(ApiOrderInterface::BASE_DISCOUNT_INVOICED, $baseDiscountInvoiced); + return $this->setData(OrderInterface::BASE_DISCOUNT_INVOICED, $baseDiscountInvoiced); } /** @@ -3403,7 +3424,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseDiscountRefunded($baseDiscountRefunded) { - return $this->setData(ApiOrderInterface::BASE_DISCOUNT_REFUNDED, $baseDiscountRefunded); + return $this->setData(OrderInterface::BASE_DISCOUNT_REFUNDED, $baseDiscountRefunded); } /** @@ -3411,7 +3432,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseGrandTotal($amount) { - return $this->setData(ApiOrderInterface::BASE_GRAND_TOTAL, $amount); + return $this->setData(OrderInterface::BASE_GRAND_TOTAL, $amount); } /** @@ -3419,7 +3440,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingAmount($amount) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_AMOUNT, $amount); + return $this->setData(OrderInterface::BASE_SHIPPING_AMOUNT, $amount); } /** @@ -3427,7 +3448,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingCanceled($baseShippingCanceled) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_CANCELED, $baseShippingCanceled); + return $this->setData(OrderInterface::BASE_SHIPPING_CANCELED, $baseShippingCanceled); } /** @@ -3435,7 +3456,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingInvoiced($baseShippingInvoiced) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_INVOICED, $baseShippingInvoiced); + return $this->setData(OrderInterface::BASE_SHIPPING_INVOICED, $baseShippingInvoiced); } /** @@ -3443,7 +3464,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingRefunded($baseShippingRefunded) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_REFUNDED, $baseShippingRefunded); + return $this->setData(OrderInterface::BASE_SHIPPING_REFUNDED, $baseShippingRefunded); } /** @@ -3451,7 +3472,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingTaxAmount($amount) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_TAX_AMOUNT, $amount); + return $this->setData(OrderInterface::BASE_SHIPPING_TAX_AMOUNT, $amount); } /** @@ -3459,7 +3480,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingTaxRefunded($baseShippingTaxRefunded) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_TAX_REFUNDED, $baseShippingTaxRefunded); + return $this->setData(OrderInterface::BASE_SHIPPING_TAX_REFUNDED, $baseShippingTaxRefunded); } /** @@ -3467,7 +3488,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseSubtotal($amount) { - return $this->setData(ApiOrderInterface::BASE_SUBTOTAL, $amount); + return $this->setData(OrderInterface::BASE_SUBTOTAL, $amount); } /** @@ -3475,7 +3496,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseSubtotalCanceled($baseSubtotalCanceled) { - return $this->setData(ApiOrderInterface::BASE_SUBTOTAL_CANCELED, $baseSubtotalCanceled); + return $this->setData(OrderInterface::BASE_SUBTOTAL_CANCELED, $baseSubtotalCanceled); } /** @@ -3483,7 +3504,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseSubtotalInvoiced($baseSubtotalInvoiced) { - return $this->setData(ApiOrderInterface::BASE_SUBTOTAL_INVOICED, $baseSubtotalInvoiced); + return $this->setData(OrderInterface::BASE_SUBTOTAL_INVOICED, $baseSubtotalInvoiced); } /** @@ -3491,7 +3512,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseSubtotalRefunded($baseSubtotalRefunded) { - return $this->setData(ApiOrderInterface::BASE_SUBTOTAL_REFUNDED, $baseSubtotalRefunded); + return $this->setData(OrderInterface::BASE_SUBTOTAL_REFUNDED, $baseSubtotalRefunded); } /** @@ -3499,7 +3520,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTaxAmount($amount) { - return $this->setData(ApiOrderInterface::BASE_TAX_AMOUNT, $amount); + return $this->setData(OrderInterface::BASE_TAX_AMOUNT, $amount); } /** @@ -3507,7 +3528,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTaxCanceled($baseTaxCanceled) { - return $this->setData(ApiOrderInterface::BASE_TAX_CANCELED, $baseTaxCanceled); + return $this->setData(OrderInterface::BASE_TAX_CANCELED, $baseTaxCanceled); } /** @@ -3515,7 +3536,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTaxInvoiced($baseTaxInvoiced) { - return $this->setData(ApiOrderInterface::BASE_TAX_INVOICED, $baseTaxInvoiced); + return $this->setData(OrderInterface::BASE_TAX_INVOICED, $baseTaxInvoiced); } /** @@ -3523,7 +3544,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTaxRefunded($baseTaxRefunded) { - return $this->setData(ApiOrderInterface::BASE_TAX_REFUNDED, $baseTaxRefunded); + return $this->setData(OrderInterface::BASE_TAX_REFUNDED, $baseTaxRefunded); } /** @@ -3531,7 +3552,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseToGlobalRate($rate) { - return $this->setData(ApiOrderInterface::BASE_TO_GLOBAL_RATE, $rate); + return $this->setData(OrderInterface::BASE_TO_GLOBAL_RATE, $rate); } /** @@ -3539,7 +3560,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseToOrderRate($rate) { - return $this->setData(ApiOrderInterface::BASE_TO_ORDER_RATE, $rate); + return $this->setData(OrderInterface::BASE_TO_ORDER_RATE, $rate); } /** @@ -3547,7 +3568,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalCanceled($baseTotalCanceled) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_CANCELED, $baseTotalCanceled); + return $this->setData(OrderInterface::BASE_TOTAL_CANCELED, $baseTotalCanceled); } /** @@ -3555,7 +3576,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalInvoiced($baseTotalInvoiced) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_INVOICED, $baseTotalInvoiced); + return $this->setData(OrderInterface::BASE_TOTAL_INVOICED, $baseTotalInvoiced); } /** @@ -3563,7 +3584,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalInvoicedCost($baseTotalInvoicedCost) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_INVOICED_COST, $baseTotalInvoicedCost); + return $this->setData(OrderInterface::BASE_TOTAL_INVOICED_COST, $baseTotalInvoicedCost); } /** @@ -3571,7 +3592,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalOfflineRefunded($baseTotalOfflineRefunded) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_OFFLINE_REFUNDED, $baseTotalOfflineRefunded); + return $this->setData(OrderInterface::BASE_TOTAL_OFFLINE_REFUNDED, $baseTotalOfflineRefunded); } /** @@ -3579,7 +3600,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalOnlineRefunded($baseTotalOnlineRefunded) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_ONLINE_REFUNDED, $baseTotalOnlineRefunded); + return $this->setData(OrderInterface::BASE_TOTAL_ONLINE_REFUNDED, $baseTotalOnlineRefunded); } /** @@ -3587,7 +3608,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalPaid($baseTotalPaid) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_PAID, $baseTotalPaid); + return $this->setData(OrderInterface::BASE_TOTAL_PAID, $baseTotalPaid); } /** @@ -3595,7 +3616,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalQtyOrdered($baseTotalQtyOrdered) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_QTY_ORDERED, $baseTotalQtyOrdered); + return $this->setData(OrderInterface::BASE_TOTAL_QTY_ORDERED, $baseTotalQtyOrdered); } /** @@ -3603,7 +3624,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalRefunded($baseTotalRefunded) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_REFUNDED, $baseTotalRefunded); + return $this->setData(OrderInterface::BASE_TOTAL_REFUNDED, $baseTotalRefunded); } /** @@ -3611,7 +3632,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setDiscountAmount($amount) { - return $this->setData(ApiOrderInterface::DISCOUNT_AMOUNT, $amount); + return $this->setData(OrderInterface::DISCOUNT_AMOUNT, $amount); } /** @@ -3619,7 +3640,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setDiscountCanceled($discountCanceled) { - return $this->setData(ApiOrderInterface::DISCOUNT_CANCELED, $discountCanceled); + return $this->setData(OrderInterface::DISCOUNT_CANCELED, $discountCanceled); } /** @@ -3627,7 +3648,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setDiscountInvoiced($discountInvoiced) { - return $this->setData(ApiOrderInterface::DISCOUNT_INVOICED, $discountInvoiced); + return $this->setData(OrderInterface::DISCOUNT_INVOICED, $discountInvoiced); } /** @@ -3635,7 +3656,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setDiscountRefunded($discountRefunded) { - return $this->setData(ApiOrderInterface::DISCOUNT_REFUNDED, $discountRefunded); + return $this->setData(OrderInterface::DISCOUNT_REFUNDED, $discountRefunded); } /** @@ -3643,7 +3664,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setGrandTotal($amount) { - return $this->setData(ApiOrderInterface::GRAND_TOTAL, $amount); + return $this->setData(OrderInterface::GRAND_TOTAL, $amount); } /** @@ -3651,7 +3672,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingAmount($amount) { - return $this->setData(ApiOrderInterface::SHIPPING_AMOUNT, $amount); + return $this->setData(OrderInterface::SHIPPING_AMOUNT, $amount); } /** @@ -3659,7 +3680,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingCanceled($shippingCanceled) { - return $this->setData(ApiOrderInterface::SHIPPING_CANCELED, $shippingCanceled); + return $this->setData(OrderInterface::SHIPPING_CANCELED, $shippingCanceled); } /** @@ -3667,7 +3688,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingInvoiced($shippingInvoiced) { - return $this->setData(ApiOrderInterface::SHIPPING_INVOICED, $shippingInvoiced); + return $this->setData(OrderInterface::SHIPPING_INVOICED, $shippingInvoiced); } /** @@ -3675,7 +3696,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingRefunded($shippingRefunded) { - return $this->setData(ApiOrderInterface::SHIPPING_REFUNDED, $shippingRefunded); + return $this->setData(OrderInterface::SHIPPING_REFUNDED, $shippingRefunded); } /** @@ -3683,7 +3704,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingTaxAmount($amount) { - return $this->setData(ApiOrderInterface::SHIPPING_TAX_AMOUNT, $amount); + return $this->setData(OrderInterface::SHIPPING_TAX_AMOUNT, $amount); } /** @@ -3691,7 +3712,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingTaxRefunded($shippingTaxRefunded) { - return $this->setData(ApiOrderInterface::SHIPPING_TAX_REFUNDED, $shippingTaxRefunded); + return $this->setData(OrderInterface::SHIPPING_TAX_REFUNDED, $shippingTaxRefunded); } /** @@ -3699,7 +3720,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setStoreToBaseRate($rate) { - return $this->setData(ApiOrderInterface::STORE_TO_BASE_RATE, $rate); + return $this->setData(OrderInterface::STORE_TO_BASE_RATE, $rate); } /** @@ -3707,7 +3728,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setStoreToOrderRate($rate) { - return $this->setData(ApiOrderInterface::STORE_TO_ORDER_RATE, $rate); + return $this->setData(OrderInterface::STORE_TO_ORDER_RATE, $rate); } /** @@ -3715,7 +3736,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setSubtotal($amount) { - return $this->setData(ApiOrderInterface::SUBTOTAL, $amount); + return $this->setData(OrderInterface::SUBTOTAL, $amount); } /** @@ -3723,7 +3744,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setSubtotalCanceled($subtotalCanceled) { - return $this->setData(ApiOrderInterface::SUBTOTAL_CANCELED, $subtotalCanceled); + return $this->setData(OrderInterface::SUBTOTAL_CANCELED, $subtotalCanceled); } /** @@ -3731,7 +3752,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setSubtotalInvoiced($subtotalInvoiced) { - return $this->setData(ApiOrderInterface::SUBTOTAL_INVOICED, $subtotalInvoiced); + return $this->setData(OrderInterface::SUBTOTAL_INVOICED, $subtotalInvoiced); } /** @@ -3739,7 +3760,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setSubtotalRefunded($subtotalRefunded) { - return $this->setData(ApiOrderInterface::SUBTOTAL_REFUNDED, $subtotalRefunded); + return $this->setData(OrderInterface::SUBTOTAL_REFUNDED, $subtotalRefunded); } /** @@ -3747,7 +3768,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTaxAmount($amount) { - return $this->setData(ApiOrderInterface::TAX_AMOUNT, $amount); + return $this->setData(OrderInterface::TAX_AMOUNT, $amount); } /** @@ -3755,7 +3776,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTaxCanceled($taxCanceled) { - return $this->setData(ApiOrderInterface::TAX_CANCELED, $taxCanceled); + return $this->setData(OrderInterface::TAX_CANCELED, $taxCanceled); } /** @@ -3763,7 +3784,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTaxInvoiced($taxInvoiced) { - return $this->setData(ApiOrderInterface::TAX_INVOICED, $taxInvoiced); + return $this->setData(OrderInterface::TAX_INVOICED, $taxInvoiced); } /** @@ -3771,7 +3792,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTaxRefunded($taxRefunded) { - return $this->setData(ApiOrderInterface::TAX_REFUNDED, $taxRefunded); + return $this->setData(OrderInterface::TAX_REFUNDED, $taxRefunded); } /** @@ -3779,7 +3800,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalCanceled($totalCanceled) { - return $this->setData(ApiOrderInterface::TOTAL_CANCELED, $totalCanceled); + return $this->setData(OrderInterface::TOTAL_CANCELED, $totalCanceled); } /** @@ -3787,7 +3808,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalInvoiced($totalInvoiced) { - return $this->setData(ApiOrderInterface::TOTAL_INVOICED, $totalInvoiced); + return $this->setData(OrderInterface::TOTAL_INVOICED, $totalInvoiced); } /** @@ -3795,7 +3816,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalOfflineRefunded($totalOfflineRefunded) { - return $this->setData(ApiOrderInterface::TOTAL_OFFLINE_REFUNDED, $totalOfflineRefunded); + return $this->setData(OrderInterface::TOTAL_OFFLINE_REFUNDED, $totalOfflineRefunded); } /** @@ -3803,7 +3824,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalOnlineRefunded($totalOnlineRefunded) { - return $this->setData(ApiOrderInterface::TOTAL_ONLINE_REFUNDED, $totalOnlineRefunded); + return $this->setData(OrderInterface::TOTAL_ONLINE_REFUNDED, $totalOnlineRefunded); } /** @@ -3811,7 +3832,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalPaid($totalPaid) { - return $this->setData(ApiOrderInterface::TOTAL_PAID, $totalPaid); + return $this->setData(OrderInterface::TOTAL_PAID, $totalPaid); } /** @@ -3819,7 +3840,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalQtyOrdered($totalQtyOrdered) { - return $this->setData(ApiOrderInterface::TOTAL_QTY_ORDERED, $totalQtyOrdered); + return $this->setData(OrderInterface::TOTAL_QTY_ORDERED, $totalQtyOrdered); } /** @@ -3827,7 +3848,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalRefunded($totalRefunded) { - return $this->setData(ApiOrderInterface::TOTAL_REFUNDED, $totalRefunded); + return $this->setData(OrderInterface::TOTAL_REFUNDED, $totalRefunded); } /** @@ -3835,7 +3856,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCanShipPartially($flag) { - return $this->setData(ApiOrderInterface::CAN_SHIP_PARTIALLY, $flag); + return $this->setData(OrderInterface::CAN_SHIP_PARTIALLY, $flag); } /** @@ -3843,7 +3864,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCanShipPartiallyItem($flag) { - return $this->setData(ApiOrderInterface::CAN_SHIP_PARTIALLY_ITEM, $flag); + return $this->setData(OrderInterface::CAN_SHIP_PARTIALLY_ITEM, $flag); } /** @@ -3851,7 +3872,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerIsGuest($customerIsGuest) { - return $this->setData(ApiOrderInterface::CUSTOMER_IS_GUEST, $customerIsGuest); + return $this->setData(OrderInterface::CUSTOMER_IS_GUEST, $customerIsGuest); } /** @@ -3859,7 +3880,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerNoteNotify($customerNoteNotify) { - return $this->setData(ApiOrderInterface::CUSTOMER_NOTE_NOTIFY, $customerNoteNotify); + return $this->setData(OrderInterface::CUSTOMER_NOTE_NOTIFY, $customerNoteNotify); } /** @@ -3867,7 +3888,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBillingAddressId($id) { - return $this->setData(ApiOrderInterface::BILLING_ADDRESS_ID, $id); + return $this->setData(OrderInterface::BILLING_ADDRESS_ID, $id); } /** @@ -3875,7 +3896,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerGroupId($id) { - return $this->setData(ApiOrderInterface::CUSTOMER_GROUP_ID, $id); + return $this->setData(OrderInterface::CUSTOMER_GROUP_ID, $id); } /** @@ -3883,7 +3904,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setEditIncrement($editIncrement) { - return $this->setData(ApiOrderInterface::EDIT_INCREMENT, $editIncrement); + return $this->setData(OrderInterface::EDIT_INCREMENT, $editIncrement); } /** @@ -3891,7 +3912,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setEmailSent($emailSent) { - return $this->setData(ApiOrderInterface::EMAIL_SENT, $emailSent); + return $this->setData(OrderInterface::EMAIL_SENT, $emailSent); } /** @@ -3899,7 +3920,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setForcedShipmentWithInvoice($forcedShipmentWithInvoice) { - return $this->setData(ApiOrderInterface::FORCED_SHIPMENT_WITH_INVOICE, $forcedShipmentWithInvoice); + return $this->setData(OrderInterface::FORCED_SHIPMENT_WITH_INVOICE, $forcedShipmentWithInvoice); } /** @@ -3907,7 +3928,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setPaymentAuthExpiration($paymentAuthExpiration) { - return $this->setData(ApiOrderInterface::PAYMENT_AUTH_EXPIRATION, $paymentAuthExpiration); + return $this->setData(OrderInterface::PAYMENT_AUTH_EXPIRATION, $paymentAuthExpiration); } /** @@ -3915,7 +3936,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setQuoteAddressId($id) { - return $this->setData(ApiOrderInterface::QUOTE_ADDRESS_ID, $id); + return $this->setData(OrderInterface::QUOTE_ADDRESS_ID, $id); } /** @@ -3923,7 +3944,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setQuoteId($id) { - return $this->setData(ApiOrderInterface::QUOTE_ID, $id); + return $this->setData(OrderInterface::QUOTE_ID, $id); } /** @@ -3931,7 +3952,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingAddressId($id) { - return $this->setData(ApiOrderInterface::SHIPPING_ADDRESS_ID, $id); + return $this->setData(OrderInterface::SHIPPING_ADDRESS_ID, $id); } /** @@ -3939,7 +3960,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setAdjustmentNegative($adjustmentNegative) { - return $this->setData(ApiOrderInterface::ADJUSTMENT_NEGATIVE, $adjustmentNegative); + return $this->setData(OrderInterface::ADJUSTMENT_NEGATIVE, $adjustmentNegative); } /** @@ -3947,7 +3968,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setAdjustmentPositive($adjustmentPositive) { - return $this->setData(ApiOrderInterface::ADJUSTMENT_POSITIVE, $adjustmentPositive); + return $this->setData(OrderInterface::ADJUSTMENT_POSITIVE, $adjustmentPositive); } /** @@ -3955,7 +3976,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseAdjustmentNegative($baseAdjustmentNegative) { - return $this->setData(ApiOrderInterface::BASE_ADJUSTMENT_NEGATIVE, $baseAdjustmentNegative); + return $this->setData(OrderInterface::BASE_ADJUSTMENT_NEGATIVE, $baseAdjustmentNegative); } /** @@ -3963,7 +3984,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseAdjustmentPositive($baseAdjustmentPositive) { - return $this->setData(ApiOrderInterface::BASE_ADJUSTMENT_POSITIVE, $baseAdjustmentPositive); + return $this->setData(OrderInterface::BASE_ADJUSTMENT_POSITIVE, $baseAdjustmentPositive); } /** @@ -3971,7 +3992,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingDiscountAmount($amount) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_DISCOUNT_AMOUNT, $amount); + return $this->setData(OrderInterface::BASE_SHIPPING_DISCOUNT_AMOUNT, $amount); } /** @@ -3979,7 +4000,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseSubtotalInclTax($amount) { - return $this->setData(ApiOrderInterface::BASE_SUBTOTAL_INCL_TAX, $amount); + return $this->setData(OrderInterface::BASE_SUBTOTAL_INCL_TAX, $amount); } /** @@ -3987,7 +4008,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseTotalDue($baseTotalDue) { - return $this->setData(ApiOrderInterface::BASE_TOTAL_DUE, $baseTotalDue); + return $this->setData(OrderInterface::BASE_TOTAL_DUE, $baseTotalDue); } /** @@ -3995,7 +4016,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setPaymentAuthorizationAmount($amount) { - return $this->setData(ApiOrderInterface::PAYMENT_AUTHORIZATION_AMOUNT, $amount); + return $this->setData(OrderInterface::PAYMENT_AUTHORIZATION_AMOUNT, $amount); } /** @@ -4003,7 +4024,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingDiscountAmount($amount) { - return $this->setData(ApiOrderInterface::SHIPPING_DISCOUNT_AMOUNT, $amount); + return $this->setData(OrderInterface::SHIPPING_DISCOUNT_AMOUNT, $amount); } /** @@ -4011,7 +4032,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setSubtotalInclTax($amount) { - return $this->setData(ApiOrderInterface::SUBTOTAL_INCL_TAX, $amount); + return $this->setData(OrderInterface::SUBTOTAL_INCL_TAX, $amount); } /** @@ -4019,7 +4040,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalDue($totalDue) { - return $this->setData(ApiOrderInterface::TOTAL_DUE, $totalDue); + return $this->setData(OrderInterface::TOTAL_DUE, $totalDue); } /** @@ -4027,7 +4048,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setWeight($weight) { - return $this->setData(ApiOrderInterface::WEIGHT, $weight); + return $this->setData(OrderInterface::WEIGHT, $weight); } /** @@ -4035,7 +4056,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerDob($customerDob) { - return $this->setData(ApiOrderInterface::CUSTOMER_DOB, $customerDob); + return $this->setData(OrderInterface::CUSTOMER_DOB, $customerDob); } /** @@ -4043,7 +4064,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setIncrementId($id) { - return $this->setData(ApiOrderInterface::INCREMENT_ID, $id); + return $this->setData(OrderInterface::INCREMENT_ID, $id); } /** @@ -4051,7 +4072,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setAppliedRuleIds($appliedRuleIds) { - return $this->setData(ApiOrderInterface::APPLIED_RULE_IDS, $appliedRuleIds); + return $this->setData(OrderInterface::APPLIED_RULE_IDS, $appliedRuleIds); } /** @@ -4059,7 +4080,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseCurrencyCode($code) { - return $this->setData(ApiOrderInterface::BASE_CURRENCY_CODE, $code); + return $this->setData(OrderInterface::BASE_CURRENCY_CODE, $code); } /** @@ -4067,7 +4088,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerEmail($customerEmail) { - return $this->setData(ApiOrderInterface::CUSTOMER_EMAIL, $customerEmail); + return $this->setData(OrderInterface::CUSTOMER_EMAIL, $customerEmail); } /** @@ -4075,7 +4096,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerFirstname($customerFirstname) { - return $this->setData(ApiOrderInterface::CUSTOMER_FIRSTNAME, $customerFirstname); + return $this->setData(OrderInterface::CUSTOMER_FIRSTNAME, $customerFirstname); } /** @@ -4083,7 +4104,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerLastname($customerLastname) { - return $this->setData(ApiOrderInterface::CUSTOMER_LASTNAME, $customerLastname); + return $this->setData(OrderInterface::CUSTOMER_LASTNAME, $customerLastname); } /** @@ -4091,7 +4112,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerMiddlename($customerMiddlename) { - return $this->setData(ApiOrderInterface::CUSTOMER_MIDDLENAME, $customerMiddlename); + return $this->setData(OrderInterface::CUSTOMER_MIDDLENAME, $customerMiddlename); } /** @@ -4099,7 +4120,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerPrefix($customerPrefix) { - return $this->setData(ApiOrderInterface::CUSTOMER_PREFIX, $customerPrefix); + return $this->setData(OrderInterface::CUSTOMER_PREFIX, $customerPrefix); } /** @@ -4107,7 +4128,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerSuffix($customerSuffix) { - return $this->setData(ApiOrderInterface::CUSTOMER_SUFFIX, $customerSuffix); + return $this->setData(OrderInterface::CUSTOMER_SUFFIX, $customerSuffix); } /** @@ -4115,7 +4136,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerTaxvat($customerTaxvat) { - return $this->setData(ApiOrderInterface::CUSTOMER_TAXVAT, $customerTaxvat); + return $this->setData(OrderInterface::CUSTOMER_TAXVAT, $customerTaxvat); } /** @@ -4123,7 +4144,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setDiscountDescription($description) { - return $this->setData(ApiOrderInterface::DISCOUNT_DESCRIPTION, $description); + return $this->setData(OrderInterface::DISCOUNT_DESCRIPTION, $description); } /** @@ -4131,7 +4152,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setExtCustomerId($id) { - return $this->setData(ApiOrderInterface::EXT_CUSTOMER_ID, $id); + return $this->setData(OrderInterface::EXT_CUSTOMER_ID, $id); } /** @@ -4139,7 +4160,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setExtOrderId($id) { - return $this->setData(ApiOrderInterface::EXT_ORDER_ID, $id); + return $this->setData(OrderInterface::EXT_ORDER_ID, $id); } /** @@ -4147,7 +4168,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setGlobalCurrencyCode($code) { - return $this->setData(ApiOrderInterface::GLOBAL_CURRENCY_CODE, $code); + return $this->setData(OrderInterface::GLOBAL_CURRENCY_CODE, $code); } /** @@ -4155,7 +4176,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setHoldBeforeState($holdBeforeState) { - return $this->setData(ApiOrderInterface::HOLD_BEFORE_STATE, $holdBeforeState); + return $this->setData(OrderInterface::HOLD_BEFORE_STATE, $holdBeforeState); } /** @@ -4163,7 +4184,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setHoldBeforeStatus($holdBeforeStatus) { - return $this->setData(ApiOrderInterface::HOLD_BEFORE_STATUS, $holdBeforeStatus); + return $this->setData(OrderInterface::HOLD_BEFORE_STATUS, $holdBeforeStatus); } /** @@ -4171,7 +4192,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setOrderCurrencyCode($code) { - return $this->setData(ApiOrderInterface::ORDER_CURRENCY_CODE, $code); + return $this->setData(OrderInterface::ORDER_CURRENCY_CODE, $code); } /** @@ -4179,7 +4200,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setOriginalIncrementId($id) { - return $this->setData(ApiOrderInterface::ORIGINAL_INCREMENT_ID, $id); + return $this->setData(OrderInterface::ORIGINAL_INCREMENT_ID, $id); } /** @@ -4187,7 +4208,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setRelationChildId($id) { - return $this->setData(ApiOrderInterface::RELATION_CHILD_ID, $id); + return $this->setData(OrderInterface::RELATION_CHILD_ID, $id); } /** @@ -4195,7 +4216,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setRelationChildRealId($realId) { - return $this->setData(ApiOrderInterface::RELATION_CHILD_REAL_ID, $realId); + return $this->setData(OrderInterface::RELATION_CHILD_REAL_ID, $realId); } /** @@ -4203,7 +4224,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setRelationParentId($id) { - return $this->setData(ApiOrderInterface::RELATION_PARENT_ID, $id); + return $this->setData(OrderInterface::RELATION_PARENT_ID, $id); } /** @@ -4211,7 +4232,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setRelationParentRealId($realId) { - return $this->setData(ApiOrderInterface::RELATION_PARENT_REAL_ID, $realId); + return $this->setData(OrderInterface::RELATION_PARENT_REAL_ID, $realId); } /** @@ -4219,7 +4240,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setRemoteIp($remoteIp) { - return $this->setData(ApiOrderInterface::REMOTE_IP, $remoteIp); + return $this->setData(OrderInterface::REMOTE_IP, $remoteIp); } /** @@ -4227,7 +4248,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingMethod($shippingMethod) { - return $this->setData(ApiOrderInterface::SHIPPING_METHOD, $shippingMethod); + return $this->setData(OrderInterface::SHIPPING_METHOD, $shippingMethod); } /** @@ -4235,7 +4256,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setStoreCurrencyCode($code) { - return $this->setData(ApiOrderInterface::STORE_CURRENCY_CODE, $code); + return $this->setData(OrderInterface::STORE_CURRENCY_CODE, $code); } /** @@ -4243,7 +4264,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setStoreName($storeName) { - return $this->setData(ApiOrderInterface::STORE_NAME, $storeName); + return $this->setData(OrderInterface::STORE_NAME, $storeName); } /** @@ -4251,7 +4272,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setXForwardedFor($xForwardedFor) { - return $this->setData(ApiOrderInterface::X_FORWARDED_FOR, $xForwardedFor); + return $this->setData(OrderInterface::X_FORWARDED_FOR, $xForwardedFor); } /** @@ -4259,7 +4280,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerNote($customerNote) { - return $this->setData(ApiOrderInterface::CUSTOMER_NOTE, $customerNote); + return $this->setData(OrderInterface::CUSTOMER_NOTE, $customerNote); } /** @@ -4267,7 +4288,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setUpdatedAt($timestamp) { - return $this->setData(ApiOrderInterface::UPDATED_AT, $timestamp); + return $this->setData(OrderInterface::UPDATED_AT, $timestamp); } /** @@ -4275,7 +4296,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setTotalItemCount($totalItemCount) { - return $this->setData(ApiOrderInterface::TOTAL_ITEM_COUNT, $totalItemCount); + return $this->setData(OrderInterface::TOTAL_ITEM_COUNT, $totalItemCount); } /** @@ -4283,7 +4304,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setCustomerGender($customerGender) { - return $this->setData(ApiOrderInterface::CUSTOMER_GENDER, $customerGender); + return $this->setData(OrderInterface::CUSTOMER_GENDER, $customerGender); } /** @@ -4291,7 +4312,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setHiddenTaxAmount($amount) { - return $this->setData(ApiOrderInterface::HIDDEN_TAX_AMOUNT, $amount); + return $this->setData(OrderInterface::HIDDEN_TAX_AMOUNT, $amount); } /** @@ -4299,7 +4320,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseHiddenTaxAmount($amount) { - return $this->setData(ApiOrderInterface::BASE_HIDDEN_TAX_AMOUNT, $amount); + return $this->setData(OrderInterface::BASE_HIDDEN_TAX_AMOUNT, $amount); } /** @@ -4307,7 +4328,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingHiddenTaxAmount($amount) { - return $this->setData(ApiOrderInterface::SHIPPING_HIDDEN_TAX_AMOUNT, $amount); + return $this->setData(OrderInterface::SHIPPING_HIDDEN_TAX_AMOUNT, $amount); } /** @@ -4315,7 +4336,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingHiddenTaxAmnt($amnt) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_HIDDEN_TAX_AMNT, $amnt); + return $this->setData(OrderInterface::BASE_SHIPPING_HIDDEN_TAX_AMNT, $amnt); } /** @@ -4323,7 +4344,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setHiddenTaxInvoiced($hiddenTaxInvoiced) { - return $this->setData(ApiOrderInterface::HIDDEN_TAX_INVOICED, $hiddenTaxInvoiced); + return $this->setData(OrderInterface::HIDDEN_TAX_INVOICED, $hiddenTaxInvoiced); } /** @@ -4331,7 +4352,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseHiddenTaxInvoiced($baseHiddenTaxInvoiced) { - return $this->setData(ApiOrderInterface::BASE_HIDDEN_TAX_INVOICED, $baseHiddenTaxInvoiced); + return $this->setData(OrderInterface::BASE_HIDDEN_TAX_INVOICED, $baseHiddenTaxInvoiced); } /** @@ -4339,7 +4360,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setHiddenTaxRefunded($hiddenTaxRefunded) { - return $this->setData(ApiOrderInterface::HIDDEN_TAX_REFUNDED, $hiddenTaxRefunded); + return $this->setData(OrderInterface::HIDDEN_TAX_REFUNDED, $hiddenTaxRefunded); } /** @@ -4347,7 +4368,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseHiddenTaxRefunded($baseHiddenTaxRefunded) { - return $this->setData(ApiOrderInterface::BASE_HIDDEN_TAX_REFUNDED, $baseHiddenTaxRefunded); + return $this->setData(OrderInterface::BASE_HIDDEN_TAX_REFUNDED, $baseHiddenTaxRefunded); } /** @@ -4355,7 +4376,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setShippingInclTax($amount) { - return $this->setData(ApiOrderInterface::SHIPPING_INCL_TAX, $amount); + return $this->setData(OrderInterface::SHIPPING_INCL_TAX, $amount); } /** @@ -4363,7 +4384,7 @@ class Order extends AbstractModel implements EntityInterface, ApiOrderInterface */ public function setBaseShippingInclTax($amount) { - return $this->setData(ApiOrderInterface::BASE_SHIPPING_INCL_TAX, $amount); + return $this->setData(OrderInterface::BASE_SHIPPING_INCL_TAX, $amount); } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index 971183c49f58fff688e133cae97a7d8074fb02ba..e0bc6ef9445d7e9cf32fd01860013a3b49fc1d90 100644 --- a/app/code/Magento/Sales/Model/Order/Address.php +++ b/app/code/Magento/Sales/Model/Order/Address.php @@ -9,7 +9,6 @@ use Magento\Customer\Api\AddressMetadataInterface; use Magento\Customer\Api\Data\AddressInterfaceFactory; use Magento\Customer\Api\Data\RegionInterfaceFactory; use Magento\Customer\Model\Address\AbstractAddress; -use Magento\Framework\Api\AttributeValueFactory; use Magento\Sales\Api\Data\OrderAddressInterface; /** @@ -47,14 +46,14 @@ class Address extends AbstractAddress implements OrderAddressInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Customer\Model\Address\Config $addressConfig * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param AddressMetadataInterface $addressMetadataService + * @param AddressMetadataInterface $metadataService * @param AddressInterfaceFactory $addressDataFactory * @param RegionInterfaceFactory $regionDataFactory * @param \Magento\Framework\Api\DataObjectHelper $dataObjectHelper @@ -67,14 +66,14 @@ class Address extends AbstractAddress implements OrderAddressInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Directory\Helper\Data $directoryData, \Magento\Eav\Model\Config $eavConfig, \Magento\Customer\Model\Address\Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - AddressMetadataInterface $addressMetadataService, + AddressMetadataInterface $metadataService, AddressInterfaceFactory $addressDataFactory, RegionInterfaceFactory $regionDataFactory, \Magento\Framework\Api\DataObjectHelper $dataObjectHelper, @@ -86,14 +85,14 @@ class Address extends AbstractAddress implements OrderAddressInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $directoryData, $eavConfig, $addressConfig, $regionFactory, $countryFactory, - $addressMetadataService, + $metadataService, $addressDataFactory, $regionDataFactory, $dataObjectHelper, @@ -219,6 +218,17 @@ class Address extends AbstractAddress implements OrderAddressInterface return $this->getData(OrderAddressInterface::ENTITY_ID); } + /** + * Sets the ID for the order address. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData(OrderAddressInterface::ENTITY_ID, $entityId); + } + /** * Returns fax * @@ -591,5 +601,26 @@ class Address extends AbstractAddress implements OrderAddressInterface { return $this->setData(OrderAddressInterface::VAT_REQUEST_SUCCESS, $vatRequestSuccess); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\OrderAddressExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\OrderAddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderAddressExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index ec25b06e53aed9ee4d9d1bc35dcdb771cbf182bb..852d09607d019b58e30e627ca8e497e4c7390cd0 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -20,9 +20,6 @@ use Magento\Sales\Model\EntityInterface; * * @method \Magento\Sales\Model\Resource\Order\Creditmemo _getResource() * @method \Magento\Sales\Model\Resource\Order\Creditmemo getResource() - * @method \Magento\Sales\Model\Order\Creditmemo setBaseAdjustmentNegative(float $value) - * @method \Magento\Sales\Model\Order\Creditmemo setBaseAdjustmentPositive(float $value) - * @method \Magento\Sales\Model\Order\Creditmemo setTransactionId(string $value) * @method \Magento\Sales\Model\Order\Creditmemo setCreatedAt(string $value) * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -117,7 +114,7 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -137,7 +134,7 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -164,7 +161,7 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -856,6 +853,17 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt return $this->getData(CreditmemoInterface::BASE_ADJUSTMENT_NEGATIVE); } + /** + * Set base_adjustment_negative + * + * @param float $baseAdjustmentNegative + * @return $this + */ + public function setBaseAdjustmentNegative($baseAdjustmentNegative) + { + return $this->setData(CreditmemoInterface::BASE_ADJUSTMENT_NEGATIVE, $baseAdjustmentNegative); + } + /** * Returns base_adjustment_positive * @@ -866,6 +874,17 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt return $this->getData(CreditmemoInterface::BASE_ADJUSTMENT_POSITIVE); } + /** + * Set base_adjustment_positive + * + * @param float $baseAdjustmentPositive + * @return $this + */ + public function setBaseAdjustmentPositive($baseAdjustmentPositive) + { + return $this->setData(CreditmemoInterface::BASE_ADJUSTMENT_POSITIVE, $baseAdjustmentPositive); + } + /** * Returns base_currency_code * @@ -1246,6 +1265,17 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt return $this->getData(CreditmemoInterface::TRANSACTION_ID); } + /** + * Sets the credit memo transaction ID. + * + * @param string $transactionId + * @return $this + */ + public function setTransactionId($transactionId) + { + return $this->setData(CreditmemoInterface::TRANSACTION_ID, $transactionId); + } + /** * Returns updated_at * @@ -1600,5 +1630,26 @@ class Creditmemo extends AbstractModel implements EntityInterface, CreditmemoInt { return $this->setData(CreditmemoInterface::DISCOUNT_DESCRIPTION, $description); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\CreditmemoExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\CreditmemoExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\CreditmemoExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php index 065c772b311e9da882c70a308f176ccce83c54c5..02317f4af9c974829dc5b97f77630ad19bb62322 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php @@ -31,7 +31,7 @@ class Comment extends AbstractModel implements CreditmemoCommentInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -44,7 +44,7 @@ class Comment extends AbstractModel implements CreditmemoCommentInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -56,7 +56,7 @@ class Comment extends AbstractModel implements CreditmemoCommentInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -194,5 +194,27 @@ class Comment extends AbstractModel implements CreditmemoCommentInterface { return $this->setData(CreditmemoCommentInterface::COMMENT, $comment); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\CreditmemoCommentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\CreditmemoCommentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\CreditmemoCommentExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php index ccf9b3ccba989fed845300a50c71709f395868a5..d432435aee29d49dc3ee4c36119ce5c9f30ece4a 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php @@ -45,7 +45,7 @@ class Item extends AbstractExtensibleModel implements CreditmemoItemInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -55,7 +55,7 @@ class Item extends AbstractExtensibleModel implements CreditmemoItemInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -65,7 +65,7 @@ class Item extends AbstractExtensibleModel implements CreditmemoItemInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -821,5 +821,27 @@ class Item extends AbstractExtensibleModel implements CreditmemoItemInterface { return $this->setData(CreditmemoItemInterface::WEEE_TAX_APPLIED_ROW_AMOUNT, $amount); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\CreditmemoItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\CreditmemoItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\CreditmemoItemExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index 32729252dea4a42147af1de830a84135a0004aed..106aaf473b446e5718c6e28e4c2983424bb7fd04 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -11,7 +11,6 @@ use Magento\Sales\Model\AbstractModel; use Magento\Sales\Model\EntityInterface; /** - * @method \Magento\Sales\Model\Order\Invoice setTransactionId(string $value) * @method \Magento\Sales\Model\Order\Invoice setCreatedAt(string $value) * @SuppressWarnings(PHPMD.ExcessivePublicCount) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -117,7 +116,7 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -135,7 +134,7 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -158,7 +157,7 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -1201,6 +1200,17 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface return $this->getData(InvoiceInterface::TRANSACTION_ID); } + /** + * Sets transaction_id + * + * @param string $transactionId + * @return $this + */ + public function setTransactionId($transactionId) + { + return $this->setData(InvoiceInterface::TRANSACTION_ID, $transactionId); + } + /** * Returns updated_at * @@ -1564,5 +1574,26 @@ class Invoice extends AbstractModel implements EntityInterface, InvoiceInterface { return $this->setData(InvoiceInterface::DISCOUNT_DESCRIPTION, $description); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\InvoiceExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\InvoiceExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\InvoiceExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php index 73b1007e543759b14c97f36fca337ffe3ceed9af..e1f31fa4c025719b4a95caac311b1f42fedfbe1b 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php @@ -31,7 +31,7 @@ class Comment extends AbstractModel implements InvoiceCommentInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -44,7 +44,7 @@ class Comment extends AbstractModel implements InvoiceCommentInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -56,7 +56,7 @@ class Comment extends AbstractModel implements InvoiceCommentInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -194,5 +194,27 @@ class Comment extends AbstractModel implements InvoiceCommentInterface { return $this->setData(InvoiceCommentInterface::COMMENT, $comment); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\InvoiceCommentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\InvoiceCommentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\InvoiceCommentExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Order/Invoice/Item.php index ddd89354cd33790e53b037bc50a0411c6d840f7b..60c92a7f68b0f68d61697171246020ed2d103688 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Item.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Item.php @@ -62,7 +62,7 @@ class Item extends AbstractExtensibleModel implements InvoiceItemInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -72,7 +72,7 @@ class Item extends AbstractExtensibleModel implements InvoiceItemInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -82,7 +82,7 @@ class Item extends AbstractExtensibleModel implements InvoiceItemInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -684,5 +684,26 @@ class Item extends AbstractExtensibleModel implements InvoiceItemInterface { return $this->setData(InvoiceItemInterface::BASE_HIDDEN_TAX_AMOUNT, $amount); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\InvoiceItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\InvoiceItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\InvoiceItemExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php index e91edff1ccc35b863ca87918d18715001648ee21..7fd4dc4ec38fa1681b592e496ef303e38acb8e4e 100644 --- a/app/code/Magento/Sales/Model/Order/Item.php +++ b/app/code/Magento/Sales/Model/Order/Item.php @@ -101,20 +101,20 @@ class Item extends AbstractExtensibleModel implements OrderItemInterface * * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory + * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection - * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, @@ -126,7 +126,7 @@ class Item extends AbstractExtensibleModel implements OrderItemInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -2327,5 +2327,26 @@ class Item extends AbstractExtensibleModel implements OrderItemInterface { return $this->setData(OrderItemInterface::BASE_WEEE_TAX_ROW_DISPOSITION, $baseWeeeTaxRowDisposition); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\OrderItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderItemExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index d20449aea2849382028664428b386ffa34290de8..fe65a74f1e94e07eadbae950d6364d04b43a9e54 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -8,7 +8,6 @@ namespace Magento\Sales\Model\Order; -use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Payment\Model\Info; use Magento\Sales\Api\Data\OrderPaymentInterface; @@ -101,8 +100,8 @@ class Payment extends Info implements OrderPaymentInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param AttributeValueFactory $customAttributeFactory + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory + * @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory @@ -118,8 +117,8 @@ class Payment extends Info implements OrderPaymentInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - AttributeValueFactory $customAttributeFactory, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, + \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory, @@ -139,7 +138,7 @@ class Payment extends Info implements OrderPaymentInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $paymentData, $encryptor, @@ -2572,5 +2571,26 @@ class Payment extends Info implements OrderPaymentInterface { return $this->setData(OrderPaymentInterface::ADDRESS_STATUS, $addressStatus); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\OrderPaymentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\OrderPaymentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderPaymentExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php index fde468255771fee880d6a931e79696c8a6da925e..942cf9475983eb24457bfd676c6cf216dc8f2294 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php @@ -20,7 +20,7 @@ use Magento\Sales\Api\Data\TransactionInterface; * @method \Magento\Sales\Model\Resource\Order\Payment\Transaction _getResource() * @method \Magento\Sales\Model\Resource\Order\Payment\Transaction getResource() * @method \Magento\Sales\Model\Order\Payment\Transaction setCreatedAt(string $value) - * + * @author Magento Core Team <core@magentocommerce.com> * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -111,7 +111,7 @@ class Transaction extends AbstractExtensibleModel implements TransactionInterfac * Event object prefix * * @var string - * @see \Magento\Core\Model\Absctract::$_eventPrefix + * @see \Magento\Framework\Model\AbstractModel::$_eventPrefix */ protected $_eventPrefix = 'sales_order_payment_transaction'; @@ -119,7 +119,7 @@ class Transaction extends AbstractExtensibleModel implements TransactionInterfac * Event object prefix * * @var string - * @see \Magento\Core\Model\Absctract::$_eventObject + * @see \Magento\Framework\Model\AbstractModel::$_eventObject */ protected $_eventObject = 'order_payment_transaction'; @@ -153,7 +153,7 @@ class Transaction extends AbstractExtensibleModel implements TransactionInterfac /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Sales\Model\Order\PaymentFactory $paymentFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory @@ -167,7 +167,7 @@ class Transaction extends AbstractExtensibleModel implements TransactionInterfac public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\Order\PaymentFactory $paymentFactory, \Magento\Sales\Model\OrderFactory $orderFactory, @@ -184,7 +184,7 @@ class Transaction extends AbstractExtensibleModel implements TransactionInterfac parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -1044,5 +1044,26 @@ class Transaction extends AbstractExtensibleModel implements TransactionInterfac { return $this->setData(TransactionInterface::IS_CLOSED, $isClosed); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\TransactionExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\TransactionExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index 4091779a2d5a30a73b484629b9f389e47738bd9e..51b24d4fb8946a28f8d21585e789ee561f611bb2 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -92,7 +92,7 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -109,7 +109,7 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -130,7 +130,7 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -566,6 +566,17 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa return $this->getData(ShipmentInterface::ITEMS); } + /** + * Sets items + * + * @param mixed $items + * @return $this + */ + public function setItems($items) + { + return $this->setData(ShipmentInterface::ITEMS, $items); + } + /** * Returns tracks * @@ -585,6 +596,17 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa return $this->getData(ShipmentInterface::TRACKS); } + /** + * Returns tracks + * + * @param \Magento\Sales\Api\Data\ShipmentTrackInterface[] $tracks + * @return $this + */ + public function setTracks($tracks) + { + return $this->setData(ShipmentInterface::TRACKS, $tracks); + } + /** * Returns billing_address_id * @@ -705,6 +727,17 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa return $this->getData(ShipmentInterface::COMMENTS); } + /** + * Sets comments + * + * @param \Magento\Sales\Api\Data\ShipmentCommentInterface[] $comments + * @return $this + */ + public function setComments(array $comments = null) + { + return $this->setData(ShipmentInterface::COMMENTS, $comments); + } + //@codeCoverageIgnoreStart /** * {@inheritdoc} @@ -793,5 +826,26 @@ class Shipment extends AbstractModel implements EntityInterface, ShipmentInterfa { return $this->setData(ShipmentInterface::UPDATED_AT, $timestamp); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\ShipmentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\ShipmentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\ShipmentExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php index cd39cbf1818f3889f8df0ae6f6198e980e2a5dc8..871d04fa49f472f06913b2ceb950557d7912f9db 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php @@ -31,7 +31,7 @@ class Comment extends AbstractModel implements ShipmentCommentInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -44,7 +44,7 @@ class Comment extends AbstractModel implements ShipmentCommentInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -56,7 +56,7 @@ class Comment extends AbstractModel implements ShipmentCommentInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -194,5 +194,27 @@ class Comment extends AbstractModel implements ShipmentCommentInterface { return $this->setData(ShipmentCommentInterface::COMMENT, $comment); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\ShipmentCommentExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\ShipmentCommentExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\ShipmentCommentExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Order/Shipment/Item.php index 4e0099fee1fe842f785fd3e96b3e194b2d55ea2d..099a6af8875ff0f1044198b77e118b5788448700 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Item.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Item.php @@ -46,7 +46,7 @@ class Item extends AbstractExtensibleModel implements ShipmentItemInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -56,7 +56,7 @@ class Item extends AbstractExtensibleModel implements ShipmentItemInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -66,7 +66,7 @@ class Item extends AbstractExtensibleModel implements ShipmentItemInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -364,5 +364,26 @@ class Item extends AbstractExtensibleModel implements ShipmentItemInterface { return $this->setData(ShipmentItemInterface::SKU, $sku); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\ShipmentItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\ShipmentItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\ShipmentItemExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index f8e47cd53ee210a6d297c6ac13df86edfb06dfd1..85b0e3419eca06e7e7564a9a9b57d72317fbf37a 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -52,7 +52,7 @@ class Track extends AbstractModel implements ShipmentTrackInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -66,7 +66,7 @@ class Track extends AbstractModel implements ShipmentTrackInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -79,7 +79,7 @@ class Track extends AbstractModel implements ShipmentTrackInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -380,5 +380,26 @@ class Track extends AbstractModel implements ShipmentTrackInterface { return $this->setData(ShipmentTrackInterface::CARRIER_CODE, $code); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\ShipmentTrackExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\ShipmentTrackExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Sales\Api\Data\ShipmentTrackExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Order/Status/History.php b/app/code/Magento/Sales/Model/Order/Status/History.php index 59d6c02054eb1b3b1d829969ae0dc48ff070e559..5ce6a1aa42ba7fa0a405d3174b9e06a469d276db 100644 --- a/app/code/Magento/Sales/Model/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Order/Status/History.php @@ -45,7 +45,7 @@ class History extends AbstractModel implements OrderStatusHistoryInterface /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -58,7 +58,7 @@ class History extends AbstractModel implements OrderStatusHistoryInterface public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -70,7 +70,7 @@ class History extends AbstractModel implements OrderStatusHistoryInterface parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, @@ -301,5 +301,27 @@ class History extends AbstractModel implements OrderStatusHistoryInterface { return $this->setData(OrderStatusHistoryInterface::ENTITY_NAME, $entityName); } + + /** + * {@inheritdoc} + * + * @return \Magento\Sales\Api\Data\OrderStatusHistoryExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Sales\Api\Data\OrderStatusHistoryExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Sales\Api\Data\OrderStatusHistoryExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } //@codeCoverageIgnoreEnd } diff --git a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php index 7fbc7bef512eae5ed527a9893b487ef71ef552be..c2419e03710bf69921a5d74d346a1917369ad3c7 100644 --- a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php +++ b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php @@ -180,6 +180,18 @@ abstract class AbstractCollection extends \Magento\Framework\Model\Resource\Db\C return null; } + /** + * Set search criteria. + * + * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null) + { + return $this; + } + /** * Get total count. * @@ -189,4 +201,28 @@ abstract class AbstractCollection extends \Magento\Framework\Model\Resource\Db\C { return $this->getSize(); } + + /** + * Set total count. + * + * @param int $totalCount + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setTotalCount($totalCount) + { + return $this; + } + + /** + * Set items list. + * + * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setItems(array $items = null) + { + return $this; + } } diff --git a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/Stub/OnlineMethod.php b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/Stub/OnlineMethod.php index f6145240f582a67e371f5debc9dcafa745e13135..3052b410765c572f7d308017bd8a26c46d6ad8af 100644 --- a/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/Stub/OnlineMethod.php +++ b/app/code/Magento/Sales/Test/Unit/Block/Adminhtml/Order/View/Tab/Stub/OnlineMethod.php @@ -7,6 +7,7 @@ namespace Magento\Sales\Test\Unit\Block\Adminhtml\Order\View\Tab\Stub; /** * Stub for an online payment method + * @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes() */ class OnlineMethod extends \Magento\Payment\Model\Method\AbstractMethod { diff --git a/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php b/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php index f9a38143e5023767f7936761260e61d6301e31e7..c8c3632bb160226bbf95918724fe1423fdad2755 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Email/TemplateTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + /** * Test class for \Magento\Sales\Model\Email\Template */ @@ -46,6 +48,14 @@ class TemplateTest extends \PHPUnit_Framework_TestCase ); } + protected function tearDown() + { + parent::tearDown(); + $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); + $objectManager = $magentoObjectManagerFactory->create($_SERVER); + \Magento\Framework\App\ObjectManager::setInstance($objectManager); + } + public function testIncludeTemplate() { $this->mockViewFilesystem->expects($this->once()) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php index 4aab2e8cc19f3fe1788d0e4ddeb0cdcd3c94e07d..3552bc851409baec712b24f6ff4733a0185c15c5 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php @@ -114,9 +114,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase $this->returnValue([ 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1112], - 'equal_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1112], 'big_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 3000], - 'no_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal'], ]) ); @@ -126,8 +124,6 @@ class BaseTest extends \PHPUnit_Framework_TestCase $this->assertSame( [ - 'no_order' => $total, - 'equal_order' => $total, 'other_code' => $total, 'some_code' => $total, 'big_order' => $total, diff --git a/app/code/Magento/Sales/etc/config.xml b/app/code/Magento/Sales/etc/config.xml index db812559be52ef52b237a231aa37fc1c4ceea0e1..2d42f963e6965decc5159ed82becc3fec22d25d2 100644 --- a/app/code/Magento/Sales/etc/config.xml +++ b/app/code/Magento/Sales/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <sales> <totals_sort> diff --git a/app/code/Magento/Sales/etc/frontend/page_types.xml b/app/code/Magento/Sales/etc/frontend/page_types.xml index 693807b457a00edcd950c702fbdc506cf1f84623..701945902468273674ca3f9b0b4a271794232380 100644 --- a/app/code/Magento/Sales/etc/frontend/page_types.xml +++ b/app/code/Magento/Sales/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="sales_guest_creditmemo" label="Guest Order Creditmemo View"/> <type id="sales_guest_form" label="Returns"/> <type id="sales_guest_invoice" label="Guest Order Invoice View"/> diff --git a/app/code/Magento/Sales/etc/webapi.xml b/app/code/Magento/Sales/etc/webapi.xml index bfa2d724e25a4a2fb23670f4771372ede93364b0..3acea225b21ec3373d305834fc84f60332f8d39e 100644 --- a/app/code/Magento/Sales/etc/webapi.xml +++ b/app/code/Magento/Sales/etc/webapi.xml @@ -7,7 +7,7 @@ --> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> - <route url="/V1/order/:id" method="GET"> + <route url="/V1/orders/:id" method="GET"> <service class="Magento\Sales\Api\OrderRepositoryInterface" method="get"/> <resources> <resource ref="Magento_Sales::sales" /> @@ -19,61 +19,61 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:id/status" method="GET"> + <route url="/V1/orders/:id/statuses" method="GET"> <service class="Magento\Sales\Api\OrderManagementInterface" method="getStatus"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:id/cancel" method="POST"> + <route url="/V1/orders/:id/cancel" method="POST"> <service class="Magento\Sales\Api\OrderManagementInterface" method="cancel"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:id/email" method="POST"> + <route url="/V1/orders/:id/emails" method="POST"> <service class="Magento\Sales\Api\OrderManagementInterface" method="notify"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:id/hold" method="POST"> + <route url="/V1/orders/:id/hold" method="POST"> <service class="Magento\Sales\Api\OrderManagementInterface" method="hold"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:id/unhold" method="POST"> + <route url="/V1/orders/:id/unhold" method="POST"> <service class="Magento\Sales\Api\OrderManagementInterface" method="unHold"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:id/comment" method="POST"> + <route url="/V1/orders/:id/comments" method="POST"> <service class="Magento\Sales\Api\OrderManagementInterface" method="addComment"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:id/comments" method="GET"> + <route url="/V1/orders/:id/comments" method="GET"> <service class="Magento\Sales\Api\OrderManagementInterface" method="getCommentsList"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/create" method="PUT"> + <route url="/V1/orders/create" method="PUT"> <service class="Magento\Sales\Api\OrderRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/:parent_id" method="PUT"> + <route url="/V1/orders/:parent_id" method="PUT"> <service class="Magento\Sales\Api\OrderAddressRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/invoice/:id" method="GET"> + <route url="/V1/invoices/:id" method="GET"> <service class="Magento\Sales\Api\InvoiceRepositoryInterface" method="get"/> <resources> <resource ref="Magento_Sales::sales" /> @@ -85,37 +85,37 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/invoice/:id/comments" method="GET"> + <route url="/V1/invoices/:id/comments" method="GET"> <service class="Magento\Sales\Api\InvoiceManagementInterface" method="getCommentsList"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/invoice/:id/email" method="POST"> + <route url="/V1/invoices/:id/emails" method="POST"> <service class="Magento\Sales\Api\InvoiceManagementInterface" method="notify"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/invoice/:id/void" method="POST"> + <route url="/V1/invoices/:id/void" method="POST"> <service class="Magento\Sales\Api\InvoiceManagementInterface" method="setVoid"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/invoice/:id/capture" method="POST"> + <route url="/V1/invoices/:id/capture" method="POST"> <service class="Magento\Sales\Api\InvoiceManagementInterface" method="setCapture"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/invoice/comment" method="POST"> + <route url="/V1/invoices/comments" method="POST"> <service class="Magento\Sales\Api\InvoiceCommentRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/invoice/" method="POST"> + <route url="/V1/invoices/" method="POST"> <service class="Magento\Sales\Api\InvoiceRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> @@ -145,13 +145,13 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/creditmemo/:id/email" method="POST"> + <route url="/V1/creditmemo/:id/emails" method="POST"> <service class="Magento\Sales\Api\CreditmemoManagementInterface" method="notify"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/creditmemo/comment" method="POST"> + <route url="/V1/creditmemo/:id/comments" method="POST"> <service class="Magento\Sales\Api\CreditmemoCommentRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> @@ -181,13 +181,13 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/shipment/comment" method="POST"> + <route url="/V1/shipment/:id/comments" method="POST"> <service class="Magento\Sales\Api\ShipmentCommentRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/shipment/:id/email" method="POST"> + <route url="/V1/shipment/:id/emails" method="POST"> <service class="Magento\Sales\Api\ShipmentManagementInterface" method="notify"/> <resources> <resource ref="Magento_Sales::sales" /> @@ -217,7 +217,7 @@ <resource ref="Magento_Sales::sales" /> </resources> </route> - <route url="/V1/order/" method="POST"> + <route url="/V1/orders/" method="POST"> <service class="Magento\Sales\Api\OrderRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Sales::sales" /> diff --git a/app/code/Magento/Sales/view/frontend/layout/customer_account_index.xml b/app/code/Magento/Sales/view/frontend/layout/customer_account_index.xml index 0e7620a75693e4a879a1214035c612058a6885e7..0bdf0c8d2061a6d78872dbefc128c5c294dfd570 100644 --- a/app/code/Magento/Sales/view/frontend/layout/customer_account_index.xml +++ b/app/code/Magento/Sales/view/frontend/layout/customer_account_index.xml @@ -8,7 +8,7 @@ <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> - <block class="Magento\Sales\Block\Order\Recent" name="customer_account_dashboard_top" after="customer_account_dashboard_hello" template="order/recent.phtml" cacheable="false"/> + <block class="Magento\Sales\Block\Order\Recent" name="customer_account_dashboard_top" after="customer_account_dashboard_hello" template="order/recent.phtml"/> </referenceContainer> </body> </page> 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 7210c1c06163c6209b5819fa01c9332ab032d16e..62219a6e98970d5227425d928d677e8286abae7d 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 @@ -9,10 +9,10 @@ <update handle="customer_account"/> <body> <referenceContainer name="content"> - <block class="Magento\Sales\Block\Order\History" name="sales.order.history" cacheable="false"> + <block class="Magento\Sales\Block\Order\History" name="sales.order.history"> <container name="sales.order.history.info" as="info" label="Order History Info"/> </block> - <block class="Magento\Customer\Block\Account\Dashboard" name="customer.account.link.back" template="account/link/back.phtml" cacheable="false"/> + <block class="Magento\Customer\Block\Account\Dashboard" name="customer.account.link.back" template="account/link/back.phtml"/> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml index f0218c9507c02c76c7e45d78c6301f633ef366d7..dafd6a2a61513e9716520703a32fcd34f487655b 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/history.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/history.phtml @@ -9,7 +9,7 @@ ?> <?php $_orders = $block->getOrders(); ?> <?php echo $block->getChildHtml('info');?> -<?php if ($_orders->getSize()): ?> +<?php if ($_orders && count($_orders)): ?> <div class="table-wrapper orders-history"> <table class="data table table-order-items history" id="my-orders-table"> <caption class="table-caption"><?php echo __('Orders') ?></caption> diff --git a/app/code/Magento/SalesRule/etc/config.xml b/app/code/Magento/SalesRule/etc/config.xml index 7d3da07bc36457b55840e017735b28cdc6ce1308..486f8e4073ce85fef4a2b482b0a3e09e27a618c4 100644 --- a/app/code/Magento/SalesRule/etc/config.xml +++ b/app/code/Magento/SalesRule/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <promo> <auto_generated_coupon_codes> diff --git a/app/code/Magento/Search/etc/frontend/page_types.xml b/app/code/Magento/Search/etc/frontend/page_types.xml index 0f5a1440de0ce62e107bf30c144a876c6187cb27..2c563ca5c0d1b97fcf9960c34a3656b70bbb13df 100644 --- a/app/code/Magento/Search/etc/frontend/page_types.xml +++ b/app/code/Magento/Search/etc/frontend/page_types.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="search_term_popular" label="Popular Search Terms"/> </page_types> diff --git a/app/code/Magento/Search/view/frontend/web/form-mini.js b/app/code/Magento/Search/view/frontend/web/form-mini.js index 871edd66681497704ab6ec92b93175cd352339e3..be0ae90a02a9180a79487dde5f4394d09ddb59c6 100644 --- a/app/code/Magento/Search/view/frontend/web/form-mini.js +++ b/app/code/Magento/Search/view/frontend/web/form-mini.js @@ -29,14 +29,14 @@ define([ responseFieldElements: 'ul li', selectClass: 'selected', template: - '<li class="<%= data.row_class %>" id="qs-option-<%= data.index %>" role="option">' + - '<span class="qs-option-name">' + - ' <%= data.title %>' + - '</span>' + - '<span aria-hidden="true" class="amount">' + - '<%= data.num_results %>' + - '</span>' + - '</li>', + '<li class="<%- data.row_class %>" id="qs-option-<%- data.index %>" role="option">' + + '<span class="qs-option-name">' + + ' <%- data.title %>' + + '</span>' + + '<span aria-hidden="true" class="amount">' + + '<%- data.num_results %>' + + '</span>' + + '</li>', submitBtn: 'button[type="submit"]', searchLabel: '[data-role=minisearch-label]' }, diff --git a/app/code/Magento/Sendfriend/etc/config.xml b/app/code/Magento/Sendfriend/etc/config.xml index 52d949a1036a31b5279e79a0400823a76a0356d7..6a63fb0eb3be102a68ca6cd2f40ef898c2db8f0e 100644 --- a/app/code/Magento/Sendfriend/etc/config.xml +++ b/app/code/Magento/Sendfriend/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <sendfriend> <email> diff --git a/app/code/Magento/Sendfriend/etc/frontend/page_types.xml b/app/code/Magento/Sendfriend/etc/frontend/page_types.xml index cc46efb01ddc13708d15ee4c3eca5b9d0c9de633..c4396bfb90b7c9b1338f9a7ba38e9f2093afb414 100644 --- a/app/code/Magento/Sendfriend/etc/frontend/page_types.xml +++ b/app/code/Magento/Sendfriend/etc/frontend/page_types.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="sendfriend_product_send" label="Catalog Product Email to a Friend"/> </page_types> diff --git a/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml b/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml index bac14a083a12f626d995289ef371ae24a0d10508..eb8e4f7cef56f25176d3c9f3e69a685daea9e41d 100644 --- a/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml +++ b/app/code/Magento/Sendfriend/view/frontend/templates/send.phtml @@ -15,7 +15,7 @@ <script id="add-recipient-tmpl" type="text/x-magento-template"> <div class="actions-toolbar"> <div class="secondary"> - <button type="button" id="btn-remove<%= data._index_ %>" class="action remove" + <button type="button" id="btn-remove<%- data._index_ %>" class="action remove" title="<?php echo $block->escapeJsQuote(__('Remove Recipent')) ?>"> <span><?php echo $block->escapeJsQuote(__('Remove')) ?></span> </button> @@ -23,18 +23,18 @@ </div> <fieldset class="fieldset"> <div class="field name required"> - <label for="recipients-name<%= data._index_ %>" class="label"><span><?php echo __('Name')?></span></label> + <label for="recipients-name<%- data._index_ %>" class="label"><span><?php echo __('Name')?></span></label> <div class="control"> - <input name="recipients[name][<%= data._index_ %>]" type="text" title="<?php echo __('Name') ?>" class="input-text" - id="recipients-name<%= data._index_ %>" data-validate="{required:true}"/> + <input name="recipients[name][<%- data._index_ %>]" type="text" title="<?php echo __('Name') ?>" class="input-text" + id="recipients-name<%- data._index_ %>" data-validate="{required:true}"/> </div> </div> <div class="field email required"> - <label for="recipients-email<%= data._index_ %>" class="label"><span><?php echo __('Email') ?></span></label> + <label for="recipients-email<%- data._index_ %>" class="label"><span><?php echo __('Email') ?></span></label> <div class="control"> - <input name="recipients[email][<%= data._index_ %>]" title="<?php echo __('Email') ?>" - id="recipients-email<%= data._index_ %>" type="email" class="input-text" + <input name="recipients[email][<%- data._index_ %>]" title="<?php echo __('Email') ?>" + id="recipients-email<%- data._index_ %>" type="email" class="input-text" data-validate="{required:true, 'validate-email':true}"/> </div> </div> diff --git a/app/code/Magento/Shipping/Model/Order/Track.php b/app/code/Magento/Shipping/Model/Order/Track.php index ff7167e94ab78f5bdfffbaa8ee302621cff0bf7a..3eadf958b8902664592bab8b7e67be6664e3adea 100644 --- a/app/code/Magento/Shipping/Model/Order/Track.php +++ b/app/code/Magento/Shipping/Model/Order/Track.php @@ -21,7 +21,7 @@ use Magento\Framework\Api\AttributeValueFactory; * @method string getCreatedAt() * @method \Magento\Sales\Model\Order\Shipment\Track setCreatedAt(string $value) * @method string getUpdatedAt() - * + * @method \Magento\Sales\Api\Data\ShipmentTrackExtensionInterface getExtensionAttributes() */ class Track extends \Magento\Sales\Model\Order\Shipment\Track { @@ -33,7 +33,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Framework\Stdlib\DateTime $dateTime @@ -49,7 +49,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Framework\Stdlib\DateTime $dateTime, @@ -63,7 +63,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $localeDate, $dateTime, diff --git a/app/code/Magento/Shipping/etc/config.xml b/app/code/Magento/Shipping/etc/config.xml index 6f66c2a3146755431b73eb5c20689165bb17726b..181805b665d283099c954844413036032d8e50fd 100644 --- a/app/code/Magento/Shipping/etc/config.xml +++ b/app/code/Magento/Shipping/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <shipping> <origin> diff --git a/app/code/Magento/Shipping/etc/frontend/page_types.xml b/app/code/Magento/Shipping/etc/frontend/page_types.xml index 452cfdded68cf59f1f7a25813cf69a261c0f9f8b..2b2d3f2c617a3dd0b22785a5b57ac7128180e2f5 100644 --- a/app/code/Magento/Shipping/etc/frontend/page_types.xml +++ b/app/code/Magento/Shipping/etc/frontend/page_types.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="shipping_tracking_popup" label="Shipment Tracking Popup"/> </page_types> diff --git a/app/code/Magento/Shipping/etc/module.xml b/app/code/Magento/Shipping/etc/module.xml index 999d4fa4882a9b50c971d0e22f4cca09075049c9..ff4283ad84048134a416309725404e203af77c33 100644 --- a/app/code/Magento/Shipping/etc/module.xml +++ b/app/code/Magento/Shipping/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Shipping" setup_version="2.0.0"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> <module name="Magento_Catalog"/> </sequence> diff --git a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml index 8a459c5d99ad73cbebabdd1298581ae291be70a7..bf0b417d2bd8adcde2c95cb38c2db26c8be01a5d 100644 --- a/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/templates/order/tracking.phtml @@ -64,14 +64,14 @@ require(['prototype'], function(){ <script id="track_row_template" type="text/x-magento-template"> <tr> <td class="col-carrier"> - <select name="tracking[<%= data.index %>][carrier_code]" id="trackingC<%= data.index %>" class="select carrier" disabled="disabled"> + <select name="tracking[<%- data.index %>][carrier_code]" id="trackingC<%- data.index %>" class="select carrier" disabled="disabled"> <?php foreach ($block->getCarriers() as $_code => $_name): ?> <option value="<?php echo $_code ?>"><?php echo $block->escapeHtml($_name) ?></option> <?php endforeach; ?> </select> </td> - <td class="col-title"><input class="input-text number-title" type="text" name="tracking[<%= data.index %>][title]" id="trackingT<%= data.index %>" value="" disabled="disabled" /></td> - <td class="col-number"><input class="input-text required-entry" type="text" name="tracking[<%= data.index %>][number]" id="trackingN<%= data.index %>" value="" disabled="disabled" /></td> + <td class="col-title"><input class="input-text number-title" type="text" name="tracking[<%- data.index %>][title]" id="trackingT<%- data.index %>" value="" disabled="disabled" /></td> + <td class="col-number"><input class="input-text required-entry" type="text" name="tracking[<%- data.index %>][number]" id="trackingN<%- data.index %>" value="" disabled="disabled" /></td> <td class="col-delete last"><a href="#" class="action- delete" onclick="trackingControl.deleteRow(event);return false"><span><?php echo __('Delete') ?></span></a></td> </tr> </script> diff --git a/app/code/Magento/Sitemap/etc/config.xml b/app/code/Magento/Sitemap/etc/config.xml index ff84e8eec23892526961e5ea3d0d1e11e2978af7..03e72e315546683a613d9212ecf1032f46d3c3a2 100644 --- a/app/code/Magento/Sitemap/etc/config.xml +++ b/app/code/Magento/Sitemap/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <sitemap> <limit> diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index aa9c2858d0b9d68e6243ec931d9593187061dca7..c991778c00e9d67dbc1dd0ae36810f0a49009e7a 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -3,7 +3,6 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-core": "0.42.0-beta11", "magento/module-directory": "0.42.0-beta11", "magento/module-ui": "0.42.0-beta11", "magento/module-config": "0.42.0-beta11", diff --git a/app/code/Magento/Core/etc/cache.xml b/app/code/Magento/Store/etc/cache.xml similarity index 100% rename from app/code/Magento/Core/etc/cache.xml rename to app/code/Magento/Store/etc/cache.xml diff --git a/app/code/Magento/Core/etc/config.xml b/app/code/Magento/Store/etc/config.xml similarity index 98% rename from app/code/Magento/Core/etc/config.xml rename to app/code/Magento/Store/etc/config.xml index ddfb237c0eeee1ad680280538feedeaf54542eca..0bf0f4cdb889d4590773e402854cdeb4c1ee015c 100644 --- a/app/code/Magento/Core/etc/config.xml +++ b/app/code/Magento/Store/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <default> <design> <pagination> diff --git a/app/code/Magento/Core/etc/config.xsd b/app/code/Magento/Store/etc/config.xsd similarity index 100% rename from app/code/Magento/Core/etc/config.xsd rename to app/code/Magento/Store/etc/config.xsd diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml index fdbce3aa2a3ea1180edeaa749e39eb55bfc34b7a..ebbc61f6036c8723c1fe943e07795097b63f1f6d 100644 --- a/app/code/Magento/Store/etc/di.xml +++ b/app/code/Magento/Store/etc/di.xml @@ -219,6 +219,11 @@ </argument> </arguments> </type> + <type name="Magento\Framework\Module\Setup\Migration"> + <arguments> + <argument name="confPathToMapFile" xsi:type="string">app/etc/aliases_to_classes_map.json</argument> + </arguments> + </type> <type name="Magento\Framework\Module\Setup\MigrationData"> <arguments> <argument name="data" xsi:type="array"> @@ -243,4 +248,52 @@ <argument name="cache" xsi:type="object">Magento\Framework\App\Cache\Type\Config</argument> </arguments> </type> + <type name="Magento\Framework\App\Router\Base"> + <arguments> + <argument name="routerId" xsi:type="string">standard</argument> + </arguments> + </type> + <type name="Magento\Framework\Stdlib\DateTime\Timezone"> + <arguments> + <argument name="defaultTimezonePath" xsi:type="const">Magento\Directory\Helper\Data::XML_PATH_DEFAULT_TIMEZONE</argument> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\Framework\Locale\Resolver"> + <arguments> + <argument name="defaultLocalePath" xsi:type="const">Magento\Directory\Helper\Data::XML_PATH_DEFAULT_LOCALE</argument> + <argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument> + </arguments> + </type> + <type name="Magento\Framework\App\Config\Initial\SchemaLocator"> + <arguments> + <argument name="moduleName" xsi:type="string">Magento_Store</argument> + </arguments> + </type> + <type name="Magento\Framework\DB\Helper"> + <arguments> + <argument name="modulePrefix" xsi:type="string">store</argument> + </arguments> + </type> + <type name="Magento\Framework\View\Asset\PreProcessor\Pool"> + <arguments> + <argument name="preProcessors" xsi:type="array"> + <item name="less" xsi:type="array"> + <item name="css" xsi:type="array"> + <item name="less_css" xsi:type="string">Magento\Framework\Css\PreProcessor\Less</item> + <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item> + </item> + <item name="less" xsi:type="array"> + <item name="magento_import" xsi:type="string">Magento\Framework\Less\PreProcessor\Instruction\MagentoImport</item> + <item name="import" xsi:type="string">Magento\Framework\Less\PreProcessor\Instruction\Import</item> + </item> + </item> + <item name="css" xsi:type="array"> + <item name="css" xsi:type="array"> + <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item> + </item> + </item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Store/etc/module.xml b/app/code/Magento/Store/etc/module.xml index e01760c2873fb23499154afca8c78babafef2a70..b01976513381612bc4bafddd9463531ee54ea72e 100644 --- a/app/code/Magento/Store/etc/module.xml +++ b/app/code/Magento/Store/etc/module.xml @@ -7,8 +7,5 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Store" setup_version="2.0.0"> - <sequence> - <module name="Magento_Core"/> - </sequence> </module> </config> diff --git a/app/code/Magento/Store/i18n/de_DE.csv b/app/code/Magento/Store/i18n/de_DE.csv index 144b5864e3cd87176710da0bcddbc570eb9622d4..f376d05a2c634af120f2e31c26caa9af4e97949d 100644 --- a/app/code/Magento/Store/i18n/de_DE.csv +++ b/app/code/Magento/Store/i18n/de_DE.csv @@ -10,3 +10,16 @@ Admin,Admin "Your Language","Your Language" Language,Language "Select Store","Select Store" +"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." +"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." +"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" +Layouts,Layouts +"Layout building instructions.","Layout building instructions." +"Blocks HTML output","Blocks HTML output" +"Page blocks HTML.","Page blocks HTML." +"View files fallback","View files fallback" +"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." +"View files pre-processing","View files pre-processing" +"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." +"Collections Data","Collections Data" +"Collection data files.","Collection data files." diff --git a/app/code/Magento/Store/i18n/en_US.csv b/app/code/Magento/Store/i18n/en_US.csv index 144b5864e3cd87176710da0bcddbc570eb9622d4..f376d05a2c634af120f2e31c26caa9af4e97949d 100644 --- a/app/code/Magento/Store/i18n/en_US.csv +++ b/app/code/Magento/Store/i18n/en_US.csv @@ -10,3 +10,16 @@ Admin,Admin "Your Language","Your Language" Language,Language "Select Store","Select Store" +"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." +"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." +"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" +Layouts,Layouts +"Layout building instructions.","Layout building instructions." +"Blocks HTML output","Blocks HTML output" +"Page blocks HTML.","Page blocks HTML." +"View files fallback","View files fallback" +"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." +"View files pre-processing","View files pre-processing" +"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." +"Collections Data","Collections Data" +"Collection data files.","Collection data files." diff --git a/app/code/Magento/Store/i18n/es_ES.csv b/app/code/Magento/Store/i18n/es_ES.csv index 144b5864e3cd87176710da0bcddbc570eb9622d4..f376d05a2c634af120f2e31c26caa9af4e97949d 100644 --- a/app/code/Magento/Store/i18n/es_ES.csv +++ b/app/code/Magento/Store/i18n/es_ES.csv @@ -10,3 +10,16 @@ Admin,Admin "Your Language","Your Language" Language,Language "Select Store","Select Store" +"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." +"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." +"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" +Layouts,Layouts +"Layout building instructions.","Layout building instructions." +"Blocks HTML output","Blocks HTML output" +"Page blocks HTML.","Page blocks HTML." +"View files fallback","View files fallback" +"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." +"View files pre-processing","View files pre-processing" +"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." +"Collections Data","Collections Data" +"Collection data files.","Collection data files." diff --git a/app/code/Magento/Store/i18n/fr_FR.csv b/app/code/Magento/Store/i18n/fr_FR.csv index 144b5864e3cd87176710da0bcddbc570eb9622d4..f376d05a2c634af120f2e31c26caa9af4e97949d 100644 --- a/app/code/Magento/Store/i18n/fr_FR.csv +++ b/app/code/Magento/Store/i18n/fr_FR.csv @@ -10,3 +10,16 @@ Admin,Admin "Your Language","Your Language" Language,Language "Select Store","Select Store" +"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." +"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." +"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" +Layouts,Layouts +"Layout building instructions.","Layout building instructions." +"Blocks HTML output","Blocks HTML output" +"Page blocks HTML.","Page blocks HTML." +"View files fallback","View files fallback" +"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." +"View files pre-processing","View files pre-processing" +"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." +"Collections Data","Collections Data" +"Collection data files.","Collection data files." diff --git a/app/code/Magento/Store/i18n/nl_NL.csv b/app/code/Magento/Store/i18n/nl_NL.csv index 144b5864e3cd87176710da0bcddbc570eb9622d4..f376d05a2c634af120f2e31c26caa9af4e97949d 100644 --- a/app/code/Magento/Store/i18n/nl_NL.csv +++ b/app/code/Magento/Store/i18n/nl_NL.csv @@ -10,3 +10,16 @@ Admin,Admin "Your Language","Your Language" Language,Language "Select Store","Select Store" +"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." +"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." +"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" +Layouts,Layouts +"Layout building instructions.","Layout building instructions." +"Blocks HTML output","Blocks HTML output" +"Page blocks HTML.","Page blocks HTML." +"View files fallback","View files fallback" +"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." +"View files pre-processing","View files pre-processing" +"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." +"Collections Data","Collections Data" +"Collection data files.","Collection data files." diff --git a/app/code/Magento/Store/i18n/pt_BR.csv b/app/code/Magento/Store/i18n/pt_BR.csv index 144b5864e3cd87176710da0bcddbc570eb9622d4..f376d05a2c634af120f2e31c26caa9af4e97949d 100644 --- a/app/code/Magento/Store/i18n/pt_BR.csv +++ b/app/code/Magento/Store/i18n/pt_BR.csv @@ -10,3 +10,16 @@ Admin,Admin "Your Language","Your Language" Language,Language "Select Store","Select Store" +"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." +"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." +"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" +Layouts,Layouts +"Layout building instructions.","Layout building instructions." +"Blocks HTML output","Blocks HTML output" +"Page blocks HTML.","Page blocks HTML." +"View files fallback","View files fallback" +"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." +"View files pre-processing","View files pre-processing" +"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." +"Collections Data","Collections Data" +"Collection data files.","Collection data files." diff --git a/app/code/Magento/Store/i18n/zh_CN.csv b/app/code/Magento/Store/i18n/zh_CN.csv index 144b5864e3cd87176710da0bcddbc570eb9622d4..f376d05a2c634af120f2e31c26caa9af4e97949d 100644 --- a/app/code/Magento/Store/i18n/zh_CN.csv +++ b/app/code/Magento/Store/i18n/zh_CN.csv @@ -10,3 +10,16 @@ Admin,Admin "Your Language","Your Language" Language,Language "Select Store","Select Store" +"Helper arguments should not be used in custom layout updates.","Helper arguments should not be used in custom layout updates." +"Updater model should not be used in custom layout updates.","Updater model should not be used in custom layout updates." +"Please correct the XML data and try again. %value%","Please correct the XML data and try again. %value%" +Layouts,Layouts +"Layout building instructions.","Layout building instructions." +"Blocks HTML output","Blocks HTML output" +"Page blocks HTML.","Page blocks HTML." +"View files fallback","View files fallback" +"Paths to view files (e.g., PHTML templates, images, CSS, JS files).","Paths to view files (e.g., PHTML templates, images, CSS, JS files)." +"View files pre-processing","View files pre-processing" +"Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files).","Paths to pre-processed view files (e.g, CSS files with fixed paths or generated from LESS files)." +"Collections Data","Collections Data" +"Collection data files.","Collection data files." diff --git a/app/code/Magento/Store/view/base/web/templates/filter/store/item.html b/app/code/Magento/Store/view/base/web/templates/filter/store/item.html index eb150edb32f0647dffbbbfcf7eef64758b412556..c14bb1f3b37c07e1aef319099dab6b77748e6c82 100644 --- a/app/code/Magento/Store/view/base/web/templates/filter/store/item.html +++ b/app/code/Magento/Store/view/base/web/templates/filter/store/item.html @@ -5,7 +5,7 @@ */ --> <!-- ko ifnot: 'items' in option --> - <option data-bind="attr: { label: option.label, value: option.value }"></option> + <option data-bind="attr: { label: option.label, value: option.value }, text: option.label"></option> <!-- /ko --> <!-- ko if: 'items' in option --> <optgroup data-bind="attr: { label: option.label }"></optgroup> diff --git a/app/code/Magento/Tax/Api/Data/AppliedTaxInterface.php b/app/code/Magento/Tax/Api/Data/AppliedTaxInterface.php index a447c3944a03eea781b35d21d93afa35c29665ad..356d39d0bc106519315c3fa76da8321931c116fd 100644 --- a/app/code/Magento/Tax/Api/Data/AppliedTaxInterface.php +++ b/app/code/Magento/Tax/Api/Data/AppliedTaxInterface.php @@ -78,4 +78,19 @@ interface AppliedTaxInterface extends \Magento\Framework\Api\ExtensibleDataInter * @return $this */ public function setRates(array $rates = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\AppliedTaxExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\AppliedTaxExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\AppliedTaxExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php b/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php index f0c83cbe8d469c20b964d19e17ea6b9bbec5a929..cee4ab16fd1f0acdde90bd353b3d264e4ba52b11 100644 --- a/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php +++ b/app/code/Magento/Tax/Api/Data/AppliedTaxRateInterface.php @@ -62,4 +62,19 @@ interface AppliedTaxRateInterface extends \Magento\Framework\Api\ExtensibleDataI * @return $this */ public function setPercent($percent); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/OrderTaxDetailsAppliedTaxInterface.php b/app/code/Magento/Tax/Api/Data/OrderTaxDetailsAppliedTaxInterface.php index bf8fed9966b07dce82fd5a751a98982423cb1fca..7123087eacf565f0341178e6f9643c9a98bf7036 100644 --- a/app/code/Magento/Tax/Api/Data/OrderTaxDetailsAppliedTaxInterface.php +++ b/app/code/Magento/Tax/Api/Data/OrderTaxDetailsAppliedTaxInterface.php @@ -97,4 +97,21 @@ interface OrderTaxDetailsAppliedTaxInterface extends \Magento\Framework\Api\Exte * @return $this */ public function setBaseAmount($baseAmount); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Tax/Api/Data/OrderTaxDetailsInterface.php b/app/code/Magento/Tax/Api/Data/OrderTaxDetailsInterface.php index cee19ce16af5d69f9ef3ae96a057f8f9f96a5c11..d68de6f5858aab5c3362c60d62a1d006bc22c42d 100644 --- a/app/code/Magento/Tax/Api/Data/OrderTaxDetailsInterface.php +++ b/app/code/Magento/Tax/Api/Data/OrderTaxDetailsInterface.php @@ -42,4 +42,21 @@ interface OrderTaxDetailsInterface extends \Magento\Framework\Api\ExtensibleData * @return $this */ public function setItems(array $items = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\OrderTaxDetailsExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\OrderTaxDetailsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\OrderTaxDetailsExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Tax/Api/Data/OrderTaxDetailsItemInterface.php b/app/code/Magento/Tax/Api/Data/OrderTaxDetailsItemInterface.php index 601371a4259c11b12e8bd7b383d87c6fec9aec1e..905a0aa203594097e5377130679dfb4e5bb18a92 100644 --- a/app/code/Magento/Tax/Api/Data/OrderTaxDetailsItemInterface.php +++ b/app/code/Magento/Tax/Api/Data/OrderTaxDetailsItemInterface.php @@ -80,4 +80,21 @@ interface OrderTaxDetailsItemInterface extends \Magento\Framework\Api\Extensible * @return $this */ public function setAppliedTaxes(array $appliedTaxes = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\OrderTaxDetailsItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\OrderTaxDetailsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\OrderTaxDetailsItemExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Tax/Api/Data/QuoteDetailsInterface.php b/app/code/Magento/Tax/Api/Data/QuoteDetailsInterface.php index f8e60a4cfd08e2bf84115321daa7d6ce22575e5b..f7d69e1572f86eaecfad263eeeb026ebe8f280bc 100644 --- a/app/code/Magento/Tax/Api/Data/QuoteDetailsInterface.php +++ b/app/code/Magento/Tax/Api/Data/QuoteDetailsInterface.php @@ -114,4 +114,19 @@ interface QuoteDetailsInterface extends \Magento\Framework\Api\ExtensibleDataInt * @return $this */ public function setCustomerTaxClassId($customerTaxClassId); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\QuoteDetailsExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\QuoteDetailsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\QuoteDetailsExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/QuoteDetailsItemInterface.php b/app/code/Magento/Tax/Api/Data/QuoteDetailsItemInterface.php index 212236f8d599a62de5a00475091fd3ac94a63c84..ea3e57327f3115581853572e3159628b600c31cd 100644 --- a/app/code/Magento/Tax/Api/Data/QuoteDetailsItemInterface.php +++ b/app/code/Magento/Tax/Api/Data/QuoteDetailsItemInterface.php @@ -198,4 +198,21 @@ interface QuoteDetailsItemInterface extends \Magento\Framework\Api\ExtensibleDat * @return $this */ public function setTaxClassId($taxClassId); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface $extensionAttributes + ); } diff --git a/app/code/Magento/Tax/Api/Data/TaxClassDataBuilder.php b/app/code/Magento/Tax/Api/Data/TaxClassDataBuilder.php deleted file mode 100644 index 4b8a3a4876204ebfb08f2bd42486a3bae3dbf3ec..0000000000000000000000000000000000000000 --- a/app/code/Magento/Tax/Api/Data/TaxClassDataBuilder.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Tax\Api\Data; - -/** - * DataBuilder class for \Magento\Tax\Api\Data\TaxClassInterface - * @codeCoverageIgnore - */ -class TaxClassDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * Initialize the builder - * - * @param \Magento\Framework\Api\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string|null $modelClassInterface - */ - public function __construct( - \Magento\Framework\Api\ObjectFactory $objectFactory, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = null - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - 'Magento\Tax\Api\Data\TaxClassInterface' - ); - } - - /** - * @param int|null $classId - * @return $this - */ - public function setClassId($classId) - { - $this->_set('class_id', $classId); - return $this; - } - - /** - * @param string $className - * @return $this - */ - public function setClassName($className) - { - $this->_set('class_name', $className); - return $this; - } - - /** - * @param string $classType - * @return $this - */ - public function setClassType($classType) - { - $this->_set('class_type', $classType); - return $this; - } - - /** - * {@inheritdoc} - */ - public function create() - { - $object = parent::create(); - $object->setDataChanges(true); - return $object; - } -} diff --git a/app/code/Magento/Tax/Api/Data/TaxClassInterface.php b/app/code/Magento/Tax/Api/Data/TaxClassInterface.php index 1539ea9e5c5acd739675390bc73cba9912600ab7..80774ef47c646bed3cb54e3813b7968c37536adc 100644 --- a/app/code/Magento/Tax/Api/Data/TaxClassInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxClassInterface.php @@ -62,4 +62,19 @@ interface TaxClassInterface extends \Magento\Framework\Api\ExtensibleDataInterfa * @return $this */ public function setClassType($classType); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\TaxClassExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\TaxClassExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxClassExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/TaxClassKeyInterface.php b/app/code/Magento/Tax/Api/Data/TaxClassKeyInterface.php index 709291ff35ce434f58e55ff83ae3cd8247074617..9f0a25a170cbadbd71ad8e1c1e7d7cd6de7d0c27 100644 --- a/app/code/Magento/Tax/Api/Data/TaxClassKeyInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxClassKeyInterface.php @@ -55,4 +55,19 @@ interface TaxClassKeyInterface extends ExtensibleDataInterface * @return $this */ public function setValue($value); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\TaxClassKeyExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\TaxClassKeyExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxClassKeyExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php b/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php index fbcf859e1975d9be513f72a9f0c687d1c6d0c5de..e81bb366a4d7e346aa390cf315b66af7459c5af3 100644 --- a/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php @@ -14,4 +14,12 @@ interface TaxClassSearchResultsInterface extends \Magento\Framework\Api\SearchRe * @return \Magento\Tax\Api\Data\TaxClassInterface[] */ public function getItems(); + + /** + * Set items. + * + * @param \Magento\Tax\Api\Data\TaxClassInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Tax/Api/Data/TaxDetailsInterface.php b/app/code/Magento/Tax/Api/Data/TaxDetailsInterface.php index 0c6f80296474a2211b8048fef57d5c561f6d64b3..f06ba96bc54ca28a6ed4e167d48bbc4e553dcd15 100644 --- a/app/code/Magento/Tax/Api/Data/TaxDetailsInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxDetailsInterface.php @@ -97,4 +97,19 @@ interface TaxDetailsInterface extends \Magento\Framework\Api\ExtensibleDataInter * @return $this */ public function setItems(array $items = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\TaxDetailsExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\TaxDetailsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxDetailsExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/TaxDetailsItemInterface.php b/app/code/Magento/Tax/Api/Data/TaxDetailsItemInterface.php index 8c2f50111b313df4b0c00c66c4b48f68c199bc92..fad3229d7076a589363cbabf9f5bcb064984e04f 100644 --- a/app/code/Magento/Tax/Api/Data/TaxDetailsItemInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxDetailsItemInterface.php @@ -232,4 +232,19 @@ interface TaxDetailsItemInterface extends \Magento\Framework\Api\ExtensibleDataI * @return $this */ public function setAssociatedItemCode($associatedItemCode); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\TaxDetailsItemExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\TaxDetailsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxDetailsItemExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/TaxRateDataBuilder.php b/app/code/Magento/Tax/Api/Data/TaxRateDataBuilder.php deleted file mode 100644 index b079864bb964e3f888d22af277946414b43bdbaa..0000000000000000000000000000000000000000 --- a/app/code/Magento/Tax/Api/Data/TaxRateDataBuilder.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Tax\Api\Data; - -/** - * DataBuilder class for \Magento\Tax\Api\Data\TaxRateInterface - * @codeCoverageIgnore - */ -class TaxRateDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * @param \Magento\Framework\Api\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string|null $modelClassInterface - */ - public function __construct( - \Magento\Framework\Api\ObjectFactory $objectFactory, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = null - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - 'Magento\Tax\Api\Data\TaxRateInterface' - ); - } - - /** - * @param int|null $id - * @return $this - */ - public function setId($id) - { - $this->_set('id', $id); - return $this; - } - - /** - * @param string $taxCountryId - * @return $this - */ - public function setTaxCountryId($taxCountryId) - { - $this->_set('tax_country_id', $taxCountryId); - return $this; - } - - /** - * @param int|null $taxRegionId - * @return $this - */ - public function setTaxRegionId($taxRegionId) - { - $this->_set('tax_region_id', $taxRegionId); - return $this; - } - - /** - * @param string|null $regionName - * @return $this - */ - public function setRegionName($regionName) - { - $this->_set('region_name', $regionName); - return $this; - } - - /** - * @param string|null $taxPostcode - * @return $this - */ - public function setTaxPostcode($taxPostcode) - { - $this->_set('tax_postcode', $taxPostcode); - return $this; - } - - /** - * @param int|null $zipFrom - * @return $this - */ - public function setZipFrom($zipFrom) - { - $this->_set('zip_from', $zipFrom); - return $this; - } - - /** - * @param int|null $zipTo - * @return $this - */ - public function setZipTo($zipTo) - { - $this->_set('zip_to', $zipTo); - return $this; - } - - /** - * @param float $rate - * @return $this - */ - public function setRate($rate) - { - $this->_set('rate', $rate); - return $this; - } - - /** - * @param string $code - * @return $this - */ - public function setCode($code) - { - $this->_set('code', $code); - return $this; - } - - /** - * @param \Magento\Tax\Api\Data\TaxRateTitleInterface $titles - * @return $this - */ - public function setTitles($titles) - { - $this->_set('titles', $titles); - return $this; - } - - /** - * @param int|null $zipIsRange - * @return $this - */ - public function setZipIsRange($zipIsRange) - { - $this->_set('zip_is_range', $zipIsRange); - return $this; - } - /** - * {@inheritdoc} - */ - public function create() - { - /** TODO: temporary fix while problem with hasDataChanges flag not solved. MAGETWO-30324 */ - $object = parent::create(); - $object->setDataChanges(true); - return $object; - } -} diff --git a/app/code/Magento/Tax/Api/Data/TaxRateInterface.php b/app/code/Magento/Tax/Api/Data/TaxRateInterface.php index 7e878cb77564be1ae4c687df027e8be3b77a9567..881bb7fa7e013838c558f5514af373dcbe6fceaa 100644 --- a/app/code/Magento/Tax/Api/Data/TaxRateInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxRateInterface.php @@ -189,4 +189,19 @@ interface TaxRateInterface extends \Magento\Framework\Api\ExtensibleDataInterfac * @return $this */ public function setTitles(array $titles = null); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\TaxRateExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\TaxRateExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxRateExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php b/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php index 9f834184255f86bd5c818bcb04e88574a415fd01..5d4bd3769db16b7376ff1c450c1e2b2693a3c40e 100644 --- a/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php @@ -17,4 +17,12 @@ interface TaxRateSearchResultsInterface extends SearchResultsInterface * @return \Magento\Tax\Api\Data\TaxRateInterface[] */ public function getItems(); + + /** + * Set items + * + * @param \Magento\Tax\Api\Data\TaxRateInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Tax/Api/Data/TaxRateTitleDataBuilder.php b/app/code/Magento/Tax/Api/Data/TaxRateTitleDataBuilder.php deleted file mode 100644 index dd6340ceed838a16a0da66f44d1422021d67347a..0000000000000000000000000000000000000000 --- a/app/code/Magento/Tax/Api/Data/TaxRateTitleDataBuilder.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/** - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Tax\Api\Data; - -/** - * DataBuilder class for \Magento\Tax\Api\Data\TaxRateTitleInterface - * @codeCoverageIgnore - */ -class TaxRateTitleDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * Initialize the builder - * - * @param \Magento\Framework\Api\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string|null $modelClassInterface - */ - public function __construct( - \Magento\Framework\Api\ObjectFactory $objectFactory, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = null - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - 'Magento\Tax\Api\Data\TaxRateTitleInterface' - ); - } - - /** - * @param string $storeId - * @return $this - */ - public function setStoreId($storeId) - { - $this->_set('store_id', $storeId); - return $this; - } - - /** - * @param string $value - * @return $this - */ - public function setValue($value) - { - $this->_set('value', $value); - return $this; - } - - /** - * {@inheritdoc} - */ - public function create() - { - $object = parent::create(); - $object->setDataChanges(true); - return $object; - } -} diff --git a/app/code/Magento/Tax/Api/Data/TaxRateTitleInterface.php b/app/code/Magento/Tax/Api/Data/TaxRateTitleInterface.php index 2d9ff88958b105ef78e95630fb31eed4d88d5893..8d3991070b9565d9527c7c036aca9e45864d15f4 100644 --- a/app/code/Magento/Tax/Api/Data/TaxRateTitleInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxRateTitleInterface.php @@ -47,4 +47,19 @@ interface TaxRateTitleInterface extends \Magento\Framework\Api\ExtensibleDataInt * @return string */ public function setValue($value); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\TaxRateTitleExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\TaxRateTitleExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxRateTitleExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/TaxRuleDataBuilder.php b/app/code/Magento/Tax/Api/Data/TaxRuleDataBuilder.php deleted file mode 100644 index 31908d5f58ffebf320dee99a4f97f68339f167d4..0000000000000000000000000000000000000000 --- a/app/code/Magento/Tax/Api/Data/TaxRuleDataBuilder.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Tax\Api\Data; - -/** - * DataBuilder class for \Magento\Tax\Api\Data\TaxRuleInterface - * @codeCoverageIgnore - */ -class TaxRuleDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * Initialize the builder - * - * @param \Magento\Framework\Api\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string|null $modelClassInterface - */ - public function __construct( - \Magento\Framework\Api\ObjectFactory $objectFactory, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = null - ) { - parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - 'Magento\Tax\Api\Data\TaxRuleInterface' - ); - } - - /** - * @param int|null $id - * @return $this - */ - public function setId($id) - { - $this->_set('id', $id); - return $this; - } - - /** - * @param string $code - * @return $this - */ - public function setCode($code) - { - $this->_set('code', $code); - return $this; - } - - /** - * @param int $priority - * @return $this - */ - public function setPriority($priority) - { - $this->_set('priority', $priority); - return $this; - } - - /** - * @param int $position - * @return $this - */ - public function setPosition($position) - { - $this->_set('position', $position); - return $this; - } - - /** - * @param int $customerTaxClassIds - * @return $this - */ - public function setCustomerTaxClassIds($customerTaxClassIds) - { - $this->_set('customer_tax_class_ids', $customerTaxClassIds); - return $this; - } - - /** - * @param int $productTaxClassIds - * @return $this - */ - public function setProductTaxClassIds($productTaxClassIds) - { - $this->_set('product_tax_class_ids', $productTaxClassIds); - return $this; - } - - /** - * @param int $taxRateIds - * @return $this - */ - public function setTaxRateIds($taxRateIds) - { - $this->_set('tax_rate_ids', $taxRateIds); - return $this; - } - - /** - * @param bool|null $calculateSubtotal - * @return $this - */ - public function setCalculateSubtotal($calculateSubtotal) - { - $this->_set('calculate_subtotal', $calculateSubtotal); - return $this; - } - - /** - * {@inheritdoc} - */ - public function create() - { - $object = parent::create(); - $object->setDataChanges(true); - return $object; - } -} diff --git a/app/code/Magento/Tax/Api/Data/TaxRuleInterface.php b/app/code/Magento/Tax/Api/Data/TaxRuleInterface.php index e746fd0c9f2630d266dad79383c2790fb9154b4d..67c9b6a80c65e9ad7388e9c43be71144e5ba8690 100644 --- a/app/code/Magento/Tax/Api/Data/TaxRuleInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxRuleInterface.php @@ -129,4 +129,19 @@ interface TaxRuleInterface extends ExtensibleDataInterface * @return $this */ public function setCalculateSubtotal($calculateSubtotal); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Tax\Api\Data\TaxRuleExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Tax\Api\Data\TaxRuleExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxRuleExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php b/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php index 423b714f6348874472efa0f4e78d48fac414549c..de3735efa25f49ca35ab8c7c89f417529d4d9109 100644 --- a/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php +++ b/app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php @@ -14,4 +14,12 @@ interface TaxRuleSearchResultsInterface extends \Magento\Framework\Api\SearchRes * @return \Magento\Tax\Api\Data\TaxRuleInterface[] */ public function getItems(); + + /** + * Set items + * + * @param \Magento\Tax\Api\Data\TaxRuleInterface[] $items + * @return $this + */ + public function setItems(array $items = null); } diff --git a/app/code/Magento/Tax/Model/Calculation/Rate.php b/app/code/Magento/Tax/Model/Calculation/Rate.php index bb05f8694e82f1c881fc172980ae6472c0fa093e..06e40c545eb868797a682864365c96483b28d4a1 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rate.php +++ b/app/code/Magento/Tax/Model/Calculation/Rate.php @@ -51,7 +51,7 @@ class Rate extends \Magento\Framework\Model\AbstractExtensibleModel implements \ /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param Rate\TitleFactory $taxTitleFactory @@ -64,7 +64,7 @@ class Rate extends \Magento\Framework\Model\AbstractExtensibleModel implements \ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Tax\Model\Calculation\Rate\TitleFactory $taxTitleFactory, @@ -79,7 +79,7 @@ class Rate extends \Magento\Framework\Model\AbstractExtensibleModel implements \ parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -484,4 +484,25 @@ class Rate extends \Magento\Framework\Model\AbstractExtensibleModel implements \ return $this->setData(self::KEY_TITLES, $titles); } // @codeCoverageIgnoreEnd + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\TaxRateExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\TaxRateExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxRateExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Calculation/Rate/Title.php b/app/code/Magento/Tax/Model/Calculation/Rate/Title.php index 674c59e0eff8151627db9a8a1155557692702caa..a98b220548940e240774250f868c8b1abb8c4f1d 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rate/Title.php +++ b/app/code/Magento/Tax/Model/Calculation/Rate/Title.php @@ -76,4 +76,25 @@ class Title extends \Magento\Framework\Model\AbstractExtensibleModel implements return $this->setData(self::KEY_VALUE_ID, $value); } // @codeCoverageIgnoreEnd + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\TaxRateTitleExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\TaxRateTitleExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxRateTitleExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Calculation/RateRepository.php b/app/code/Magento/Tax/Model/Calculation/RateRepository.php index be0dd027c72a4b7b76e09ebf31aa04d510cc005b..48967e8bec82aa77e6c47e7626dd4f18731c3c48 100644 --- a/app/code/Magento/Tax/Model/Calculation/RateRepository.php +++ b/app/code/Magento/Tax/Model/Calculation/RateRepository.php @@ -41,9 +41,9 @@ class RateRepository implements \Magento\Tax\Api\TaxRateRepositoryInterface protected $rateRegistry; /** - * @var \Magento\Tax\Api\Data\TaxRuleSearchResultsDataBuilder + * @var \Magento\Tax\Api\Data\TaxRuleSearchResultsInterfaceFactory */ - private $taxRateSearchResultsBuilder; + private $taxRateSearchResultsFactory; /** * @var RateFactory @@ -68,7 +68,7 @@ class RateRepository implements \Magento\Tax\Api\TaxRateRepositoryInterface /** * @param Converter $converter * @param RateRegistry $rateRegistry - * @param \Magento\Tax\Api\Data\TaxRuleSearchResultsDataBuilder $taxRateSearchResultsBuilder + * @param \Magento\Tax\Api\Data\TaxRuleSearchResultsInterfaceFactory $taxRateSearchResultsFactory * @param RateFactory $rateFactory * @param CountryFactory $countryFactory * @param RegionFactory $regionFactory @@ -77,7 +77,7 @@ class RateRepository implements \Magento\Tax\Api\TaxRateRepositoryInterface public function __construct( Converter $converter, RateRegistry $rateRegistry, - \Magento\Tax\Api\Data\TaxRuleSearchResultsDataBuilder $taxRateSearchResultsBuilder, + \Magento\Tax\Api\Data\TaxRuleSearchResultsInterfaceFactory $taxRateSearchResultsFactory, RateFactory $rateFactory, CountryFactory $countryFactory, RegionFactory $regionFactory, @@ -85,7 +85,7 @@ class RateRepository implements \Magento\Tax\Api\TaxRateRepositoryInterface ) { $this->converter = $converter; $this->rateRegistry = $rateRegistry; - $this->taxRateSearchResultsBuilder = $taxRateSearchResultsBuilder; + $this->taxRateSearchResultsFactory = $taxRateSearchResultsFactory; $this->rateFactory = $rateFactory; $this->countryFactory = $countryFactory; $this->regionFactory = $regionFactory; @@ -173,11 +173,10 @@ class RateRepository implements \Magento\Tax\Api\TaxRateRepositoryInterface $taxRate[] = $taxRateModel; } - return $this->taxRateSearchResultsBuilder + return $this->taxRateSearchResultsFactory->create() ->setItems($taxRate) ->setTotalCount($collection->getSize()) - ->setSearchCriteria($searchCriteria) - ->create(); + ->setSearchCriteria($searchCriteria); } /** diff --git a/app/code/Magento/Tax/Model/Calculation/Rule.php b/app/code/Magento/Tax/Model/Calculation/Rule.php index ddf7acb1e7afeb119dfbf3821679d99520f18966..13d287ce5da36b67ece5d16a634a1ba3a743ca44 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rule.php +++ b/app/code/Magento/Tax/Model/Calculation/Rule.php @@ -6,7 +6,7 @@ namespace Magento\Tax\Model\Calculation; use Magento\Framework\Api\AttributeValueFactory; -use Magento\Framework\Api\MetadataServiceInterface; +use Magento\Framework\Api\ExtensionAttributesFactory; use Magento\Tax\Api\Data\TaxRuleInterface; /** @@ -72,7 +72,7 @@ class Rule extends \Magento\Framework\Model\AbstractExtensibleModel implements T /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param MetadataServiceInterface $metadataService + * @param ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Tax\Model\ClassModel $taxClass * @param \Magento\Tax\Model\Calculation $calculation @@ -85,7 +85,7 @@ class Rule extends \Magento\Framework\Model\AbstractExtensibleModel implements T public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - MetadataServiceInterface $metadataService, + ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Tax\Model\ClassModel $taxClass, \Magento\Tax\Model\Calculation $calculation, @@ -99,7 +99,7 @@ class Rule extends \Magento\Framework\Model\AbstractExtensibleModel implements T parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -377,4 +377,25 @@ class Rule extends \Magento\Framework\Model\AbstractExtensibleModel implements T { return $this->setData(self::KEY_CALCULATE_SUBTOTAL, $calculateSubtotal); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\TaxRuleExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\TaxRuleExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxRuleExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/ClassModel.php b/app/code/Magento/Tax/Model/ClassModel.php index 143cb9504cecd6d4c41900b1322fe0a1b4592ba3..9835203636346d9a2d6a66a7bd2b75bf5eae09e7 100644 --- a/app/code/Magento/Tax/Model/ClassModel.php +++ b/app/code/Magento/Tax/Model/ClassModel.php @@ -37,7 +37,7 @@ class ClassModel extends \Magento\Framework\Model\AbstractExtensibleModel implem /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param TaxClass\Factory $classFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -47,7 +47,7 @@ class ClassModel extends \Magento\Framework\Model\AbstractExtensibleModel implem public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - \Magento\Framework\Api\MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Tax\Model\TaxClass\Factory $classFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, @@ -57,7 +57,7 @@ class ClassModel extends \Magento\Framework\Model\AbstractExtensibleModel implem parent::__construct( $context, $registry, - $metadataService, + $extensionFactory, $customAttributeFactory, $resource, $resourceCollection, @@ -174,4 +174,25 @@ class ClassModel extends \Magento\Framework\Model\AbstractExtensibleModel implem return $this->setData(self::KEY_TYPE, $classType); } //@codeCoverageIgnoreEnd + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\TaxClassExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\TaxClassExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxClassExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Sales/Order/Details.php b/app/code/Magento/Tax/Model/Sales/Order/Details.php index 14fce1cbbb59f4880e143b3bb22c7d435cf4666c..5161ab9fe6f7397f08cb88972033a8a6be6f6ef4 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Details.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Details.php @@ -50,4 +50,25 @@ class Details extends \Magento\Framework\Model\AbstractExtensibleModel implement { return $this->setData(self::KEY_ITEMS, $items); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\OrderTaxDetailsExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\OrderTaxDetailsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\OrderTaxDetailsExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Sales/Order/Tax.php b/app/code/Magento/Tax/Model/Sales/Order/Tax.php index d361064b51b734abd849e9fa85666789a595b120..29ce7e404f5696bcff549d3b276f6b14f6aea1d2 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Tax.php @@ -127,4 +127,26 @@ class Tax extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_BASE_AMOUNT, $baseAmount); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php b/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php index a57234e0ece611f01f39a313705f9d67613d18b5..a6b6148ed0c9eaca83d07b74c4d32f53ce3a1e74 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php @@ -94,4 +94,26 @@ class Item extends \Magento\Framework\Model\AbstractExtensibleModel implements { return $this->setData(self::KEY_APPLIED_TAXES, $appliedTaxes); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\OrderTaxDetailsItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\OrderTaxDetailsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\OrderTaxDetailsItemExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Sales/Quote/ItemDetails.php b/app/code/Magento/Tax/Model/Sales/Quote/ItemDetails.php index ca74f9f940315bd0d61dca0dda68714e530b4d2b..71d18024ea5f1a199b99ff3811fa4d82d7009ed7 100644 --- a/app/code/Magento/Tax/Model/Sales/Quote/ItemDetails.php +++ b/app/code/Magento/Tax/Model/Sales/Quote/ItemDetails.php @@ -221,4 +221,26 @@ class ItemDetails extends AbstractExtensibleModel implements QuoteDetailsItemInt { return $this->setData(QuoteDetailsItemInterface::KEY_TAX_CLASS_ID, $taxClassId); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Tax\Api\Data\QuoteDetailsItemExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/Sales/Quote/QuoteDetails.php b/app/code/Magento/Tax/Model/Sales/Quote/QuoteDetails.php index 0ebdffd3ba107668c3a02a0b1da232a27bd161df..1ef369ba40d82dfb3655926be7970e003892a152 100644 --- a/app/code/Magento/Tax/Model/Sales/Quote/QuoteDetails.php +++ b/app/code/Magento/Tax/Model/Sales/Quote/QuoteDetails.php @@ -126,4 +126,25 @@ class QuoteDetails extends AbstractExtensibleModel implements QuoteDetailsInterf { return $this->setData(QuoteDetailsInterface::CUSTOMER_TAX_CLASS_ID, $customerTaxClassId); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\QuoteDetailsExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\QuoteDetailsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\QuoteDetailsExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/TaxClass/Key.php b/app/code/Magento/Tax/Model/TaxClass/Key.php index 11ccf63e872d3fc5b0fd3264cae7610d7a24a438..085b018aa88f7ad8ba4ef5a36fea99c31f6ded54 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Key.php +++ b/app/code/Magento/Tax/Model/TaxClass/Key.php @@ -50,4 +50,25 @@ class Key extends AbstractExtensibleModel implements TaxClassKeyInterface { return $this->setData(TaxClassKeyInterface::KEY_VALUE, $value); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\TaxClassKeyExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\TaxClassKeyExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxClassKeyExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/TaxClass/Repository.php b/app/code/Magento/Tax/Model/TaxClass/Repository.php index acfd524f939eb0f22556f59939bfdecb29221758..83017d71277ddd9a7d851fc94868e8146afb3b38 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Repository.php +++ b/app/code/Magento/Tax/Model/TaxClass/Repository.php @@ -32,9 +32,9 @@ class Repository implements \Magento\Tax\Api\TaxClassRepositoryInterface protected $taxClassCollectionFactory; /** - * @var \Magento\Tax\Api\Data\TaxClassSearchResultsDataBuilder + * @var \Magento\Tax\Api\Data\TaxClassSearchResultsInterfaceFactory */ - protected $searchResultsBuilder; + protected $searchResultsFactory; /** * @var ClassModelRegistry @@ -66,7 +66,7 @@ class Repository implements \Magento\Tax\Api\TaxClassRepositoryInterface * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param FilterBuilder $filterBuilder * @param TaxClassCollectionFactory $taxClassCollectionFactory - * @param \Magento\Tax\Api\Data\TaxClassSearchResultsDataBuilder $searchResultsBuilder + * @param \Magento\Tax\Api\Data\TaxClassSearchResultsInterfaceFactory $searchResultsFactory * @param ClassModelRegistry $classModelRegistry * @param \Magento\Tax\Model\Resource\TaxClass $taxClassResource */ @@ -74,14 +74,14 @@ class Repository implements \Magento\Tax\Api\TaxClassRepositoryInterface SearchCriteriaBuilder $searchCriteriaBuilder, FilterBuilder $filterBuilder, TaxClassCollectionFactory $taxClassCollectionFactory, - \Magento\Tax\Api\Data\TaxClassSearchResultsDataBuilder $searchResultsBuilder, + \Magento\Tax\Api\Data\TaxClassSearchResultsInterfaceFactory $searchResultsFactory, ClassModelRegistry $classModelRegistry, \Magento\Tax\Model\Resource\TaxClass $taxClassResource ) { $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->filterBuilder = $filterBuilder; $this->taxClassCollectionFactory = $taxClassCollectionFactory; - $this->searchResultsBuilder = $searchResultsBuilder; + $this->searchResultsFactory = $searchResultsFactory; $this->classModelRegistry = $classModelRegistry; $this->taxClassResource = $taxClassResource; } @@ -187,13 +187,14 @@ class Repository implements \Magento\Tax\Api\TaxClassRepositoryInterface */ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) { - $this->searchResultsBuilder->setSearchCriteria($searchCriteria); + $searchResults = $this->searchResultsFactory->create(); + $searchResults->setSearchCriteria($searchCriteria); /** @var TaxClassCollection $collection */ $collection = $this->taxClassCollectionFactory->create(); foreach ($searchCriteria->getFilterGroups() as $group) { $this->addFilterGroupToCollection($group, $collection); } - $this->searchResultsBuilder->setTotalCount($collection->getSize()); + $searchResults->setTotalCount($collection->getSize()); $sortOrders = $searchCriteria->getSortOrders(); /** @var SortOrder $sortOrder */ if ($sortOrders) { @@ -206,8 +207,8 @@ class Repository implements \Magento\Tax\Api\TaxClassRepositoryInterface } $collection->setCurPage($searchCriteria->getCurrentPage()); $collection->setPageSize($searchCriteria->getPageSize()); - $this->searchResultsBuilder->setItems($collection->getItems()); - return $this->searchResultsBuilder->create(); + $searchResults->setItems($collection->getItems()); + return $searchResults; } /** diff --git a/app/code/Magento/Tax/Model/TaxDetails/AppliedTax.php b/app/code/Magento/Tax/Model/TaxDetails/AppliedTax.php index 135fada6e8e39ff474e4ddb7267d98572824f0f4..79265cacbc0c8615b0989d9deae57cb4ab6ee405 100644 --- a/app/code/Magento/Tax/Model/TaxDetails/AppliedTax.php +++ b/app/code/Magento/Tax/Model/TaxDetails/AppliedTax.php @@ -88,4 +88,25 @@ class AppliedTax extends AbstractExtensibleModel implements AppliedTaxInterface { return $this->setData(AppliedTaxInterface::KEY_RATES, $rates); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\AppliedTaxExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\AppliedTaxExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\AppliedTaxExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php b/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php index c1dddb0a87dcc834e68ff02745f6ee360dffbbbd..8cd44cb70e0e36de4ebe281b05e439e18be8312d 100644 --- a/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php +++ b/app/code/Magento/Tax/Model/TaxDetails/AppliedTaxRate.php @@ -69,4 +69,25 @@ class AppliedTaxRate extends AbstractExtensibleModel implements AppliedTaxRateIn { return $this->setData(AppliedTaxRateInterface::KEY_PERCENT, $percent); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\AppliedTaxRateExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/TaxDetails/ItemDetails.php b/app/code/Magento/Tax/Model/TaxDetails/ItemDetails.php index 711a228705ddd70c274f507d438f059f3283f6ee..9ba71b43dedf1c2bf676436e6a3754e4f168d69f 100644 --- a/app/code/Magento/Tax/Model/TaxDetails/ItemDetails.php +++ b/app/code/Magento/Tax/Model/TaxDetails/ItemDetails.php @@ -262,4 +262,25 @@ class ItemDetails extends AbstractExtensibleModel implements TaxDetailsItemInter { return $this->setData(TaxDetailsItemInterface::KEY_ASSOCIATED_ITEM_CODE, $associatedItemCode); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\TaxDetailsItemExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\TaxDetailsItemExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxDetailsItemExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/TaxDetails/TaxDetails.php b/app/code/Magento/Tax/Model/TaxDetails/TaxDetails.php index bc7c87b48209900aec99200760f3c82d37c73f7b..91f1587c8b575ce08e5f52a0196c724f40917a36 100644 --- a/app/code/Magento/Tax/Model/TaxDetails/TaxDetails.php +++ b/app/code/Magento/Tax/Model/TaxDetails/TaxDetails.php @@ -110,4 +110,25 @@ class TaxDetails extends AbstractExtensibleModel implements TaxDetailsInterface { return $this->setData(TaxDetailsInterface::KEY_ITEMS, $items); } + + /** + * {@inheritdoc} + * + * @return \Magento\Tax\Api\Data\TaxDetailsExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Tax\Api\Data\TaxDetailsExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxDetailsExtensionInterface $extensionAttributes) + { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/app/code/Magento/Tax/Model/TaxRuleRepository.php b/app/code/Magento/Tax/Model/TaxRuleRepository.php index 46884bc439f8be855271188da1525d6e92346ac4..7c7b1ed8f6cdd5ae6a0a6c3c8c232d56d8222e4a 100644 --- a/app/code/Magento/Tax/Model/TaxRuleRepository.php +++ b/app/code/Magento/Tax/Model/TaxRuleRepository.php @@ -15,7 +15,7 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\AlreadyExistsException; use Magento\Tax\Api\Data\TaxRuleInterface; use Magento\Tax\Api\TaxRuleRepositoryInterface; -use Magento\Tax\Api\Data\TaxRuleSearchResultsDataBuilder; +use Magento\Tax\Api\Data\TaxRuleSearchResultsInterfaceFactory; use Magento\Tax\Model\Calculation\RuleFactory; use Magento\Tax\Model\Calculation\TaxRuleRegistry; use Magento\Tax\Model\Resource\Calculation\Rule as Resource; @@ -33,9 +33,9 @@ class TaxRuleRepository implements TaxRuleRepositoryInterface protected $taxRuleRegistry; /** - * @var TaxRuleSearchResultsDataBuilder + * @var TaxRuleSearchResultsInterfaceFactory */ - protected $taxRuleSearchResultsBuilder; + protected $taxRuleSearchResultsFactory; /** * @var RuleFactory @@ -54,20 +54,20 @@ class TaxRuleRepository implements TaxRuleRepositoryInterface /** * @param TaxRuleRegistry $taxRuleRegistry - * @param TaxRuleSearchResultsDataBuilder $searchResultsBuilder + * @param TaxRuleSearchResultsInterfaceFactory $searchResultsFactory * @param RuleFactory $ruleFactory * @param CollectionFactory $collectionFactory * @param Resource $resource */ public function __construct( TaxRuleRegistry $taxRuleRegistry, - TaxRuleSearchResultsDataBuilder $searchResultsBuilder, + TaxRuleSearchResultsInterfaceFactory $searchResultsFactory, RuleFactory $ruleFactory, CollectionFactory $collectionFactory, Resource $resource ) { $this->taxRuleRegistry = $taxRuleRegistry; - $this->taxRuleSearchResultsBuilder = $searchResultsBuilder; + $this->taxRuleSearchResultsFactory = $searchResultsFactory; $this->taxRuleModelFactory = $ruleFactory; $this->collectionFactory = $collectionFactory; $this->resource = $resource; @@ -128,7 +128,8 @@ class TaxRuleRepository implements TaxRuleRepositoryInterface */ public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria) { - $this->taxRuleSearchResultsBuilder->setSearchCriteria($searchCriteria); + $searchResults = $this->taxRuleSearchResultsFactory->create(); + $searchResults->setSearchCriteria($searchCriteria); $fields = []; $collection = $this->collectionFactory->create(); @@ -146,7 +147,7 @@ class TaxRuleRepository implements TaxRuleRepositoryInterface } } - $this->taxRuleSearchResultsBuilder->setTotalCount($collection->getSize()); + $searchResults->setTotalCount($collection->getSize()); $sortOrders = $searchCriteria->getSortOrders(); /** @var SortOrder $sortOrder */ if ($sortOrders) { @@ -160,8 +161,8 @@ class TaxRuleRepository implements TaxRuleRepositoryInterface $collection->setCurPage($searchCriteria->getCurrentPage()); $collection->setPageSize($searchCriteria->getPageSize()); - $this->taxRuleSearchResultsBuilder->setItems($collection->getItems()); - return $this->taxRuleSearchResultsBuilder->create(); + $searchResults->setItems($collection->getItems()); + return $searchResults; } /** diff --git a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php index f07198363a36082263c877259c482b068bf7cbbf..7feff54990150d92bc3806f1399109e9410d4145 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/Calculation/RateRepositoryTest.php @@ -32,7 +32,12 @@ class RateRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - private $searchResultBuilder; + private $searchResultFactory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $searchResultMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -70,9 +75,16 @@ class RateRepositoryTest extends \PHPUnit_Framework_TestCase '', false ); - $this->searchResultBuilder = $this->getMock( - 'Magento\Tax\Api\Data\TaxRuleSearchResultsDataBuilder', - ['setItems', 'setSearchCriteria', 'setTotalCount', 'create'], + $this->searchResultFactory = $this->getMock( + 'Magento\Tax\Api\Data\TaxRuleSearchResultsInterfaceFactory', + ['create'], + [], + '', + false + ); + $this->searchResultMock = $this->getMock( + 'Magento\Tax\Api\Data\TaxRuleSearchResultsInterface', + [], [], '', false @@ -108,7 +120,7 @@ class RateRepositoryTest extends \PHPUnit_Framework_TestCase $this->model = new RateRepository( $this->rateConverterMock, $this->rateRegistryMock, - $this->searchResultBuilder, + $this->searchResultFactory, $this->rateFactoryMock, $this->countryFactoryMock, $this->regionFactoryMock, @@ -237,12 +249,12 @@ class RateRepositoryTest extends \PHPUnit_Framework_TestCase $this->rateFactoryMock->expects($this->once())->method('create')->will($this->returnValue($rateMock)); $rateMock->expects($this->any())->method('getCollection')->will($this->returnValue($collectionMock)); - $this->searchResultBuilder->expects($this->once())->method('setItems')->with($items)->willReturnSelf(); - $this->searchResultBuilder->expects($this->once())->method('setTotalCount')->with(count($items)) + $this->searchResultMock->expects($this->once())->method('setItems')->with($items)->willReturnSelf(); + $this->searchResultMock->expects($this->once())->method('setTotalCount')->with(count($items)) ->willReturnSelf(); - $this->searchResultBuilder->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock) + $this->searchResultMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock) ->willReturnSelf(); - $this->searchResultBuilder->expects($this->once())->method('create'); + $this->searchResultFactory->expects($this->once())->method('create')->willReturn($this->searchResultMock); $this->model->getList($searchCriteriaMock); } @@ -383,12 +395,12 @@ class RateRepositoryTest extends \PHPUnit_Framework_TestCase - $this->searchResultBuilder->expects($this->once())->method('setItems')->with($items)->willReturnSelf(); - $this->searchResultBuilder->expects($this->once())->method('setTotalCount')->with(count($items)) + $this->searchResultMock->expects($this->once())->method('setItems')->with($items)->willReturnSelf(); + $this->searchResultMock->expects($this->once())->method('setTotalCount')->with(count($items)) ->willReturnSelf(); - $this->searchResultBuilder->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock) + $this->searchResultMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock) ->willReturnSelf(); - $this->searchResultBuilder->expects($this->once())->method('create'); + $this->searchResultFactory->expects($this->once())->method('create')->willReturn($this->searchResultMock); $this->model->getList($searchCriteriaMock); } diff --git a/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php b/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php index f7c4cf1865adfed1f40c3bb361f6deb4097dda99..ceeb3e67917ddb6ca33c9dee676cae6d485d08b5 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/TaxClass/RepositoryTest.php @@ -20,7 +20,12 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $searchResultBuilder; + protected $searchResultFactory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $searchResultMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -45,11 +50,16 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->searchResultBuilder = $this->getMock( - '\Magento\Tax\Api\Data\TaxClassSearchResultsDataBuilder', - [ - 'setSearchCriteria', 'setTotalCount', 'setItems', 'create' - ], + $this->searchResultFactory = $this->getMock( + '\Magento\Tax\Api\Data\TaxClassSearchResultsInterfaceFactory', + ['create'], + [], + '', + false + ); + $this->searchResultMock = $this->getMock( + '\Magento\Tax\Api\Data\TaxClassSearchResultsInterface', + [], [], '', false @@ -77,7 +87,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase [ 'classModelRegistry' => $this->classModelRegistryMock, 'taxClassResource' => $this->taxClassResourceMock, - 'searchResultsBuilder' => $this->searchResultBuilder, + 'searchResultsFactory' => $this->searchResultFactory, 'taxClassCollectionFactory' => $this->taxClassCollectionFactory ] ); @@ -172,18 +182,17 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase $searchCriteria->expects($this->once())->method('getPageSize')->willReturn(20); $searchCriteria->expects($this->once())->method('getCurrentPage')->willReturn(0); - $result = $this->getMock('\Magento\Tax\Api\Data\TaxRateSearchResultsInterface'); $collection->expects($this->any())->method('getSize')->willReturn(2); $collection->expects($this->any())->method('setItems')->with([$taxClassOne, $taxClassTwo]); $collection->expects($this->once())->method('setCurPage')->with(0); $collection->expects($this->once())->method('setPageSize')->with(20); - $this->searchResultBuilder->expects($this->once())->method('setSearchCriteria')->with($searchCriteria); - $this->searchResultBuilder->expects($this->once())->method('setTotalCount')->with(2); - $this->searchResultBuilder->expects($this->once())->method('create')->willReturn($result); + $this->searchResultMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteria); + $this->searchResultMock->expects($this->once())->method('setTotalCount')->with(2); + $this->searchResultFactory->expects($this->once())->method('create')->willReturn($this->searchResultMock); $this->taxClassCollectionFactory->expects($this->once())->method('create')->willReturn($collection); - $this->assertEquals($result, $this->model->getList($searchCriteria)); + $this->assertEquals($this->searchResultMock, $this->model->getList($searchCriteria)); } public function testSave() diff --git a/app/code/Magento/Tax/Test/Unit/Model/TaxRuleRepositoryTest.php b/app/code/Magento/Tax/Test/Unit/Model/TaxRuleRepositoryTest.php index 8120f87150ace57ff612e1c3f032787c86980abd..435fa82bbe9e41c33f6fc7779bdca58eb418eb89 100644 --- a/app/code/Magento/Tax/Test/Unit/Model/TaxRuleRepositoryTest.php +++ b/app/code/Magento/Tax/Test/Unit/Model/TaxRuleRepositoryTest.php @@ -24,7 +24,12 @@ class TaxRuleRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $searchResultBuilder; + protected $searchResultFactory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $searchResultsMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -50,9 +55,16 @@ class TaxRuleRepositoryTest extends \PHPUnit_Framework_TestCase { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->taxRuleRegistry = $this->getMock('\Magento\Tax\Model\Calculation\TaxRuleRegistry', [], [], '', false); - $this->searchResultBuilder = $this->getMock( - '\Magento\Tax\Api\Data\TaxRuleSearchResultsDataBuilder', - ['setSearchCriteria', 'setTotalCount', 'setItems', 'create'], + $this->searchResultFactory = $this->getMock( + '\Magento\Tax\Api\Data\TaxRuleSearchResultsInterfaceFactory', + ['create'], + [], + '', + false + ); + $this->searchResultsMock = $this->getMock( + '\Magento\Tax\Api\Data\TaxRuleSearchResultsInterface', + [], [], '', false @@ -69,7 +81,7 @@ class TaxRuleRepositoryTest extends \PHPUnit_Framework_TestCase $this->model = new TaxRuleRepository( $this->taxRuleRegistry, - $this->searchResultBuilder, + $this->searchResultFactory, $this->ruleFactory, $this->collectionFactory, $this->resource @@ -169,7 +181,7 @@ class TaxRuleRepositoryTest extends \PHPUnit_Framework_TestCase $filterMock = $this->getMock('\Magento\Framework\Api\Filter', [], [], '', false); $sortOrderMock = $this->getMock('\Magento\Framework\Api\SortOrder', [], [], '', false); - $this->searchResultBuilder->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock); + $this->searchResultsMock->expects($this->once())->method('setSearchCriteria')->with($searchCriteriaMock); $this->collectionFactory->expects($this->once())->method('create')->willReturn($collectionMock); $searchCriteriaMock->expects($this->once())->method('getFilterGroups')->willReturn([$filterGroupMock]); $filterGroupMock->expects($this->exactly(2))->method('getFilters')->willReturn([$filterMock]); @@ -183,7 +195,7 @@ class TaxRuleRepositoryTest extends \PHPUnit_Framework_TestCase $collectionMock->expects($this->once())->method('addFieldToFilter') ->with([0 => 'rate.tax_calculation_rate_id'], [0 => ['eq' => 'value']]); $collectionMock->expects($this->once())->method('getSize')->willReturn($collectionSize); - $this->searchResultBuilder->expects($this->once())->method('setTotalCount')->with($collectionSize); + $this->searchResultsMock->expects($this->once())->method('setTotalCount')->with($collectionSize); $searchCriteriaMock->expects($this->once())->method('getSortOrders')->willReturn([$sortOrderMock]); $sortOrderMock->expects($this->once())->method('getField')->willReturn('sort_order'); $sortOrderMock->expects($this->once())->method('getDirection')->willReturn(SearchCriteria::SORT_ASC); @@ -193,8 +205,8 @@ class TaxRuleRepositoryTest extends \PHPUnit_Framework_TestCase $searchCriteriaMock->expects($this->once())->method('getPageSize')->willReturn($pageSize); $collectionMock->expects($this->once())->method('setPageSize')->with($pageSize); $collectionMock->expects($this->once())->method('getItems')->willReturn([]); - $this->searchResultBuilder->expects($this->once())->method('setItems')->with([]); - $this->searchResultBuilder->expects($this->once())->method('create')->willReturnSelf(); - $this->assertEquals($this->searchResultBuilder, $this->model->getList($searchCriteriaMock)); + $this->searchResultsMock->expects($this->once())->method('setItems')->with([]); + $this->searchResultFactory->expects($this->once())->method('create')->willReturn($this->searchResultsMock); + $this->assertEquals($this->searchResultsMock, $this->model->getList($searchCriteriaMock)); } } diff --git a/app/code/Magento/Tax/etc/config.xml b/app/code/Magento/Tax/etc/config.xml index 6bd4ac34c517bc580a1c919950cb54a5b0c6e30f..7e44459eda420838364a8c5a5b263fb61c527f04 100644 --- a/app/code/Magento/Tax/etc/config.xml +++ b/app/code/Magento/Tax/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <tax> <classes> diff --git a/app/code/Magento/Tax/etc/webapi.xml b/app/code/Magento/Tax/etc/webapi.xml index 554f6729785b7e75612a7ffdba1c5da36410555f..760734bc02b8245010faca0f050c1fb06d52deaf 100644 --- a/app/code/Magento/Tax/etc/webapi.xml +++ b/app/code/Magento/Tax/etc/webapi.xml @@ -7,31 +7,31 @@ --> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd"> - <route url="/V1/taxRate" method="POST"> + <route url="/V1/taxRates" method="POST"> <service class="Magento\Tax\Api\TaxRateRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxRate/:rateId" method="GET"> + <route url="/V1/taxRates/:rateId" method="GET"> <service class="Magento\Tax\Api\TaxRateRepositoryInterface" method="get"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxRate" method="PUT"> + <route url="/V1/taxRates" method="PUT"> <service class="Magento\Tax\Api\TaxRateRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxRate/:rateId" method="DELETE"> + <route url="/V1/taxRates/:rateId" method="DELETE"> <service class="Magento\Tax\Api\TaxRateRepositoryInterface" method="deleteById"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxRate/search" method="GET"> + <route url="/V1/taxRates/search" method="GET"> <service class="Magento\Tax\Api\TaxRateRepositoryInterface" method="getList"/> <resources> <resource ref="Magento_Tax::manage_tax"/> @@ -67,31 +67,31 @@ <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxClass" method="POST"> + <route url="/V1/taxClasses" method="POST"> <service class="Magento\Tax\Api\TaxClassRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxClass/:taxClassId" method="GET"> + <route url="/V1/taxClasses/:taxClassId" method="GET"> <service class="Magento\Tax\Api\TaxClassRepositoryInterface" method="get"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxClass/:classId" method="PUT"> + <route url="/V1/taxClasses/:classId" method="PUT"> <service class="Magento\Tax\Api\TaxClassRepositoryInterface" method="save"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxClass/:taxClassId" method="DELETE"> + <route url="/V1/taxClasses/:taxClassId" method="DELETE"> <service class="Magento\Tax\Api\TaxClassRepositoryInterface" method="deleteById"/> <resources> <resource ref="Magento_Tax::manage_tax"/> </resources> </route> - <route url="/V1/taxClass/search" method="GET"> + <route url="/V1/taxClasses/search" method="GET"> <service class="Magento\Tax\Api\TaxClassRepositoryInterface" method="getList"/> <resources> <resource ref="Magento_Tax::manage_tax"/> diff --git a/app/code/Magento/Theme/Block/Html/Topmenu.php b/app/code/Magento/Theme/Block/Html/Topmenu.php index 5588cbbd6241c96bb854328f5ef1ce76cbcfa7d4..0c2707ab477af2d3ab83b1f8923a81279b228dc5 100644 --- a/app/code/Magento/Theme/Block/Html/Topmenu.php +++ b/app/code/Magento/Theme/Block/Html/Topmenu.php @@ -149,7 +149,7 @@ class Topmenu extends Template implements IdentityInterface $colStops = $this->_columnBrake($child->getChildren(), $limit); } - $html .= '<ul class="level' . $childLevel . '">'; + $html .= '<ul class="level' . $childLevel . ' submenu">'; $html .= $this->_getHtml($child, $childrenWrapClass, $limit, $colStops); $html .= '</ul>'; diff --git a/app/code/Magento/Theme/Setup/InstallSchema.php b/app/code/Magento/Theme/Setup/InstallSchema.php index 30d5d299c21b929bafe0684d11a61cf903e558e5..f2135e0c1e4df8f03743be922c9e3aafe05026d5 100644 --- a/app/code/Magento/Theme/Setup/InstallSchema.php +++ b/app/code/Magento/Theme/Setup/InstallSchema.php @@ -157,6 +157,56 @@ class InstallSchema implements InstallSchemaInterface ); $connection->createTable($table); + /** + * Create table 'design_change' + */ + $table = $connection->newTable( + $installer->getTable('design_change') + )->addColumn( + 'design_change_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Design Change Id' + )->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store Id' + )->addColumn( + 'design', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Design' + )->addColumn( + 'date_from', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'First Date of Design Activity' + )->addColumn( + 'date_to', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Last Date of Design Activity' + )->addIndex( + $installer->getIdxName('design_change', ['store_id']), + ['store_id'] + )->addForeignKey( + $installer->getFkName('design_change', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + )->setComment( + 'Design Changes' + ); + $connection->createTable($table); + $installer->endSetup(); } diff --git a/app/code/Magento/Theme/Test/Unit/Helper/ThemeTest.php b/app/code/Magento/Theme/Test/Unit/Helper/ThemeTest.php index 94702db1b8e8f816fdbf68a7206ca3d954663bf7..a8a5e56bc49d4502110dfae453ebf42088abee17 100644 --- a/app/code/Magento/Theme/Test/Unit/Helper/ThemeTest.php +++ b/app/code/Magento/Theme/Test/Unit/Helper/ThemeTest.php @@ -54,11 +54,11 @@ class ThemeTest extends \PHPUnit_Framework_TestCase '<block class="Magento\Theme\Block\Html\Head" name="head"> <block class="Magento\Theme\Block\Html\Head\Css" name="magento-loader-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Core::test3.css</argument> + <argument name="file" xsi:type="string">Magento_Theme::test3.css</argument> </arguments> </block> </block>', - ['Magento_Core::test3.css' => 'Magento_Core::test3.css'], + ['Magento_Theme::test3.css' => 'Magento_Theme::test3.css'], ], [ '<block class="Magento\Theme\Block\Html\Head" name="head"> @@ -67,7 +67,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase </block> <block class="Magento\Theme\Block\Html\Head\Css" name="magento-loader-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Core::test.css</argument> + <argument name="file" xsi:type="string">Magento_Theme::test.css</argument> </arguments> </block> </block> @@ -76,7 +76,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase <arguments><argument name="file" xsi:type="string">testh.css</argument></arguments> </block> <block class="Magento\Theme\Block\Html\Head\Css" name="magento-loader-js"> - <arguments><argument name="file" xsi:type="string">Magento_Core::test.css</argument></arguments> + <arguments><argument name="file" xsi:type="string">Magento_Theme::test.css</argument></arguments> </block> </referenceBlock> <block type="Some_Block_Class"> @@ -85,7 +85,7 @@ class ThemeTest extends \PHPUnit_Framework_TestCase </block> <block class="Magento\Theme\Block\Html\Head\Css" name="magento-loader-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Core::testa.css</argument> + <argument name="file" xsi:type="string">Magento_Theme::testa.css</argument> </arguments> </block> </block> @@ -95,12 +95,12 @@ class ThemeTest extends \PHPUnit_Framework_TestCase </block> <block class="Magento\Theme\Block\Html\Head\Css" name="magento-loader-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Core::testb.css</argument> + <argument name="file" xsi:type="string">Magento_Theme::testb.css</argument> </arguments> </block> </referenceBlock>', [ - 'Magento_Core::test.css' => 'Magento_Core::test.css', + 'Magento_Theme::test.css' => 'Magento_Theme::test.css', 'test.css' => 'test.css', 'testh.css' => 'testh.css', ], diff --git a/app/code/Magento/Theme/Test/Unit/Model/CopyServiceTest.php b/app/code/Magento/Theme/Test/Unit/Model/CopyServiceTest.php index 345dce2e805096d552f37a6a1d20d0ba1b40a3b2..ac449f10946e47e1112a59ebf9d8e2ea08bd2876 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/CopyServiceTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/CopyServiceTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Theme\Test\Unit\Model; use Magento\Framework\App\Filesystem\DirectoryList; @@ -171,7 +174,7 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->dirWriteMock) ); - /* Init \Magento\Core\Model\Resource\Layout\Collection model */ + /* Init \Magento\Widget\Model\Resource\Layout\Update\Collection model */ $this->updateFactory = $this->getMock( 'Magento\Widget\Model\Layout\UpdateFactory', ['create'], @@ -460,6 +463,8 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase /** * cover \Magento\Theme\Model\CopyService::_copyFilesystemCustomization + * + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function testCopyFilesystemCustomization() { diff --git a/app/code/Magento/Core/Test/Unit/Model/_files/frontend/magento_iphone/theme.xml b/app/code/Magento/Theme/Test/Unit/Model/_files/frontend/magento_iphone/theme.xml similarity index 100% rename from app/code/Magento/Core/Test/Unit/Model/_files/frontend/magento_iphone/theme.xml rename to app/code/Magento/Theme/Test/Unit/Model/_files/frontend/magento_iphone/theme.xml diff --git a/app/code/Magento/Core/Test/Unit/Model/_files/frontend/magento_iphone/theme_invalid.xml b/app/code/Magento/Theme/Test/Unit/Model/_files/frontend/magento_iphone/theme_invalid.xml similarity index 100% rename from app/code/Magento/Core/Test/Unit/Model/_files/frontend/magento_iphone/theme_invalid.xml rename to app/code/Magento/Theme/Test/Unit/Model/_files/frontend/magento_iphone/theme_invalid.xml diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json index f6aaacab3492dca03a1a3b2aea9bd125a7e21437..55d1d0974c5e76385343b32781bfc3a5bf2e2784 100644 --- a/app/code/Magento/Theme/composer.json +++ b/app/code/Magento/Theme/composer.json @@ -4,7 +4,6 @@ "require": { "php": "~5.5.0|~5.6.0", "magento/module-store": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-customer": "0.42.0-beta11", "magento/module-backend": "0.42.0-beta11", "magento/module-cms": "0.42.0-beta11", diff --git a/app/code/Magento/Theme/etc/config.xml b/app/code/Magento/Theme/etc/config.xml index e6f790127c4714ac4299fcfb08eecc31f3732b9e..643a69777e24aadbb2e9c79ba4e157795b0c8811 100644 --- a/app/code/Magento/Theme/etc/config.xml +++ b/app/code/Magento/Theme/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <design> <head translate="default_description"> diff --git a/app/code/Magento/Theme/etc/module.xml b/app/code/Magento/Theme/etc/module.xml index 30b3857eac7e968aa5d74f380132d0bac84934bf..e6744b59cb8c2f7c3e27117b3e1bac698c035985 100644 --- a/app/code/Magento/Theme/etc/module.xml +++ b/app/code/Magento/Theme/etc/module.xml @@ -8,7 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Theme" setup_version="2.0.1"> <sequence> - <module name="Magento_Core"/> <module name="Magento_Store"/> </sequence> </module> diff --git a/app/code/Magento/Theme/i18n/de_DE.csv b/app/code/Magento/Theme/i18n/de_DE.csv index f94c143a9686ab7fe2a78f66b3bbb42def67285a..9ddaaa6a018d2d00c8c04113bd7028bef6f579c6 100644 --- a/app/code/Magento/Theme/i18n/de_DE.csv +++ b/app/code/Magento/Theme/i18n/de_DE.csv @@ -135,3 +135,8 @@ Copyright,Copyright "2 columns with right bar","2 Spalten mit rechter Leiste" "3 columns","3 Spalten" "Skip to content","Skip to content" +"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." +"Start date cannot be greater than end date.","Das Anfangsdatum darf nicht nach dem Enddatum liegen." +"Your design change for the specified store intersects with another one, please specify another date range.","Ihre Design-Änderung für den ausgewählten Store überschneidet sich mit einer anderen, bitte wählen Sie einen anderen Zeitraum." +Copy,Copy +"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" diff --git a/app/code/Magento/Theme/i18n/en_US.csv b/app/code/Magento/Theme/i18n/en_US.csv index 4c98001e69bfe1572a7976f2ebe48d582ee71105..f95ee406e76baa20811c5c1907af603b1be44df9 100644 --- a/app/code/Magento/Theme/i18n/en_US.csv +++ b/app/code/Magento/Theme/i18n/en_US.csv @@ -135,3 +135,8 @@ Copyright,Copyright "2 columns with right bar","2 columns with right bar" "3 columns","3 columns" "Skip to content","Skip to content" +"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." +"Start date cannot be greater than end date.","Start date cannot be greater than end date." +"Your design change for the specified store intersects with another one, please specify another date range.","Your design change for the specified store intersects with another one, please specify another date range." +Copy,Copy +"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" diff --git a/app/code/Magento/Theme/i18n/es_ES.csv b/app/code/Magento/Theme/i18n/es_ES.csv index 1a4040a9d1cb87410018cf9ce43491ebbf0322c6..7a46dedc66d9d59affa3a794493f078a16c87e6d 100644 --- a/app/code/Magento/Theme/i18n/es_ES.csv +++ b/app/code/Magento/Theme/i18n/es_ES.csv @@ -135,3 +135,8 @@ Copyright,Copyright "2 columns with right bar","2 columnas con barra a la derecha" "3 columns","3 columnas" "Skip to content","Skip to content" +"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." +"Start date cannot be greater than end date.","La fecha de inicio no puede ser mayor que la de fin." +"Your design change for the specified store intersects with another one, please specify another date range.","Su cambio de diseño para la tienda especificada se superpone con otro. Especifique otro rango de fecha." +Copy,Copy +"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" diff --git a/app/code/Magento/Theme/i18n/fr_FR.csv b/app/code/Magento/Theme/i18n/fr_FR.csv index 62ff62757e9afd534ca8ac33d31dfb84a3e59a0a..3747f950596d312e4e1f0a11d2c5d8849a88b4d7 100644 --- a/app/code/Magento/Theme/i18n/fr_FR.csv +++ b/app/code/Magento/Theme/i18n/fr_FR.csv @@ -135,3 +135,8 @@ Copyright,Copyright "2 columns with right bar","2 colonnes avec barre droite" "3 columns","3 colonnes" "Skip to content","Skip to content" +"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." +"Start date cannot be greater than end date.","La date de début ne peut pas être après la date de fin." +"Your design change for the specified store intersects with another one, please specify another date range.","Votre changement de dessin pour la boutique spécifiée se mélange à une autre, veuillez spécifier une autre fourchette de dates." +Copy,Copy +"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" diff --git a/app/code/Magento/Theme/i18n/nl_NL.csv b/app/code/Magento/Theme/i18n/nl_NL.csv index ccd1f5f63163a0157c5ec117af651680df90fe9d..d5197adbe59b97f1dc56295548afa765cad56feb 100644 --- a/app/code/Magento/Theme/i18n/nl_NL.csv +++ b/app/code/Magento/Theme/i18n/nl_NL.csv @@ -135,3 +135,8 @@ Copyright,Copyright "2 columns with right bar","2 kolommen met rechterbalk" "3 columns","3 kolommen" "Skip to content","Skip to content" +"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." +"Start date cannot be greater than end date.","Begin datum kan niet later zijn dan eind datum." +"Your design change for the specified store intersects with another one, please specify another date range.","Uw ontwerp verandering voor de gespecificeerde store komt in conflict met een andere, specificeer a.u.b. een andere datumrange." +Copy,Copy +"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" diff --git a/app/code/Magento/Theme/i18n/pt_BR.csv b/app/code/Magento/Theme/i18n/pt_BR.csv index 0077e120ba4baa381f81b939acf52d96e6fcafb2..94aee8c839430e4a3704054cc9409b18b4f471d5 100644 --- a/app/code/Magento/Theme/i18n/pt_BR.csv +++ b/app/code/Magento/Theme/i18n/pt_BR.csv @@ -135,3 +135,8 @@ Copyright,Copyright "2 columns with right bar","2 colunas com barra à direita" "3 columns","3 colunas" "Skip to content","Skip to content" +"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." +"Start date cannot be greater than end date.","Data de inÃcio não pode ser maior que a data do término." +"Your design change for the specified store intersects with another one, please specify another date range.","Sua mudança de design para a loja especificada cruza com outra, por favor especifique outro intervalo de datas." +Copy,Copy +"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" diff --git a/app/code/Magento/Theme/i18n/zh_CN.csv b/app/code/Magento/Theme/i18n/zh_CN.csv index da8737f17e11a5d9698c184561a38ac90e349abe..603295168ee776fac9e4f7eb8a611971c2e13ef5 100644 --- a/app/code/Magento/Theme/i18n/zh_CN.csv +++ b/app/code/Magento/Theme/i18n/zh_CN.csv @@ -135,3 +135,8 @@ Copyright,Copyright "2 columns with right bar",2æ 带å³è¾¹æ "3 columns",3æ "Skip to content","Skip to content" +"Invalid regular expression: ""%1"".","Invalid regular expression: ""%1""." +"Start date cannot be greater than end date.",开始日期ä¸èƒ½å¤§äºŽç»“æŸæ—¥æœŸã€‚ +"Your design change for the specified store intersects with another one, please specify another date range.",您对指定商店设计的更改和å¦ä¸€ä¸ªæœ‰äº¤å‰ï¼Œè¯·é‡æ–°æŒ‡å®šæ—¥æœŸèŒƒå›´ã€‚ +Copy,Copy +"Circular-reference in theme inheritance detected for ""%1""","Circular-reference in theme inheritance detected for ""%1""" diff --git a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml index c30c20621a55d0ae499550ca08fa9420d6b29681..abf12c73a6175da7bbbc2e323bedd8cafca1f799 100644 --- a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml @@ -16,8 +16,8 @@ </span> <div class="clear"></div> <script id="<?php echo $block->getHtmlId() ?>-template" type="text/x-magento-template"> - <div id="<%= data.id %>" class="file-row"> - <span class="file-info"><%= data.name %> (<%= data.size %>)</span> + <div id="<%- data.id %>" class="file-row"> + <span class="file-info"><%- data.name %> (<%- data.size %>)</span> <div class="progressbar-container"> <div class="progressbar upload-progress" style="width: 0%;"></div> </div> diff --git a/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml b/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml index ca432b1c21343c875608ee697352cf2b46fe332c..65788230276d58d3017169553972d7a84fb1198f 100644 --- a/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml +++ b/app/code/Magento/Theme/view/adminhtml/templates/tabs/fieldset/js.phtml @@ -9,8 +9,8 @@ <div id="js-file-uploader" class="uploader"> </div> <script id="js-file-uploader-template" type="text/x-magento-template"> - <div id="<%= data.id %>" class="file-row"> - <span class="file-info"><%= data.name %> (<%= data.size %>)</span> + <div id="<%- data.id %>" class="file-row"> + <span class="file-info"><%- data.name %> (<%- data.size %>)</span> <div class="progressbar-container"> <div class="progressbar upload-progress" style="width: 0%;"></div> </div> @@ -20,21 +20,21 @@ <script id="js-uploaded-file-template" type="text/x-magento-template"> <input class="up" type="button" value=""> <input class="down" type="button" value=""> - <input type="hidden" name="js_order[<%= data.id %>]" value="1"> + <input type="hidden" name="js_order[<%- data.id %>]" value="1"> <div class="js-file"> - <%= data.name %> + <%- data.name %> <div class="remove-js"> <input type="checkbox" - id="remove_js_files_<%= data.id %>" + id="remove_js_files_<%- data.id %>" name="js_removed_files[]" - value="<%= data.id %>" /> - <label for="remove_js_files_<%= data.id %>"><?php echo __('Remove') ?></label> + value="<%- data.id %>" /> + <label for="remove_js_files_<%- data.id %>"><?php echo __('Remove') ?></label> </div> </div> - <input type="hidden" name="js_uploaded_files[]" value="<%= data.temporary %>" /> + <input type="hidden" name="js_uploaded_files[]" value="<%- data.temporary %>" /> </script> <ul id="js-files-container" class="js-files-container ui-sortable" ></ul> diff --git a/app/code/Magento/Translation/Block/Js.php b/app/code/Magento/Translation/Block/Js.php index dcf8f7156231b72655edf18db7832d47e7c02f16..f79360f534bab736536bdadb8a99d31c3809cb96 100644 --- a/app/code/Magento/Translation/Block/Js.php +++ b/app/code/Magento/Translation/Block/Js.php @@ -6,50 +6,37 @@ namespace Magento\Translation\Block; -use Magento\Framework\Translate\InlineInterface as InlineTranslator; -use Magento\Translation\Model\Js as DataProvider; use Magento\Framework\View\Element\Template; +use Magento\Translation\Model\Js\Config; -class Js extends \Magento\Framework\View\Element\Template +class Js extends Template { /** - * Data provider model - * - * @var DataProvider - */ - protected $dataProvider; - - /** - * Inline translator - * - * @var InlineTranslator + * @var Config */ - protected $translateInline; + protected $config; /** * @param Template\Context $context - * @param DataProvider $dataProvider - * @param InlineTranslator $translateInline + * @param Config $config * @param array $data */ public function __construct( Template\Context $context, - DataProvider $dataProvider, - InlineTranslator $translateInline, + Config $config, array $data = [] ) { parent::__construct($context, $data); - $this->dataProvider = $dataProvider; - $this->translateInline = $translateInline; + $this->config = $config; } /** - * @return string + * Is js translation set to dictionary mode + * + * @return bool */ - public function getTranslatedJson() + public function dictionaryEnabled() { - $data = $this->dataProvider->getTranslateData(); - $this->translateInline->processResponseBody($data); - return \Zend_Json::encode($data); + return $this->config->dictionaryEnabled(); } } diff --git a/app/code/Magento/Translation/Model/Js.php b/app/code/Magento/Translation/Model/Js.php deleted file mode 100644 index ca4bc45b96058712719e24c223c78dec3e8dcd38..0000000000000000000000000000000000000000 --- a/app/code/Magento/Translation/Model/Js.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Translation\Model; - -class Js -{ - /** - * Translation data - * - * @var string[] - */ - protected $translateData; - - /** - * @param Js\DataProviderInterface[] $dataProviders - */ - public function __construct(array $dataProviders) - { - /** @var $dataProvider Js\DataProviderInterface */ - foreach ($dataProviders as $dataProvider) { - foreach ($dataProvider->getData() as $key => $translatedText) { - if ($key !== $translatedText) { - $this->translateData[$key] = $translatedText; - } - } - } - } - - /** - * Get translated data - * - * @return string[] - */ - public function getTranslateData() - { - return $this->translateData; - } -} diff --git a/app/code/Magento/Translation/Model/Js/Config.php b/app/code/Magento/Translation/Model/Js/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..6dc1abb699d9acdc90d6325fad535150d4b09187 --- /dev/null +++ b/app/code/Magento/Translation/Model/Js/Config.php @@ -0,0 +1,98 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Model\Js; + +use Magento\Framework\Translate\Js\Config as FrameworkJsConfig; +use Magento\Framework\App\Config\ScopeConfigInterface; + +/** + * Js Translation config + */ +class Config extends FrameworkJsConfig +{ + /** + * Both translation strategies are disabled + */ + const NO_TRANSLATION = 'none'; + + /** + * Strategy when all js files are translated while publishing + */ + const EMBEDDED_STRATEGY = 'embedded'; + + /** + * Strategy when dictionary is generated for dynamic translation + */ + const DICTIONARY_STRATEGY = 'dictionary'; + + /** + * Configuration path to translation strategy + */ + const XML_PATH_STRATEGY = 'dev/js/translate_strategy'; + + /** + * Dictionary file name + */ + const DICTIONARY_FILE_NAME = 'js-translation.json'; + + /** + * Core store config + * + * @var ScopeConfigInterface + */ + protected $scopeConfig; + + /** + * Patterns to match strings for translation + * + * @var string[] + */ + protected $patterns; + + /** + * @param ScopeConfigInterface $scopeConfig + * @param string[] $patterns + */ + public function __construct(ScopeConfigInterface $scopeConfig, array $patterns) + { + $this->scopeConfig = $scopeConfig; + $this->patterns = $patterns; + parent::__construct( + $this->scopeConfig->getValue(self::XML_PATH_STRATEGY) == self::DICTIONARY_STRATEGY, + self::DICTIONARY_FILE_NAME + ); + } + + /** + * Is Embedded Strategy selected + * + * @return bool + */ + public function isEmbeddedStrategy() + { + return ($this->scopeConfig->getValue(self::XML_PATH_STRATEGY) == self::EMBEDDED_STRATEGY); + } + + /** + * Is Dictionary Strategy selected + * + * @return bool + */ + public function dictionaryEnabled() + { + return ($this->scopeConfig->getValue(self::XML_PATH_STRATEGY) == self::DICTIONARY_STRATEGY); + } + + /** + * Retrieve translation patterns + * + * @return string[] + */ + public function getPatterns() + { + return $this->patterns; + } +} diff --git a/app/code/Magento/Translation/Model/Js/Config/Source/Strategy.php b/app/code/Magento/Translation/Model/Js/Config/Source/Strategy.php new file mode 100644 index 0000000000000000000000000000000000000000..30f1b0fe8e9a01fb9838002561820e11986c43cc --- /dev/null +++ b/app/code/Magento/Translation/Model/Js/Config/Source/Strategy.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Model\Js\Config\Source; + +use Magento\Translation\Model\Js\Config; + +class Strategy implements \Magento\Framework\Option\ArrayInterface +{ + /** + * {@inheritdoc} + */ + public function toOptionArray() + { + return [ + ['label' => __('None (Translation is disabled)'), 'value' => Config::NO_TRANSLATION], + ['label' => __('Dictionary (Translation on frontend side)'), 'value' => Config::DICTIONARY_STRATEGY], + ['label' => __('Embedded (Translation on backend side)'), 'value' => Config::EMBEDDED_STRATEGY] + ]; + } +} diff --git a/app/code/Magento/Translation/Model/Js/DataProvider.php b/app/code/Magento/Translation/Model/Js/DataProvider.php index 317dc602a3c7abc55998972f72d9b9f4b8450027..a9a83fcf8d6b35d942c43313f9d6204f2c087577 100644 --- a/app/code/Magento/Translation/Model/Js/DataProvider.php +++ b/app/code/Magento/Translation/Model/Js/DataProvider.php @@ -4,164 +4,109 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Translation\Model\Js; +use Magento\Framework\App\Utility\Files; +use Magento\Framework\App\State; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\App\Filesystem\DirectoryList; + +/** + * DataProvider for js translation + */ class DataProvider implements DataProviderInterface { + /** + * Application state + * + * @var State + */ + protected $appState; + + /** + * Js translation configuration + * + * @var Config + */ + protected $config; + + /** + * Files utility + * + * @var Files + */ + protected $filesUtility; + + /** + * Filesystem + * + * @var ReadInterface + */ + protected $rootDirectory; + + /** + * @param State $appState + * @param Config $config + * @param Filesystem $filesystem + * @param Files $filesUtility + */ + public function __construct(State $appState, Config $config, Filesystem $filesystem, Files $filesUtility = null) + { + $this->appState = $appState; + $this->config = $config; + $this->rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT); + $this->filesUtility = (null !== $filesUtility) ? $filesUtility : new Files(BP); + } + /** * Get translation data * + * @param string $themePath * @return string[] - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @throws \Exception + * @throws \Magento\Framework\Exception */ - public function getData() + public function getData($themePath) { - return [ - 'Complete' => __('Complete'), - 'Upload Security Error' => __('Upload Security Error'), - 'Upload HTTP Error' => __('Upload HTTP Error'), - 'Upload I/O Error' => __('Upload I/O Error'), - 'SSL Error: Invalid or self-signed certificate' => __('SSL Error: Invalid or self-signed certificate'), - 'TB' => __('TB'), - 'GB' => __('GB'), - 'MB' => __('MB'), - 'kB' => __('kB'), - 'B' => __('B'), - 'Add Products' => __('Add Products'), - 'Add Products By SKU' => __('Add Products By SKU'), - 'Insert Widget...' => __('Insert Widget...'), - 'Please wait, loading...' => __('Please wait, loading...'), - 'HTML tags are not allowed' => __('HTML tags are not allowed'), - 'Please select an option.' => __('Please select an option.'), - 'This is a required field.' => __('This is a required field.'), - 'Please enter a valid number in this field.' => __('Please enter a valid number in this field.'), - 'The value is not within the specified range.' => __('The value is not within the specified range.'), - 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.' => __('Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.'), - 'Please use letters only (a-z or A-Z) in this field.' => __('Please use letters only (a-z or A-Z) in this field.'), - 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.' => __('Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'), - 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.' => __('Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'), - 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.' => __('Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.'), - 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.' => __('Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.'), - 'Please enter a valid date.' => __('Please enter a valid date.'), - 'The From Date value should be less than or equal to the To Date value.' => __('The From Date value should be less than or equal to the To Date value.'), - 'Please enter a valid email address. For example johndoe@domain.com.' => __('Please enter a valid email address. For example johndoe@domain.com.'), - 'Please use only visible characters and spaces.' => __('Please use only visible characters and spaces.'), - 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.' => __('Please enter 6 or more characters. Leading or trailing spaces will be ignored.'), - 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.' => __('Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.'), - 'Please make sure your passwords match.' => __('Please make sure your passwords match.'), - 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)' => __('Please enter a valid URL. Protocol is required (http://, https:// or ftp://)'), - 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".' => __('Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".'), - 'Please enter a valid XML-identifier. For example something_1, block5, id-4.' => __('Please enter a valid XML-identifier. For example something_1, block5, id-4.'), - 'Please enter a valid social security number. For example 123-45-6789.' => __('Please enter a valid social security number. For example 123-45-6789.'), - 'Please enter a valid zip code. For example 90602 or 90602-1234.' => __('Please enter a valid zip code. For example 90602 or 90602-1234.'), - 'Please enter a valid zip code.' => __('Please enter a valid zip code.'), - 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.' => __('Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.'), - 'Please select one of the above options.' => __('Please select one of the above options.'), - 'Please select one of the options.' => __('Please select one of the options.'), - 'Please select State/Province.' => __('Please select State/Province.'), - 'Please enter a number greater than 0 in this field.' => __('Please enter a number greater than 0 in this field.'), - 'Please enter a number 0 or greater in this field.' => __('Please enter a number 0 or greater in this field.'), - 'Please enter a valid credit card number.' => __('Please enter a valid credit card number.'), - 'Credit card number does not match credit card type.' => __('Credit card number does not match credit card type.'), - 'Card type does not match credit card number.' => __('Card type does not match credit card number.'), - 'Incorrect credit card expiration date.' => __('Incorrect credit card expiration date.'), - 'Please enter a valid credit card verification number.' => __('Please enter a valid credit card verification number.'), - 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.' => __('Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'), - 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.' => __('Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.'), - 'Text length does not satisfy specified text range.' => __('Text length does not satisfy specified text range.'), - 'Please enter a number lower than 100.' => __('Please enter a number lower than 100.'), - 'Please select a file' => __('Please select a file'), - 'Please enter issue number or start date for switch/solo card type.' => __('Please enter issue number or start date for switch/solo card type.'), - 'This date is a required value.' => __('This date is a required value.'), - 'Please enter a valid day (1-%1).' => __('Please enter a valid day (1-%1).'), - 'Please enter a valid month (1-12).' => __('Please enter a valid month (1-12).'), - 'Please enter a valid year (1900-%1).' => __('Please enter a valid year (1900-%1).'), - 'Please enter a valid full date' => __('Please enter a valid full date'), - 'Allow' => __('Allow'), - 'Activate' => __('Activate'), - 'Reauthorize' => __('Reauthorize'), - 'Cancel' => __('Cancel'), - 'Done' => __('Done'), - 'Save' => __('Save'), - 'File extension not known or unsupported type.' => __('File extension not known or unsupported type.'), - 'Configure Product' => __('Configure Product'), - 'OK' => __('OK'), - 'Gift Options for ' => __('Gift Options for '), - 'New Option' => __('New Option'), - 'Add Products to New Option' => __('Add Products to New Option'), - 'Add Products to Option "%1"' => __('Add Products to Option "%1"'), - 'Add Selected Products' => __('Add Selected Products'), - 'Select type of option.' => __('Select type of option.'), - 'Please add rows to option.' => __('Please add rows to option.'), - 'Select Product' => __('Select Product'), - 'Import' => __('Import'), - 'Please select items.' => __('Please select items.'), - 'Add Products to Group' => __('Add Products to Group'), - 'start typing to search category' => __('start typing to search category'), - 'Choose existing category.' => __('Choose existing category.'), - 'Create Category' => __('Create Category'), - 'Sorry, there was an unknown error.' => __('Sorry, there was an unknown error.'), - 'Something went wrong while loading the theme.' => __('Something went wrong while loading the theme.'), - 'We don\'t recognize or support this file extension type.' => __('We don\'t recognize or support this file extension type.'), - 'Error' => __('Error'), - 'No stores were reassigned.' => __('No stores were reassigned.'), - 'Assign theme to your live store-view:' => __('Assign theme to your live store-view:'), - 'Default title' => __('Default title'), - 'The URL to assign stores is not defined.' => __('The URL to assign stores is not defined.'), - 'No' => __('No'), - 'Yes' => __('Yes'), - 'Some problem with revert action' => __('Some problem with revert action'), - 'Error: unknown error.' => __('Error: unknown error.'), - 'Some problem with save action' => __('Some problem with save action'), - 'Delete' => __('Delete'), - 'Folder' => __('Folder'), - 'Delete Folder' => __('Delete Folder'), - 'Are you sure you want to delete the folder named' => __('Are you sure you want to delete the folder named'), - 'Delete File' => __('Delete File'), - 'Method ' => __('Method '), - 'Please wait...' => __('Please wait...'), - 'Loading...' => __('Loading...'), - 'Translate' => __('Translate'), - 'Submit' => __('Submit'), - 'Close' => __('Close'), - 'Please enter a value less than or equal to %s.' => __('Please enter a value less than or equal to %s.'), - 'Please enter a value greater than or equal to %s.' => __('Please enter a value greater than or equal to %s.'), - 'Maximum length of this field must be equal or less than %1 symbols.' => __('Maximum length of this field must be equal or less than %1 symbols.'), - 'No records found.' => __('No records found.'), - 'Recent items' => __('Recent items'), - 'Show all...' => __('Show all...'), - 'Please enter a date in the past.' => __('Please enter a date in the past.'), - 'Please enter a date between %min and %max.' => __('Please enter a date between %min and %max.'), - 'Please choose to register or to checkout as a guest.' => __('Please choose to register or to checkout as a guest.'), - 'We are not able to ship to the selected shipping address. Please choose another address or edit the current address.' => __('We are not able to ship to the selected shipping address. Please choose another address or edit the current address.'), - 'Please specify a shipping method.' => __('Please specify a shipping method.'), - 'We can\'t complete your order because you don\'t have a payment method available.' => __('We can\'t complete your order because you don\'t have a payment method available.'), - 'Error happened while creating wishlist. Please try again later' => __('Error happened while creating wishlist. Please try again later'), - 'You must select items to move' => __('You must select items to move'), - 'You must select items to copy' => __('You must select items to copy'), - 'You are about to delete your wish list. This action cannot be undone. Are you sure you want to continue?' => __('You are about to delete your wish list. This action cannot be undone. Are you sure you want to continue?'), - 'Please specify payment method.' => __('Please specify payment method.'), - 'Are you sure you want to delete this address?' => __('Are you sure you want to delete this address?'), - 'Use gift registry shipping address' => __('Use gift registry shipping address'), - 'You can change the number of gift registry items on the Gift Registry Info page or directly in your cart, but not while in checkout.' => __('You can change the number of gift registry items on the Gift Registry Info page or directly in your cart, but not while in checkout.'), - 'No confirmation' => __('No confirmation'), - 'Sorry, something went wrong.' => __('Sorry, something went wrong.'), - 'Sorry, something went wrong. Please try again later.' => __('Sorry, something went wrong. Please try again later.'), - 'select all' => __('select all'), - 'unselect all' => __('unselect all'), - 'Please agree to all Terms and Conditions before placing the orders.' => __('Please agree to all Terms and Conditions before placing the orders.'), - 'Please choose to register or to checkout as a guest' => __('Please choose to register or to checkout as a guest'), - 'Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.' => __('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.'), - 'Please specify shipping method.' => __('Please specify shipping method.'), - 'Your order cannot be completed at this time as there is no payment methods available for it.' => __('Your order cannot be completed at this time as there is no payment methods available for it.'), - 'Edit Order' => __('Edit Order'), - 'Ok' => __('Ok'), - 'Please specify at least one search term.' => __('Please specify at least one search term.'), - 'Create New Wish List' => __('Create New Wish List'), - 'Click Details for more required fields.' => __('Click Details for more required fields.'), - 'Incl. Tax' => __('Incl. Tax'), - ]; + $dictionary = []; + + $files = $this->filesUtility->getJsFiles($this->appState->getAreaCode(), $themePath); + foreach ($files as $filePath) { + $content = $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($filePath[0])); + foreach ($this->getPhrases($content) as $phrase) { + $translatedPhrase = (string) __($phrase); + if ($phrase != $translatedPhrase) { + $dictionary[$phrase] = $translatedPhrase; + } + } + } + + return $dictionary; + } + + /** + * Parse content for entries to be translated + * + * @param string $content + * @return string[] + * @throws \Exception + */ + protected function getPhrases($content) + { + $phrases = []; + foreach ($this->config->getPatterns() as $pattern) { + $result = preg_match_all($pattern, $content, $matches); + + if ($result) { + $phrases = array_merge($phrases, $matches[1]); + } + if (false === $result) { + throw new \Exception( + sprintf('Error while generating js translation dictionary: "%s"', error_get_last()) + ); + } + } + return $phrases; } } diff --git a/app/code/Magento/Translation/Model/Js/DataProviderInterface.php b/app/code/Magento/Translation/Model/Js/DataProviderInterface.php index 74231b2ccdd959b4d50454d381121c80c7cb82bd..d9eea098e56b1e4102ba5f49b8882e9b325138f6 100644 --- a/app/code/Magento/Translation/Model/Js/DataProviderInterface.php +++ b/app/code/Magento/Translation/Model/Js/DataProviderInterface.php @@ -10,8 +10,8 @@ interface DataProviderInterface { /** * Get translation data - * + * @param string $themePath * @return string[] */ - public function getData(); + public function getData($themePath); } diff --git a/app/code/Magento/Translation/Model/Js/PreProcessor.php b/app/code/Magento/Translation/Model/Js/PreProcessor.php new file mode 100644 index 0000000000000000000000000000000000000000..d7da55fbd50ef2d263c1b29a682d1460774da2c3 --- /dev/null +++ b/app/code/Magento/Translation/Model/Js/PreProcessor.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Model\Js; + +use Magento\Framework\View\Asset\PreProcessorInterface; +use Magento\Framework\View\Asset\PreProcessor\Chain; +use Magento\Framework\Filesystem; + +/** + * PreProcessor responsible for replacing translation calls in js files to translated strings + */ +class PreProcessor implements PreProcessorInterface +{ + /** + * Javascript translation configuration + * + * @var Config + */ + protected $config; + + /** + * @param Config $config + */ + public function __construct(Config $config) + { + $this->config = $config; + } + + /** + * Transform content and/or content type for the specified preprocessing chain object + * + * @param Chain $chain + * @return void + */ + public function process(Chain $chain) + { + if ($this->config->isEmbeddedStrategy()) { + $chain->setContent($this->translate($chain->getContent())); + } + } + + /** + * Replace translation calls with translation result and return content + * + * @param string $content + * @return string + */ + public function translate($content) + { + foreach ($this->config->getPatterns() as $pattern) { + $content = preg_replace_callback($pattern, [$this, 'replaceCallback'], $content); + } + return $content; + } + + /** + * Replace callback for preg_replace_callback function + * + * @param array $matches + * @return string + */ + protected function replaceCallback($matches) + { + return '"' . __($matches[1]) . '"'; + } +} diff --git a/app/code/Magento/Translation/Model/Json/PreProcessor.php b/app/code/Magento/Translation/Model/Json/PreProcessor.php new file mode 100644 index 0000000000000000000000000000000000000000..79c4ad0ccef842037f191f7f7f41e59f17c7ba8e --- /dev/null +++ b/app/code/Magento/Translation/Model/Json/PreProcessor.php @@ -0,0 +1,71 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Model\Json; + +use Magento\Framework\View\Asset\PreProcessorInterface; +use Magento\Translation\Model\Js\Config; +use Magento\Translation\Model\Js\DataProviderInterface; +use Magento\Framework\View\Asset\PreProcessor\Chain; +use Magento\Framework\View\Asset\File\FallbackContext; + +/** + * PreProcessor responsible for providing js translation dictionary + */ +class PreProcessor implements PreProcessorInterface +{ + /** + * Js translation configuration + * + * @var Config + */ + protected $config; + + /** + * Translation data provider + * + * @var DataProviderInterface + */ + protected $dataProvider; + + /** + * @param Config $config + * @param DataProviderInterface $dataProvider + */ + public function __construct( + Config $config, + DataProviderInterface $dataProvider + ) { + $this->config = $config; + $this->dataProvider = $dataProvider; + } + + /** + * Transform content and/or content type for the specified preprocessing chain object + * + * @param Chain $chain + * @return void + */ + public function process(Chain $chain) + { + if ($this->isDictionaryPath($chain->getTargetAssetPath())) { + $context = $chain->getAsset()->getContext(); + $themePath = ($context instanceof FallbackContext) ? $context->getThemePath() : '*/*'; + $chain->setContent(json_encode($this->dataProvider->getData($themePath))); + $chain->setContentType('json'); + } + } + + /** + * Is provided path the path to translation dictionary + * + * @param string $path + * @return bool + */ + protected function isDictionaryPath($path) + { + return (strpos($path, $this->config->getDictionaryFileName()) !== false); + } +} diff --git a/app/code/Magento/Translation/Test/Unit/Block/JsTest.php b/app/code/Magento/Translation/Test/Unit/Block/JsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b929b7304568653dc1fe484408b1c5acae29896e --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/Block/JsTest.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Test\Unit\Block; + +use Magento\Translation\Block\Js; + +class JsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Js + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $configMock; + + protected function setUp() + { + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->configMock = $this->getMockBuilder('Magento\Translation\Model\Js\Config') + ->disableOriginalConstructor() + ->getMock(); + $this->model = $objectManager->getObject('Magento\Translation\Block\Js', ['config' => $this->configMock]); + } + + public function testIsDictionaryStrategy() + { + $this->configMock->expects($this->once()) + ->method('dictionaryEnabled') + ->willReturn(true); + $this->assertTrue($this->model->dictionaryEnabled()); + } +} diff --git a/app/code/Magento/Translation/Test/Unit/Model/Js/Config/Source/StrategyTest.php b/app/code/Magento/Translation/Test/Unit/Model/Js/Config/Source/StrategyTest.php new file mode 100644 index 0000000000000000000000000000000000000000..819d41663235c2739692804db7a98c97b363e207 --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/Model/Js/Config/Source/StrategyTest.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Test\Unit\Model\Js\Config\Source; + +use Magento\Translation\Model\Js\Config; +use Magento\Translation\Model\Js\Config\Source\Strategy; + +/** + * Class StrategyTest + */ +class StrategyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Strategy + */ + protected $model; + + /** + * Set up + * @return void + */ + protected function setUp() + { + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->model = $objectManager->getObject('Magento\Translation\Model\Js\Config\Source\Strategy'); + } + + /** + * Test for toOptionArray method + * @return void + */ + public function testToOptionArray() + { + $expected = [ + ['label' => __('None (Translation is disabled)'), 'value' => Config::NO_TRANSLATION], + ['label' => 'Dictionary (Translation on frontend side)', 'value' => Config::DICTIONARY_STRATEGY], + ['label' => 'Embedded (Translation on backend side)', 'value' => Config::EMBEDDED_STRATEGY] + ]; + $this->assertEquals($expected, $this->model->toOptionArray()); + } +} diff --git a/app/code/Magento/Translation/Test/Unit/Model/Js/ConfigTest.php b/app/code/Magento/Translation/Test/Unit/Model/Js/ConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a0c1e59c1d3e7ca8dd2eb94a94d8dfacb75ab04f --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/Model/Js/ConfigTest.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Test\Unit\Model\Js; + +use Magento\Translation\Model\Js\Config; + +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Config + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeMock; + + /** + * @var string + */ + protected $patterns = ['test_pattern']; + + protected function setUp() + { + $this->scopeMock = $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface') + ->disableOriginalConstructor() + ->getMock(); + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->model = $objectManager->getObject( + 'Magento\Translation\Model\Js\Config', + [ + 'scopeConfig' => $this->scopeMock, + 'patterns' => $this->patterns + ] + ); + } + + public function testIsEmbeddedStrategy() + { + $this->scopeMock->expects($this->once()) + ->method('getValue') + ->with(Config::XML_PATH_STRATEGY) + ->willReturn(Config::EMBEDDED_STRATEGY); + $this->assertTrue($this->model->isEmbeddedStrategy()); + } + + public function testDictionaryEnabled() + { + $this->scopeMock->expects($this->once()) + ->method('getValue') + ->with(Config::XML_PATH_STRATEGY) + ->willReturn(Config::DICTIONARY_STRATEGY); + $this->assertTrue($this->model->dictionaryEnabled()); + } + + public function testgetPatterns() + { + $this->assertEquals($this->patterns, $this->model->getPatterns()); + } +} diff --git a/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php b/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6067c28723fb4eb764f5e2b26167a984ad9b173e --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Test\Unit\Model\Js; + +use Magento\Framework\App\State; +use Magento\Framework\App\Utility\Files; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\ReadInterface; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Translation\Model\Js\DataProvider; +use Magento\Translation\Model\Js\Config; + +/** + * Class DataProviderTest + */ +class DataProviderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var DataProvider + */ + protected $model; + + /** + * @var State|\PHPUnit_Framework_MockObject_MockObject + */ + protected $appStateMock; + + /** + * @var Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $configMock; + + /** + * @var Files|\PHPUnit_Framework_MockObject_MockObject + */ + protected $filesUtilityMock; + + /** + * @var ReadInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $rootDirectoryMock; + + /** + * @return void + */ + protected function setUp() + { + $this->appStateMock = $this->getMock('Magento\Framework\App\State', [], [], '', false); + $this->configMock = $this->getMock('Magento\Translation\Model\Js\Config', [], [], '', false); + $this->filesUtilityMock = $this->getMock('Magento\Framework\App\Utility\Files', [], [], '', false); + $filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); + $this->rootDirectoryMock = $this->getMock('Magento\Framework\Filesystem\Directory\Read', [], [], '', false); + $filesystem->expects($this->once()) + ->method('getDirectoryRead') + ->with(DirectoryList::ROOT) + ->willReturn($this->rootDirectoryMock); + $this->model = new DataProvider( + $this->appStateMock, + $this->configMock, + $filesystem, + $this->filesUtilityMock + ); + } + + /** + * @return void + */ + public function testGetData() + { + $themePath = 'blank'; + $areaCode = 'adminhtml'; + $files = [['path1'], ['path2']]; + + $relativePathMap = [ + ['path1' => 'relativePath1'], + ['path2' => 'relativePath2'] + ]; + $contentsMap = [ + ['relativePath1' => 'content1$.mage.__("hello1")content1'], + ['relativePath2' => 'content2$.mage.__("hello2")content2'] + ]; + + $patterns = ['~\$\.mage\.__\([\'|\"](.+?)[\'|\"]\)~']; + + $this->appStateMock->expects($this->once()) + ->method('getAreaCode') + ->willReturn($areaCode); + $this->filesUtilityMock->expects($this->once()) + ->method('getJsFiles') + ->with($areaCode, $themePath) + ->willReturn($files); + + $this->rootDirectoryMock->expects($this->any()) + ->method('getRelativePath') + ->willReturnMap($relativePathMap); + $this->rootDirectoryMock->expects($this->any()) + ->method('readFile') + ->willReturnMap($contentsMap); + $this->configMock->expects($this->any()) + ->method('getPatterns') + ->willReturn($patterns); + + $this->assertEquals([], $this->model->getData($themePath)); + } +} diff --git a/app/code/Magento/Translation/Test/Unit/Model/Js/PreProcessorTest.php b/app/code/Magento/Translation/Test/Unit/Model/Js/PreProcessorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2ccfbdafeb7c32842e9460fadc44a7aa61c80389 --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/Model/Js/PreProcessorTest.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Test\Unit\Model\Js; + +use Magento\Translation\Model\Js\PreProcessor; +use Magento\Translation\Model\Js\Config; + +class PreProcessorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var PreProcessor + */ + protected $model; + + /** + * @var Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $configMock; + + protected function setUp() + { + $this->configMock = $this->getMock('Magento\Translation\Model\Js\Config', [], [], '', false); + $this->model = new PreProcessor($this->configMock); + } + + public function testGetData() + { + $chain = $this->getMock('Magento\Framework\View\Asset\PreProcessor\Chain', [], [], '', false); + $originalContent = 'content$.mage.__("hello1")content'; + $translatedContent = 'content"hello1"content'; + $patterns = ['~\$\.mage\.__\([\'|\"](.+?)[\'|\"]\)~']; + + $this->configMock->expects($this->once()) + ->method('isEmbeddedStrategy') + ->willReturn(true); + $chain->expects($this->once()) + ->method('getContent') + ->willReturn($originalContent); + $this->configMock->expects($this->once()) + ->method('getPatterns') + ->willReturn($patterns); + + $chain->expects($this->once()) + ->method('setContent') + ->with($translatedContent); + + $this->model->process($chain); + } +} diff --git a/app/code/Magento/Translation/Test/Unit/Model/Json/PreProcessorTest.php b/app/code/Magento/Translation/Test/Unit/Model/Json/PreProcessorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7b5e0fb2299b09aeb984eec7b80f43116f22f961 --- /dev/null +++ b/app/code/Magento/Translation/Test/Unit/Model/Json/PreProcessorTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Translation\Test\Unit\Model\Json; + +use Magento\Translation\Model\Js\Config; +use Magento\Translation\Model\Js\DataProvider; +use Magento\Translation\Model\Json\PreProcessor; + +class PreProcessorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var PreProcessor + */ + protected $model; + + /** + * @var Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $configMock; + + /** + * @var DataProvider|\PHPUnit_Framework_MockObject_MockObject + */ + protected $dataProviderMock; + + protected function setUp() + { + $this->configMock = $this->getMock('Magento\Translation\Model\Js\Config', [], [], '', false); + $this->dataProviderMock = $this->getMock('Magento\Translation\Model\Js\DataProvider', [], [], '', false); + $this->model = new PreProcessor($this->configMock, $this->dataProviderMock); + } + + public function testGetData() + { + $chain = $this->getMock('Magento\Framework\View\Asset\PreProcessor\Chain', [], [], '', false); + $asset = $this->getMock('Magento\Framework\View\Asset\File', [], [], '', false); + $context = $this->getMock('Magento\Framework\View\Asset\File\FallbackContext', [], [], '', false); + $fileName = 'js-translation.json'; + $targetPath = 'path/js-translation.json'; + $themePath = '*/*'; + $dictionary = ['hello' => 'bonjour']; + + $chain->expects($this->once()) + ->method('getTargetAssetPath') + ->willReturn($targetPath); + $this->configMock->expects($this->once()) + ->method('getDictionaryFileName') + ->willReturn($fileName); + $chain->expects($this->once()) + ->method('getAsset') + ->willReturn($asset); + $asset->expects($this->once()) + ->method('getContext') + ->willReturn($context); + $context->expects($this->once()) + ->method('getThemePath') + ->willReturn($themePath); + $this->dataProviderMock->expects($this->once()) + ->method('getData') + ->with($themePath) + ->willReturn($dictionary); + $chain->expects($this->once()) + ->method('setContent') + ->with(json_encode($dictionary)); + $chain->expects($this->once()) + ->method('setContentType') + ->with('json'); + + $this->model->process($chain); + } +} diff --git a/app/code/Magento/Translation/etc/adminhtml/system.xml b/app/code/Magento/Translation/etc/adminhtml/system.xml new file mode 100644 index 0000000000000000000000000000000000000000..90d70e824ced6cd42cef19b0d51c39e32e5e08eb --- /dev/null +++ b/app/code/Magento/Translation/etc/adminhtml/system.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd"> + <system> + <section id="dev"> + <group id="js"> + <field id="translate_strategy" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Translation Strategy</label> + <source_model>Magento\Translation\Model\Js\Config\Source\Strategy</source_model> + <comment>Please put your store into maintenance mode and redeploy static files after changing strategy</comment> + </field> + </group> + </section> + </system> +</config> diff --git a/app/code/Magento/Translation/etc/config.xml b/app/code/Magento/Translation/etc/config.xml index ae18303a6bc7320f54be043c77d802324d4d6d48..391f9c3fba00bb6e418872b533c82e13c6eaddb0 100644 --- a/app/code/Magento/Translation/etc/config.xml +++ b/app/code/Magento/Translation/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <dev> <translate_inline> @@ -15,6 +15,9 @@ <block_html /> </invalid_caches> </translate_inline> + <js> + <translate_strategy>none</translate_strategy> + </js> </dev> </default> </config> diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml index 3507d99af6eec6b55fb3c2b7681e76f7510bdf34..c411e653425d197cc7fc4096d6426113ccd94aa1 100644 --- a/app/code/Magento/Translation/etc/di.xml +++ b/app/code/Magento/Translation/etc/di.xml @@ -13,6 +13,8 @@ <preference for="Magento\Framework\Translate\ResourceInterface" type="Magento\Translation\Model\Resource\Translate" /> <preference for="Magento\Framework\Translate\Inline\StateInterface" type="Magento\Framework\Translate\Inline\State" /> <preference for="Magento\Framework\Phrase\RendererInterface" type="Magento\Framework\Phrase\Renderer\Composite" /> + <preference for="Magento\Translation\Model\Js\DataProviderInterface" type="Magento\Translation\Model\Js\DataProvider"/> + <preference for="Magento\Framework\Translate\Js\Config" type="Magento\Translation\Model\Js\Config"/> <type name="Magento\Framework\Translate\Inline"> <arguments> <argument name="templateFileName" xsi:type="string">Magento_Translation::translate_inline.phtml</argument> @@ -52,4 +54,27 @@ </argument> </arguments> </type> + <type name="Magento\Translation\Model\Js\Config"> + <arguments> + <argument name="patterns" xsi:type="array"> + <item name="mage_translation_widget" xsi:type="string">~\$\.mage\.__\([\'|\"](.+?)[\'|\"]\)~</item> + </argument> + </arguments> + </type> + <type name="Magento\Framework\View\Asset\PreProcessor\Pool"> + <arguments> + <argument name="preProcessors" xsi:type="array"> + <item name="js" xsi:type="array"> + <item name="js" xsi:type="array"> + <item name="js_translation" xsi:type="string">Magento\Translation\Model\Js\PreProcessor</item> + </item> + </item> + <item name="json" xsi:type="array"> + <item name="json" xsi:type="array"> + <item name="json_generation" xsi:type="string">Magento\Translation\Model\Json\PreProcessor</item> + </item> + </item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml index 0b973ed3ef7beaa4cb84e83e07e9debccd8bffba..669f8ae935645323723a5ea9e3732458e497f8dc 100644 --- a/app/code/Magento/Translation/etc/module.xml +++ b/app/code/Magento/Translation/etc/module.xml @@ -7,8 +7,5 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="Magento_Translation" setup_version="2.0.0"> - <sequence> - <module name="Magento_Core"/> - </sequence> </module> </config> diff --git a/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml b/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml index d2a5974bb335b1521d2595cb9dc2dd7abbe32b90..328a33e5c3f5e2bb13ab9dbec46944250c6485bd 100644 --- a/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml +++ b/app/code/Magento/Translation/view/adminhtml/templates/translate_inline.phtml @@ -13,43 +13,43 @@ <link rel="stylesheet" type="text/css" href="<?php echo $block->getViewFileUrl('mage/translate-inline.css') ?>"/> <script id="translate-inline-icon" type="text/x-magento-template"> - <img src="<%= data.img %>" height="16" width="16" class="translate-edit-icon"> + <img src="<%- data.img %>" height="16" width="16" class="translate-edit-icon"> </script> <script id="translate-form-template" type="text/x-magento-template"> - <form id="<%= data.id %>"> + <form id="<%- data.id %>"> <% _.each(data.items, function(item, i) { %> <div class="magento_table_container"><table cellspacing="0"> <% _.each(item, function(value, index) { %> <tr> - <th class="label" style="text-transform: capitalize;"><%= index %>:</th> - <td class="value"><%= value %></td> + <th class="label" style="text-transform: capitalize;"><%- index %>:</th> + <td class="value"><%- value %></td> </tr> <% }); %> <tr> <th class="label"> - <label for="perstore_<%= i %>">Store View Specific:</label> + <label for="perstore_<%- i %>">Store View Specific:</label> </th> <td class="value"> - <input id="perstore_<%= i %>" name="translate[<%= i %>][perstore]" type="checkbox" value="1"/> + <input id="perstore_<%- i %>" name="translate[<%- i %>][perstore]" type="checkbox" value="1"/> </td> </tr> <tr> <th class="label"> - <label for="custom_<%= i %>">Custom:</label> + <label for="custom_<%- i %>">Custom:</label> </th> <td class="value"> - <input name="translate[<%= i %>][original]" type="hidden" value="<%= data.escape(item.original) %>"/> - <input id="custom_<%= i %>" - name="translate[<%= i %>][custom]" + <input name="translate[<%- i %>][original]" type="hidden" value="<%- data.escape(item.original) %>"/> + <input id="custom_<%- i %>" + name="translate[<%- i %>][custom]" class="input-text" - value="<%= data.escape(item.translated) %>" /> + value="<%- data.escape(item.translated) %>" /> </td> </tr> </table></div> <% }); %> </form> <% if (data.message) { %> - <p class="a-center accent"><%= data.message %></p> + <p class="a-center accent"><%- data.message %></p> <% } %> </script> diff --git a/app/code/Magento/Translation/view/base/templates/translate.phtml b/app/code/Magento/Translation/view/base/templates/translate.phtml index be33473e166c7bb81300b8209fe7f11cda7654e3..d6c010e876528c017458f6af3c9734b10e47bce7 100644 --- a/app/code/Magento/Translation/view/base/templates/translate.phtml +++ b/app/code/Magento/Translation/view/base/templates/translate.phtml @@ -3,12 +3,17 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile ?> <?php /** @var $block \Magento\Translation\Block\Js */ ?> +<?php if ($block->dictionaryEnabled()): ?> <script> -//<![CDATA[ - require( - ["jquery", "mage/translate"], function($){ $.mage.translate.add( <?php echo $block->getTranslatedJson() ?> ); } - ) -// ]]> +require([ + "jquery", + "mage/translate", + "text!<?php echo Magento\Translation\Model\Js\Config::DICTIONARY_FILE_NAME?>" +], function($, translate, data) { + $.mage.translate.add(JSON.parse(data)); +}); </script> +<?php endif; ?> diff --git a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml index 2eb2ac3e8aeedc3faa73f48e8a0b18cc30b97d87..d1c3ce3fc0795cc4bfb9dc89099c70b305f36fc4 100644 --- a/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml +++ b/app/code/Magento/Translation/view/frontend/templates/translate_inline.phtml @@ -13,37 +13,37 @@ <link rel="stylesheet" type="text/css" href="<?php echo $block->getViewFileUrl('mage/translate-inline.css') ?>"/> <script id="translate-inline-icon" type="text/x-magento-template"> - <img src="<%= data.img %>" height="16" width="16" class="translate-edit-icon"> + <img src="<%- data.img %>" height="16" width="16" class="translate-edit-icon"> </script> <script id="translate-form-template" type="text/x-magento-template"> - <form id="<%= data.id %>"> + <form id="<%- data.id %>"> <% _.each(data.items, function(item, i) { %> <div class="magento_table_container"> <table cellspacing="0"> <% _.each(item, function(value, index) { %> <tr> - <th class="label" style="text-transform: capitalize;"><%= index %>:</th> - <td class="value"><%= value %></td> + <th class="label" style="text-transform: capitalize;"><%- index %>:</th> + <td class="value"><%- value %></td> </tr> <% }); %> <tr> <th class="label"> - <label for="perstore_<%= i %>">Store View Specific:</label> + <label for="perstore_<%- i %>">Store View Specific:</label> </th> <td class="value"> - <input id="perstore_<%= i %>" name="translate[<%= i %>][perstore]" type="checkbox" value="1"/> + <input id="perstore_<%- i %>" name="translate[<%- i %>][perstore]" type="checkbox" value="1"/> </td> </tr> <tr> <th class="label"> - <label for="custom_<%= i %>">Custom:</label> + <label for="custom_<%- i %>">Custom:</label> </th> <td class="value"> - <input name="translate[<%= i %>][original]" type="hidden" value="<%= data.escape(item.original) %>"/> - <input id="custom_<%= i %>" - name="translate[<%= i %>][custom]" + <input name="translate[<%- i %>][original]" type="hidden" value="<%- data.escape(item.original) %>"/> + <input id="custom_<%- i %>" + name="translate[<%- i %>][custom]" class="input-text" - value="<%= data.escape(item.translated) %>" /> + value="<%- data.escape(item.translated) %>" /> </td> </tr> </table> @@ -51,7 +51,7 @@ <% }); %> </form> <% if (data.message) { %> - <p class="a-center accent"><%= data.message %></p> + <p class="a-center accent"><%- data.message %></p> <% } %> </script> diff --git a/app/code/Magento/Ups/etc/config.xml b/app/code/Magento/Ups/etc/config.xml index 0ff0850998865dce77c0dad749fac8982e896b39..b3df7eabdde155e4811c5ae26695b7afdd28e2b5 100644 --- a/app/code/Magento/Ups/etc/config.xml +++ b/app/code/Magento/Ups/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <carriers> <ups> diff --git a/app/code/Magento/UrlRewrite/Controller/Router.php b/app/code/Magento/UrlRewrite/Controller/Router.php index ce2f31fc0d2a23af6fd36b0deb657e0c220a66dc..d6ae92b0f0e7700659f1e721237bb79287ce7936 100644 --- a/app/code/Magento/UrlRewrite/Controller/Router.php +++ b/app/code/Magento/UrlRewrite/Controller/Router.php @@ -85,6 +85,7 @@ class Router implements \Magento\Framework\App\RouterInterface return $this->processRedirect($request, $rewrite); } + $request->setAlias(\Magento\Framework\UrlInterface::REWRITE_REQUEST_PATH_ALIAS, $rewrite->getRequestPath()); $request->setPathInfo('/' . $rewrite->getTargetPath()); return $this->actionFactory->create('Magento\Framework\App\Action\Forward', ['request' => $request]); } diff --git a/app/code/Magento/UrlRewrite/Model/Storage/AbstractStorage.php b/app/code/Magento/UrlRewrite/Model/Storage/AbstractStorage.php index 7cf653bda3e020ca92cdcbed615d29ea23a00da2..4664dd4b7e721371c05b41952df26f45865bcc75 100644 --- a/app/code/Magento/UrlRewrite/Model/Storage/AbstractStorage.php +++ b/app/code/Magento/UrlRewrite/Model/Storage/AbstractStorage.php @@ -6,22 +6,28 @@ namespace Magento\UrlRewrite\Model\Storage; use Magento\UrlRewrite\Model\StorageInterface; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; +use Magento\Framework\Api\DataObjectHelper; /** * Abstract db storage */ abstract class AbstractStorage implements StorageInterface { - /** @var UrlRewriteBuilder */ - protected $urlRewriteBuilder; + /** @var UrlRewriteFactory */ + protected $urlRewriteFactory; + + /** @var DataObjectHelper */ + protected $dataObjectHelper; /** - * @param UrlRewriteBuilder $urlRewriteBuilder + * @param UrlRewriteFactory $urlRewriteFactory + * @param DataObjectHelper $dataObjectHelper */ - public function __construct(UrlRewriteBuilder $urlRewriteBuilder) + public function __construct(UrlRewriteFactory $urlRewriteFactory, DataObjectHelper $dataObjectHelper) { - $this->urlRewriteBuilder = $urlRewriteBuilder; + $this->urlRewriteFactory = $urlRewriteFactory; + $this->dataObjectHelper = $dataObjectHelper; } /** @@ -97,6 +103,12 @@ abstract class AbstractStorage implements StorageInterface */ protected function createUrlRewrite($data) { - return $this->urlRewriteBuilder->populateWithArray($data)->create(); + $dataObject = $this->urlRewriteFactory->create(); + $this->dataObjectHelper->populateWithArray( + $dataObject, + $data, + '\Magento\UrlRewrite\Service\V1\Data\UrlRewrite' + ); + return $dataObject; } } diff --git a/app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php b/app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php index 75d935565122d24c304fd96e91e5dd614adbf2ab..519ac3fc6cfc0696c59f3f6288d4bad20ace3f8f 100644 --- a/app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php +++ b/app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php @@ -7,7 +7,8 @@ namespace Magento\UrlRewrite\Model\Storage; use Magento\Framework\App\Resource; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; -use Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder; +use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory; +use Magento\Framework\Api\DataObjectHelper; class DbStorage extends AbstractStorage { @@ -32,15 +33,19 @@ class DbStorage extends AbstractStorage protected $resource; /** - * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder $urlRewriteBuilder + * @param \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory $urlRewriteFactory + * @param DataObjectHelper $dataObjectHelper * @param \Magento\Framework\App\Resource $resource */ - public function __construct(UrlRewriteBuilder $urlRewriteBuilder, Resource $resource) - { + public function __construct( + UrlRewriteFactory $urlRewriteFactory, + DataObjectHelper $dataObjectHelper, + Resource $resource + ) { $this->connection = $resource->getConnection(Resource::DEFAULT_WRITE_RESOURCE); $this->resource = $resource; - parent::__construct($urlRewriteBuilder); + parent::__construct($urlRewriteFactory, $dataObjectHelper); } /** diff --git a/app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewrite.php b/app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewrite.php index d37fa216be9534dd7465118bd4f108e2828ffaa8..6bd75f0bcdff14bf119a145beb1443d42260fb29 100644 --- a/app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewrite.php +++ b/app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewrite.php @@ -5,12 +5,12 @@ */ namespace Magento\UrlRewrite\Service\V1\Data; -use Magento\Framework\Api\AbstractExtensibleObject; +use Magento\Framework\Api\AbstractSimpleObject; /** * Data abstract class for url storage */ -class UrlRewrite extends AbstractExtensibleObject +class UrlRewrite extends AbstractSimpleObject { /**#@+ * Value object attribute names @@ -27,6 +27,16 @@ class UrlRewrite extends AbstractExtensibleObject const METADATA = 'metadata'; /**#@-*/ + /** + * @var array + */ + protected $defaultValues = [ + self::REDIRECT_TYPE => 0, + self::IS_AUTOGENERATED => 1, + self::METADATA => null, + self::DESCRIPTION => null, + ]; + /** * Get data by key * @@ -46,6 +56,15 @@ class UrlRewrite extends AbstractExtensibleObject return $this->_get(self::URL_REWRITE_ID); } + /** + * @param int $urlRewriteId + * @return int + */ + public function setUrlRewriteId($urlRewriteId) + { + return $this->setData(self::URL_REWRITE_ID, $urlRewriteId); + } + /** * @return int */ @@ -54,6 +73,16 @@ class UrlRewrite extends AbstractExtensibleObject return $this->_get(self::ENTITY_ID); } + /** + * @param int $entityId + * + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData(self::ENTITY_ID, $entityId); + } + /** * @return string */ @@ -62,12 +91,33 @@ class UrlRewrite extends AbstractExtensibleObject return $this->_get(self::ENTITY_TYPE); } + /** + * @param string $entityType + * + * @return $this + */ + public function setEntityType($entityType) + { + return $this->setData(self::ENTITY_TYPE, $entityType); + } + /** * @return int */ public function getIsAutogenerated() { - return $this->_get(self::IS_AUTOGENERATED); + return $this->_get(self::IS_AUTOGENERATED) === null ? + $this->defaultValues[self::IS_AUTOGENERATED] : $this->_get(self::IS_AUTOGENERATED); + } + + /** + * @param int $isAutogenerated + * + * @return $this + */ + public function setIsAutogenerated($isAutogenerated) + { + return $this->setData(self::IS_AUTOGENERATED, $isAutogenerated); } /** @@ -78,6 +128,16 @@ class UrlRewrite extends AbstractExtensibleObject return $this->_get(self::REQUEST_PATH); } + /** + * @param string $requestPath + * + * @return $this + */ + public function setRequestPath($requestPath) + { + return $this->setData(self::REQUEST_PATH, $requestPath); + } + /** * @return string */ @@ -86,6 +146,16 @@ class UrlRewrite extends AbstractExtensibleObject return $this->_get(self::TARGET_PATH); } + /** + * @param string $targetPath + * + * @return $this + */ + public function setTargetPath($targetPath) + { + return $this->setData(self::TARGET_PATH, $targetPath); + } + /** * @return int */ @@ -94,6 +164,16 @@ class UrlRewrite extends AbstractExtensibleObject return $this->_get(self::STORE_ID); } + /** + * @param int $storeId + * + * @return $this + */ + public function setStoreId($storeId) + { + return $this->setData(self::STORE_ID, $storeId); + } + /** * @return int */ @@ -102,6 +182,16 @@ class UrlRewrite extends AbstractExtensibleObject return (int)$this->_get(self::REDIRECT_TYPE); } + /** + * @param int $redirectCode + * + * @return $this + */ + public function setRedirectType($redirectCode) + { + return $this->setData(self::REDIRECT_TYPE, $redirectCode); + } + /** * @return string */ @@ -110,6 +200,16 @@ class UrlRewrite extends AbstractExtensibleObject return $this->_get(self::DESCRIPTION); } + /** + * @param string $description + * + * @return $this + */ + public function setDescription($description) + { + return $this->setData(self::DESCRIPTION, $description); + } + /** * @return array */ @@ -119,6 +219,19 @@ class UrlRewrite extends AbstractExtensibleObject return !empty($metadata) ? unserialize($metadata) : []; } + /** + * @param array|string $metadata + * + * @return $this + */ + public function setMetadata($metadata) + { + if (is_array($metadata)) { + $metadata = serialize($metadata); + } + return $this->setData(UrlRewrite::METADATA, $metadata); + } + /** * Convert UrlRewrite to array * @@ -126,6 +239,6 @@ class UrlRewrite extends AbstractExtensibleObject */ public function toArray() { - return $this->_data; + return array_merge($this->defaultValues, $this->_data); } } diff --git a/app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewriteBuilder.php b/app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewriteBuilder.php deleted file mode 100644 index eab6658155fb2e7d070d33597b5fbd045156569a..0000000000000000000000000000000000000000 --- a/app/code/Magento/UrlRewrite/Service/V1/Data/UrlRewriteBuilder.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\UrlRewrite\Service\V1\Data; - -use Magento\Framework\Api\ExtensibleObjectBuilder; - -/** - * Data builder class for url rewrite - */ -class UrlRewriteBuilder extends ExtensibleObjectBuilder -{ - /** - * @var array - */ - protected $defaultValues = [ - UrlRewrite::REDIRECT_TYPE => 0, - UrlRewrite::IS_AUTOGENERATED => 1, - UrlRewrite::METADATA => null, - UrlRewrite::DESCRIPTION => null, - ]; - - /** - * {@inheritdoc} - */ - public function getData() - { - return array_merge($this->defaultValues, $this->data); - } - - /** - * @param int $entityId - * - * @return $this - */ - public function setEntityId($entityId) - { - return $this->_set(UrlRewrite::ENTITY_ID, $entityId); - } - - /** - * @param string $entityType - * - * @return $this - */ - public function setEntityType($entityType) - { - return $this->_set(UrlRewrite::ENTITY_TYPE, $entityType); - } - - /** - * @param int $isAutogenerated - * - * @return $this - */ - public function setIsAutogenerated($isAutogenerated) - { - return $this->_set(UrlRewrite::IS_AUTOGENERATED, $isAutogenerated); - } - - /** - * @param string $requestPath - * - * @return $this - */ - public function setRequestPath($requestPath) - { - return $this->_set(UrlRewrite::REQUEST_PATH, $requestPath); - } - - /** - * @param string $targetPath - * - * @return $this - */ - public function setTargetPath($targetPath) - { - return $this->_set(UrlRewrite::TARGET_PATH, $targetPath); - } - - /** - * @param int $storeId - * - * @return $this - */ - public function setStoreId($storeId) - { - return $this->_set(UrlRewrite::STORE_ID, $storeId); - } - - /** - * @param int $redirectCode - * - * @return $this - */ - public function setRedirectType($redirectCode) - { - return $this->_set(UrlRewrite::REDIRECT_TYPE, $redirectCode); - } - - /** - * @param string $description - * - * @return $this - */ - public function setDescription($description) - { - return $this->_set(UrlRewrite::DESCRIPTION, $description); - } - - /** - * @param array $metadata - * - * @return $this - */ - public function setMetadata(array $metadata) - { - $metadata = $metadata ? serialize($metadata) : null; - return $this->_set(UrlRewrite::METADATA, $metadata); - } -} diff --git a/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php b/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php index 827d0b608c41d50d4018edf7d0d28bb63f50037a..67844a8956ffc4d634a3eb21aab8a993d17b73ae 100644 --- a/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php +++ b/app/code/Magento/UrlRewrite/Test/Unit/Controller/RouterTest.php @@ -252,8 +252,11 @@ class RouterTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor()->getMock(); $urlRewrite->expects($this->any())->method('getRedirectType')->will($this->returnValue(0)); $urlRewrite->expects($this->any())->method('getTargetPath')->will($this->returnValue('target-path')); + $urlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('request-path')); $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite)); $this->request->expects($this->once())->method('setPathInfo')->with('/target-path'); + $this->request->expects($this->once())->method('setAlias') + ->with(\Magento\Framework\UrlInterface::REWRITE_REQUEST_PATH_ALIAS, 'request-path'); $this->actionFactory->expects($this->once())->method('create') ->with('Magento\Framework\App\Action\Forward', ['request' => $this->request]); diff --git a/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/AbstractStorageTest.php b/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/AbstractStorageTest.php index 8028689b81ee3675e67b49bef979ae315b7f3999..cf4623f3ac12ba59c82f1216da4f5ae33323eaf4 100644 --- a/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/AbstractStorageTest.php +++ b/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/AbstractStorageTest.php @@ -10,9 +10,14 @@ use Magento\UrlRewrite\Model\Storage\DuplicateEntryException; class AbstractStorageTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteBuilder; + protected $urlRewriteFactory; + + /** + * @var \Magento\Framework\Api\DataObjectHelper|\PHPUnit_Framework_MockObject_MockObject + */ + protected $dataObjectHelper; /** * @var \Magento\UrlRewrite\Model\Storage\AbstractStorage|\PHPUnit_Framework_MockObject_MockObject @@ -21,12 +26,15 @@ class AbstractStorageTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->urlRewriteBuilder = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder') + $this->urlRewriteFactory = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory') + ->setMethods(['create']) + ->disableOriginalConstructor()->getMock(); + $this->dataObjectHelper = $this->getMockBuilder('Magento\Framework\Api\DataObjectHelper') ->disableOriginalConstructor()->getMock(); $this->storage = $this->getMockForAbstractClass( 'Magento\UrlRewrite\Model\Storage\AbstractStorage', - [$this->urlRewriteBuilder], + [$this->urlRewriteFactory, $this->dataObjectHelper], '', true, true, @@ -45,21 +53,21 @@ class AbstractStorageTest extends \PHPUnit_Framework_TestCase ->with($data) ->will($this->returnValue($rows)); - $this->urlRewriteBuilder->expects($this->at(0)) + $this->dataObjectHelper->expects($this->at(0)) ->method('populateWithArray') - ->with($rows[0]) + ->with($urlRewrites[0], $rows[0], '\Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->at(1)) + $this->urlRewriteFactory->expects($this->at(0)) ->method('create') ->will($this->returnValue($urlRewrites[0])); - $this->urlRewriteBuilder->expects($this->at(2)) + $this->dataObjectHelper->expects($this->at(1)) ->method('populateWithArray') - ->with($rows[1]) + ->with($urlRewrites[1], $rows[1], '\Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->at(3)) + $this->urlRewriteFactory->expects($this->at(1)) ->method('create') ->will($this->returnValue($urlRewrites[1])); @@ -89,12 +97,12 @@ class AbstractStorageTest extends \PHPUnit_Framework_TestCase ->with($data) ->will($this->returnValue($row)); - $this->urlRewriteBuilder->expects($this->once()) + $this->dataObjectHelper->expects($this->once()) ->method('populateWithArray') - ->with($row) + ->with($urlRewrite, $row, '\Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->any()) + $this->urlRewriteFactory->expects($this->any()) ->method('create') ->will($this->returnValue($urlRewrite)); diff --git a/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/DbStorageTest.php b/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/DbStorageTest.php index a550deddf6eb978ed63c653b670b6aa89b9f25e9..8931b9531802b40a45302d8990e9ea38ae796e46 100644 --- a/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/DbStorageTest.php +++ b/app/code/Magento/UrlRewrite/Test/Unit/Model/Storage/DbStorageTest.php @@ -17,9 +17,14 @@ use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; class DbStorageTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory|\PHPUnit_Framework_MockObject_MockObject */ - protected $urlRewriteBuilder; + protected $urlRewriteFactory; + + /** + * @var \Magento\Framework\Api\DataObjectHelper|\PHPUnit_Framework_MockObject_MockObject + */ + protected $dataObjectHelper; /** * @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject @@ -43,7 +48,10 @@ class DbStorageTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->urlRewriteBuilder = $this->getMock('Magento\UrlRewrite\Service\V1\Data\UrlRewriteBuilder', [], [], '', + $this->urlRewriteFactory = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory') + ->setMethods(['create']) + ->disableOriginalConstructor()->getMock(); + $this->dataObjectHelper = $this->getMock('Magento\Framework\Api\DataObjectHelper', [], [], '', false); $this->adapter = $this->getMock('Magento\Framework\DB\Adapter\AdapterInterface'); $this->select = $this->getMock('Magento\Framework\DB\Select', ['from', 'where', 'deleteFromSelect'], [], '', @@ -61,7 +69,8 @@ class DbStorageTest extends \PHPUnit_Framework_TestCase $this->storage = (new ObjectManager($this))->getObject( 'Magento\UrlRewrite\Model\Storage\DbStorage', [ - 'urlRewriteBuilder' => $this->urlRewriteBuilder, + 'urlRewriteFactory' => $this->urlRewriteFactory, + 'dataObjectHelper' => $this->dataObjectHelper, 'resource' => $this->resource, ] ); @@ -88,21 +97,21 @@ class DbStorageTest extends \PHPUnit_Framework_TestCase ->with($this->select) ->will($this->returnValue([['row1'], ['row2']])); - $this->urlRewriteBuilder->expects($this->at(0)) + $this->dataObjectHelper->expects($this->at(0)) ->method('populateWithArray') - ->with(['row1']) + ->with(['urlRewrite1'], ['row1'], '\Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->at(1)) + $this->urlRewriteFactory->expects($this->at(0)) ->method('create') ->will($this->returnValue(['urlRewrite1'])); - $this->urlRewriteBuilder->expects($this->at(2)) + $this->dataObjectHelper->expects($this->at(1)) ->method('populateWithArray') - ->with(['row2']) + ->with(['urlRewrite2'], ['row2'], '\Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->at(3)) + $this->urlRewriteFactory->expects($this->at(1)) ->method('create') ->will($this->returnValue(['urlRewrite2'])); @@ -130,12 +139,12 @@ class DbStorageTest extends \PHPUnit_Framework_TestCase ->with($this->select) ->will($this->returnValue(['row1'])); - $this->urlRewriteBuilder->expects($this->at(0)) + $this->dataObjectHelper->expects($this->at(0)) ->method('populateWithArray') - ->with(['row1']) + ->with(['urlRewrite1'], ['row1'], '\Magento\UrlRewrite\Service\V1\Data\UrlRewrite') ->will($this->returnSelf()); - $this->urlRewriteBuilder->expects($this->at(1)) + $this->urlRewriteFactory->expects($this->at(0)) ->method('create') ->will($this->returnValue(['urlRewrite1'])); diff --git a/app/code/Magento/UrlRewrite/etc/config.xml b/app/code/Magento/UrlRewrite/etc/config.xml index a174ec7abdd2bcf9bd418008f92a48ab6b3374f0..0179be80676ffaf771c3945882115a947e4bf62e 100644 --- a/app/code/Magento/UrlRewrite/etc/config.xml +++ b/app/code/Magento/UrlRewrite/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <url_rewrite> <entity_types> diff --git a/app/code/Magento/User/etc/config.xml b/app/code/Magento/User/etc/config.xml index 1496ade1d2170a7d9f73927ceded5ac24ab19265..6ef863af41a76d4c51389704d015394304001585 100644 --- a/app/code/Magento/User/etc/config.xml +++ b/app/code/Magento/User/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <admin> <emails> diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json index be86d099ce9c69870617f49046995e24886cb319..41c06f2dbd0461bc65cb25993b566acbf0530d30 100644 --- a/app/code/Magento/Usps/composer.json +++ b/app/code/Magento/Usps/composer.json @@ -6,11 +6,11 @@ "magento/module-store": "0.42.0-beta11", "magento/module-shipping": "0.42.0-beta11", "magento/module-directory": "0.42.0-beta11", - "magento/module-core": "0.42.0-beta11", "magento/module-catalog": "0.42.0-beta11", "magento/module-sales": "0.42.0-beta11", "magento/module-catalog-inventory": "0.42.0-beta11", "magento/module-quote": "0.42.0-beta11", + "magento/module-config": "0.42.0-beta11", "magento/framework": "0.42.0-beta11", "lib-libxml": "*", "magento/magento-composer-installer": "*" diff --git a/app/code/Magento/Usps/etc/config.xml b/app/code/Magento/Usps/etc/config.xml index db37b2e8aafd7705a6b2b72fde6e006ea37231cb..972c58188197743a4a1791eed981dafaea4b953c 100644 --- a/app/code/Magento/Usps/etc/config.xml +++ b/app/code/Magento/Usps/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <carriers> <usps> diff --git a/app/code/Magento/Variable/i18n/de_DE.csv b/app/code/Magento/Variable/i18n/de_DE.csv new file mode 100644 index 0000000000000000000000000000000000000000..5b82c65d44622a54d7d365b4458e96df3f0ad5d4 --- /dev/null +++ b/app/code/Magento/Variable/i18n/de_DE.csv @@ -0,0 +1,4 @@ +"Custom Variables","Angepasste Variablen" +"Variable Code must be unique.","Variabler Code muß eindeutig sein." +"Validation has failed.","Prüfung fehlgeschlagen." +"Insert Variable...","Insert Variable..." diff --git a/app/code/Magento/Variable/i18n/en_US.csv b/app/code/Magento/Variable/i18n/en_US.csv new file mode 100644 index 0000000000000000000000000000000000000000..d68ff06262284b6f05c4f7b5d889d9088673c0f1 --- /dev/null +++ b/app/code/Magento/Variable/i18n/en_US.csv @@ -0,0 +1,4 @@ +"Custom Variables","Custom Variables" +"Variable Code must be unique.","Variable Code must be unique." +"Validation has failed.","Validation has failed." +"Insert Variable...","Insert Variable..." diff --git a/app/code/Magento/Variable/i18n/es_ES.csv b/app/code/Magento/Variable/i18n/es_ES.csv new file mode 100644 index 0000000000000000000000000000000000000000..a17a926b175fcdd5189d3562f4cf843df86504ad --- /dev/null +++ b/app/code/Magento/Variable/i18n/es_ES.csv @@ -0,0 +1,4 @@ +"Custom Variables","Variables personalizadas" +"Variable Code must be unique.","El código de variable debe ser único." +"Validation has failed.","Falló la validación." +"Insert Variable...","Insert Variable..." diff --git a/app/code/Magento/Variable/i18n/fr_FR.csv b/app/code/Magento/Variable/i18n/fr_FR.csv new file mode 100644 index 0000000000000000000000000000000000000000..8f14328226eb363ef5141bedf4e73c999f23e4fd --- /dev/null +++ b/app/code/Magento/Variable/i18n/fr_FR.csv @@ -0,0 +1,4 @@ +"Custom Variables","Variables sur mesure" +"Variable Code must be unique.","La variable code doit être unique." +"Validation has failed.","Validation a échouée" +"Insert Variable...","Insert Variable..." diff --git a/app/code/Magento/Variable/i18n/nl_NL.csv b/app/code/Magento/Variable/i18n/nl_NL.csv new file mode 100644 index 0000000000000000000000000000000000000000..e16b8d4192b1b0eed3f01a2d806482d84d94de8a --- /dev/null +++ b/app/code/Magento/Variable/i18n/nl_NL.csv @@ -0,0 +1,4 @@ +"Custom Variables","Aangepaste variabelen" +"Variable Code must be unique.","Variabele Code moet uniek zijn." +"Validation has failed.","Validatie is mislukt." +"Insert Variable...","Insert Variable..." diff --git a/app/code/Magento/Variable/i18n/pt_BR.csv b/app/code/Magento/Variable/i18n/pt_BR.csv new file mode 100644 index 0000000000000000000000000000000000000000..e073700f36435e76d055a351da2bba66824895c5 --- /dev/null +++ b/app/code/Magento/Variable/i18n/pt_BR.csv @@ -0,0 +1,4 @@ +"Custom Variables","Variáveis de Personalização." +"Variable Code must be unique.","Código da Variável deve ser único." +"Validation has failed.","Validação falhou." +"Insert Variable...","Insert Variable..." diff --git a/app/code/Magento/Variable/i18n/zh_CN.csv b/app/code/Magento/Variable/i18n/zh_CN.csv new file mode 100644 index 0000000000000000000000000000000000000000..b690819a8319dfedfd8aa2579201e599fb7c276d --- /dev/null +++ b/app/code/Magento/Variable/i18n/zh_CN.csv @@ -0,0 +1,4 @@ +"Custom Variables",自定义å˜é‡ +"Variable Code must be unique.",å˜é‡ä»£ç 必须是唯一的。 +"Validation has failed.",验è¯å¤±è´¥ã€‚ +"Insert Variable...","Insert Variable..." diff --git a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php index e45d378592f0413d4b10059b84606e16ff5a7cc9..cafdaa8927b9322b72a04cb8055d36cb676b9fa8 100644 --- a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php +++ b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php @@ -6,6 +6,7 @@ namespace Magento\Webapi\Controller\Soap\Request; use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\Framework\Api\MetadataObjectInterface; use Magento\Framework\Api\SimpleDataObjectConverter; use Magento\Framework\AuthorizationInterface; use Magento\Framework\Exception\AuthorizationException; @@ -154,7 +155,7 @@ class Handler } elseif (is_array($data)) { $dataType = substr($dataType, 0, -2); foreach ($data as $key => $value) { - if ($value instanceof ExtensibleDataInterface) { + if ($value instanceof ExtensibleDataInterface || $value instanceof MetadataObjectInterface) { $result[] = $this->_dataObjectConverter ->convertKeysToCamelCase($this->_dataObjectProcessor->buildOutputDataArray($value, $dataType)); } else { diff --git a/app/code/Magento/Webapi/Model/Config.php b/app/code/Magento/Webapi/Model/Config.php index af0823e23e7838d21fedcd31515728fc8f0dd91f..1691f95834932b1aa6e26ec2298a0fff0c7c36d9 100644 --- a/app/code/Magento/Webapi/Model/Config.php +++ b/app/code/Magento/Webapi/Model/Config.php @@ -70,65 +70,4 @@ class Config } return $this->services; } - - /** - * Identify the list of service name parts including sub-services using class name. - * - * Examples of input/output pairs: - * <pre> - * - 'Magento\Customer\Service\V1\CustomerAccountInterface', false => ['CustomerCustomerAccount'] - * - 'Vendor\Customer\Service\V1\Customer\AddressInterface', true => ['VendorCustomer', 'Address', 'V1'] - * </pre> - * - * @param string $className - * @param bool $preserveVersion Should version be preserved during class name conversion into service name - * @return string[] - * @throws \InvalidArgumentException When class is not valid API service. - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - */ - public function getServiceNameParts($className, $preserveVersion = false) - { - if (!preg_match(\Magento\Webapi\Model\Config::SERVICE_CLASS_PATTERN, $className, $matches)) { - $apiClassPattern = "#^(.+?)\\\\(.+?)\\\\Api\\\\(.+?)(Interface)?$#"; - preg_match($apiClassPattern, $className, $matches); - } - - if (!empty($matches)) { - $moduleNamespace = $matches[1]; - $moduleName = $matches[2]; - $moduleNamespace = ($moduleNamespace == 'Magento') ? '' : $moduleNamespace; - if ($matches[4] === 'Interface') { - $matches[4] = $matches[3]; - $matches[3] = 'V1'; - } - $serviceNameParts = explode('\\', trim($matches[4], '\\')); - if ($moduleName == $serviceNameParts[0]) { - /** Avoid duplication of words in service name */ - $moduleName = ''; - } - $parentServiceName = $moduleNamespace . $moduleName . array_shift($serviceNameParts); - array_unshift($serviceNameParts, $parentServiceName); - if ($preserveVersion) { - $serviceVersion = $matches[3]; - $serviceNameParts[] = $serviceVersion; - } - return $serviceNameParts; - } elseif (preg_match(\Magento\Webapi\Model\Config::API_PATTERN, $className, $matches)) { - $moduleNamespace = $matches[1]; - $moduleName = $matches[2]; - $moduleNamespace = ($moduleNamespace == 'Magento') ? '' : $moduleNamespace; - $serviceNameParts = explode('\\', trim($matches[3], '\\')); - if ($moduleName == $serviceNameParts[0]) { - /** Avoid duplication of words in service name */ - $moduleName = ''; - } - $parentServiceName = $moduleNamespace . $moduleName . array_shift($serviceNameParts); - array_unshift($serviceNameParts, $parentServiceName); - //Add temporary dummy version - $serviceNameParts[] = 'V1'; - return $serviceNameParts; - } - - throw new \InvalidArgumentException(sprintf('The service interface name "%s" is invalid.', $className)); - } } diff --git a/app/code/Magento/Webapi/Model/Config/Converter.php b/app/code/Magento/Webapi/Model/Config/Converter.php index 44a8b35ee635f05f536f055c6d063dd107643ac0..c9b557f099fa5c12d20498fd8b79155aa65675cc 100644 --- a/app/code/Magento/Webapi/Model/Config/Converter.php +++ b/app/code/Magento/Webapi/Model/Config/Converter.php @@ -26,11 +26,11 @@ class Converter implements \Magento\Framework\Config\ConverterInterface const KEY_DATA_PARAMETERS = 'parameters'; const KEY_SOURCE = 'source'; const KEY_METHOD = 'method'; + const KEY_METHODS = 'methods'; /**#@-*/ /** * {@inheritdoc} - * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -48,6 +48,13 @@ class Converter implements \Magento\Framework\Config\ConverterInterface $service = $route->getElementsByTagName('service')->item(0); $serviceClass = $service->attributes->getNamedItem('class')->nodeValue; $serviceMethod = $service->attributes->getNamedItem('method')->nodeValue; + $url = trim($route->attributes->getNamedItem('url')->nodeValue); + $version = $this->convertVersion($url); + + $serviceClassData = []; + if (isset($result[self::KEY_SERVICES][$serviceClass][$version])) { + $serviceClassData = $result[self::KEY_SERVICES][$serviceClass][$version]; + } $resources = $route->getElementsByTagName('resource'); $resourceReferences = []; @@ -62,48 +69,24 @@ class Converter implements \Magento\Framework\Config\ConverterInterface // For SOAP $resourcePermissionSet[] = $ref; } - if (!isset($result[self::KEY_SERVICES][$serviceClass][$serviceMethod][self::KEY_ACL_RESOURCES])) { - $result[self::KEY_SERVICES][$serviceClass][$serviceMethod][self::KEY_ACL_RESOURCES] - = $resourcePermissionSet; + + if (!isset($serviceClassData[self::KEY_METHODS][$serviceMethod])) { + $serviceClassData[self::KEY_METHODS][$serviceMethod][self::KEY_ACL_RESOURCES] = $resourcePermissionSet; } else { - $result[self::KEY_SERVICES][$serviceClass][$serviceMethod][self::KEY_ACL_RESOURCES] = + $serviceClassData[self::KEY_METHODS][$serviceMethod][self::KEY_ACL_RESOURCES] = array_unique( array_merge( - $result[self::KEY_SERVICES][$serviceClass][$serviceMethod][self::KEY_ACL_RESOURCES], + $serviceClassData[self::KEY_METHODS][$serviceMethod][self::KEY_ACL_RESOURCES], $resourcePermissionSet ) ); } - $parameters = $route->getElementsByTagName('parameter'); - $data = []; - /** @var \DOMElement $parameter */ - foreach ($parameters as $parameter) { - if ($parameter->nodeType != XML_ELEMENT_NODE) { - continue; - } - $name = $parameter->attributes->getNamedItem('name')->nodeValue; - $forceNode = $parameter->attributes->getNamedItem('force'); - $force = $forceNode ? (bool)$forceNode->nodeValue : false; - $value = $parameter->nodeValue; - $data[$name] = [ - self::KEY_FORCE => $force, - self::KEY_VALUE => ($value === 'null') ? null : $value, - ]; - $sourceNode = $parameter->attributes->getNamedItem('source'); - if ($sourceNode) { - $data[$name][self::KEY_SOURCE] = $sourceNode->nodeValue; - } - $methodNode = $parameter->attributes->getNamedItem('method'); - if ($methodNode) { - $data[$name][self::KEY_METHOD] = $methodNode->nodeValue; - } - } - $method = $route->attributes->getNamedItem('method')->nodeValue; - $url = trim($route->attributes->getNamedItem('url')->nodeValue); $secureNode = $route->attributes->getNamedItem('secure'); $secure = $secureNode ? (bool)trim($secureNode->nodeValue) : false; + $data = $this->convertMethodParameters($route->getElementsByTagName('parameter')); + // We could handle merging here by checking if the route already exists $result[self::KEY_ROUTES][$url][$method] = [ self::KEY_SECURE => $secure, @@ -114,12 +97,62 @@ class Converter implements \Magento\Framework\Config\ConverterInterface self::KEY_ACL_RESOURCES => $resourceReferences, self::KEY_DATA_PARAMETERS => $data, ]; + $serviceSecure = false; - if (isset($result[self::KEY_SERVICES][$serviceClass][$serviceMethod][self::KEY_SECURE])) { - $serviceSecure = $result[self::KEY_SERVICES][$serviceClass][$serviceMethod][self::KEY_SECURE]; + if (isset($serviceClassData[self::KEY_METHODS][$serviceMethod][self::KEY_SECURE])) { + $serviceSecure = $serviceClassData[self::KEY_METHODS][$serviceMethod][self::KEY_SECURE]; } - $result[self::KEY_SERVICES][$serviceClass][$serviceMethod][self::KEY_SECURE] = $serviceSecure || $secure; + $serviceClassData[self::KEY_METHODS][$serviceMethod][self::KEY_SECURE] = $serviceSecure || $secure; + + $result[self::KEY_SERVICES][$serviceClass][$version] = $serviceClassData; } return $result; } + + /** + * Parses the method parameters into a string array. + * + * @param \DOMNodeList $parameters + * @return array + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + protected function convertMethodParameters($parameters) + { + $data = []; + /** @var \DOMElement $parameter */ + foreach ($parameters as $parameter) { + if ($parameter->nodeType != XML_ELEMENT_NODE) { + continue; + } + $name = $parameter->attributes->getNamedItem('name')->nodeValue; + $forceNode = $parameter->attributes->getNamedItem('force'); + $force = $forceNode ? (bool)$forceNode->nodeValue : false; + $value = $parameter->nodeValue; + $data[$name] = [ + self::KEY_FORCE => $force, + self::KEY_VALUE => ($value === 'null') ? null : $value, + ]; + $sourceNode = $parameter->attributes->getNamedItem('source'); + if ($sourceNode) { + $data[$name][self::KEY_SOURCE] = $sourceNode->nodeValue; + } + $methodNode = $parameter->attributes->getNamedItem('method'); + if ($methodNode) { + $data[$name][self::KEY_METHOD] = $methodNode->nodeValue; + } + } + return $data; + } + + /** + * Derive the version from the provided URL. + * Assumes the version is the first portion of the URL. For example, '/V1/customers' + * + * @param string $url + * @return string + */ + protected function convertVersion($url) + { + return substr($url, 1, strpos($url, '/', 1)-1); + } } diff --git a/app/code/Magento/Webapi/Model/Soap/Config.php b/app/code/Magento/Webapi/Model/Soap/Config.php index 1d686f3f1f06f67083c01a4d7b2183b7a98dee04..70c89d3c12efd0b01707cdca5d2399f1d4d992d2 100644 --- a/app/code/Magento/Webapi/Model/Soap/Config.php +++ b/app/code/Magento/Webapi/Model/Soap/Config.php @@ -104,7 +104,7 @@ class Config /** * Retrieve the list of SOAP operations available in the system * - * @param array $requestedService The list of requested services with their versions + * @param array $requestedServices The list of requested services with their versions * @return array <pre> * array( * array( @@ -115,15 +115,15 @@ class Config * ... * )</pre> */ - protected function getSoapOperations($requestedService) + protected function getSoapOperations($requestedServices) { if (null == $this->soapOperations) { $this->soapOperations = []; - foreach ($this->getRequestedSoapServices($requestedService) as $serviceData) { + foreach ($this->getRequestedSoapServices($requestedServices) as $serviceName => $serviceData) { foreach ($serviceData[self::KEY_SERVICE_METHODS] as $methodData) { $method = $methodData[self::KEY_METHOD]; $class = $serviceData[self::KEY_CLASS]; - $operationName = $this->getSoapOperation($class, $method); + $operationName = $serviceName . ucfirst($method); $this->soapOperations[$operationName] = [ self::KEY_CLASS => $class, self::KEY_METHOD => $method, @@ -163,25 +163,27 @@ class Config protected function initServicesMetadata() { $soapServices = []; - foreach ($this->config->getServices()[Converter::KEY_SERVICES] as $serviceClass => $serviceData) { - $serviceName = $this->getServiceName($serviceClass); - foreach ($serviceData as $methodName => $methodMetadata) { - $soapServices[$serviceName][self::KEY_SERVICE_METHODS][$methodName] = [ - self::KEY_METHOD => $methodName, - self::KEY_IS_REQUIRED => (bool)$methodMetadata[Converter::KEY_SECURE], - self::KEY_IS_SECURE => $methodMetadata[Converter::KEY_SECURE], - self::KEY_ACL_RESOURCES => $methodMetadata[Converter::KEY_ACL_RESOURCES], - ]; - $soapServices[$serviceName][self::KEY_CLASS] = $serviceClass; + foreach ($this->config->getServices()[Converter::KEY_SERVICES] as $serviceClass => $serviceVersionData) { + foreach ($serviceVersionData as $version => $serviceData) { + $serviceName = $this->getServiceName($serviceClass, $version); + foreach ($serviceData[Converter::KEY_METHODS] as $methodName => $methodMetadata) { + $soapServices[$serviceName][self::KEY_SERVICE_METHODS][$methodName] = [ + self::KEY_METHOD => $methodName, + self::KEY_IS_REQUIRED => (bool)$methodMetadata[Converter::KEY_SECURE], + self::KEY_IS_SECURE => $methodMetadata[Converter::KEY_SECURE], + self::KEY_ACL_RESOURCES => $methodMetadata[Converter::KEY_ACL_RESOURCES], + ]; + $soapServices[$serviceName][self::KEY_CLASS] = $serviceClass; + } + $reflectedMethodsMetadata = $this->classReflector->reflectClassMethods( + $serviceClass, + $soapServices[$serviceName][self::KEY_SERVICE_METHODS] + ); + $soapServices[$serviceName][self::KEY_SERVICE_METHODS] = array_merge_recursive( + $soapServices[$serviceName][self::KEY_SERVICE_METHODS], + $reflectedMethodsMetadata + ); } - $reflectedMethodsMetadata = $this->classReflector->reflectClassMethods( - $serviceClass, - $soapServices[$serviceName][self::KEY_SERVICE_METHODS] - ); - $soapServices[$serviceName][self::KEY_SERVICE_METHODS] = array_merge_recursive( - $soapServices[$serviceName][self::KEY_SERVICE_METHODS], - $reflectedMethodsMetadata - ); } return $soapServices; @@ -225,7 +227,7 @@ class Config $soapServicesConfig = $this->getSoapServicesConfig(); foreach ($requestedServices as $serviceName) { if (isset($soapServicesConfig[$serviceName])) { - $services[] = $soapServicesConfig[$serviceName]; + $services[$serviceName] = $soapServicesConfig[$serviceName]; } } return $services; @@ -236,11 +238,12 @@ class Config * * @param string $interfaceName e.g. \Magento\Catalog\Api\ProductInterfaceV1 * @param string $methodName e.g. create + * @param string $version * @return string e.g. catalogProductCreate */ - public function getSoapOperation($interfaceName, $methodName) + public function getSoapOperation($interfaceName, $methodName, $version) { - $serviceName = $this->getServiceName($interfaceName); + $serviceName = $this->getServiceName($interfaceName, $version); $operationName = $serviceName . ucfirst($methodName); return $operationName; } @@ -270,13 +273,53 @@ class Config * </pre> * * @param string $interfaceName + * @param string $version * @param bool $preserveVersion Should version be preserved during interface name conversion into service name * @return string * @throws \InvalidArgumentException + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function getServiceName($interfaceName, $preserveVersion = true) + public function getServiceName($interfaceName, $version, $preserveVersion = true) { - $serviceNameParts = $this->config->getServiceNameParts($interfaceName, $preserveVersion); + if (!preg_match(\Magento\Webapi\Model\Config::SERVICE_CLASS_PATTERN, $interfaceName, $matches)) { + $apiClassPattern = "#^(.+?)\\\\(.+?)\\\\Api\\\\(.+?)(Interface)?$#"; + preg_match($apiClassPattern, $interfaceName, $matches); + } + + if (!empty($matches)) { + $moduleNamespace = $matches[1]; + $moduleName = $matches[2]; + $moduleNamespace = ($moduleNamespace == 'Magento') ? '' : $moduleNamespace; + if ($matches[4] === 'Interface') { + $matches[4] = $matches[3]; + } + $serviceNameParts = explode('\\', trim($matches[4], '\\')); + if ($moduleName == $serviceNameParts[0]) { + /** Avoid duplication of words in service name */ + $moduleName = ''; + } + $parentServiceName = $moduleNamespace . $moduleName . array_shift($serviceNameParts); + array_unshift($serviceNameParts, $parentServiceName); + if ($preserveVersion) { + $serviceNameParts[] = $version; + } + } elseif (preg_match(\Magento\Webapi\Model\Config::API_PATTERN, $interfaceName, $matches)) { + $moduleNamespace = $matches[1]; + $moduleName = $matches[2]; + $moduleNamespace = ($moduleNamespace == 'Magento') ? '' : $moduleNamespace; + $serviceNameParts = explode('\\', trim($matches[3], '\\')); + if ($moduleName == $serviceNameParts[0]) { + /** Avoid duplication of words in service name */ + $moduleName = ''; + } + $parentServiceName = $moduleNamespace . $moduleName . array_shift($serviceNameParts); + array_unshift($serviceNameParts, $parentServiceName); + if ($preserveVersion) { + $serviceNameParts[] = $version; + } + } else { + throw new \InvalidArgumentException(sprintf('The service interface name "%s" is invalid.', $interfaceName)); + } return lcfirst(implode('', $serviceNameParts)); } } diff --git a/app/code/Magento/Webapi/Model/Soap/Server.php b/app/code/Magento/Webapi/Model/Soap/Server.php index 541a47e2fe8dc0e22c544209280439a58f96081d..02370c9fc4f75302e884621d067eb3a5588cc7a0 100644 --- a/app/code/Magento/Webapi/Model/Soap/Server.php +++ b/app/code/Magento/Webapi/Model/Soap/Server.php @@ -14,11 +14,9 @@ class Server /**#@+ * Path in config to Webapi settings. */ - const CONFIG_PATH_WSDL_CACHE_ENABLED = 'webapi/soap/wsdl_cache_enabled'; - const CONFIG_PATH_SOAP_CHARSET = 'webapi/soap/charset'; - /**#@-*/ + const REQUEST_PARAM_SERVICES = 'services'; const REQUEST_PARAM_WSDL = 'wsdl'; @@ -101,16 +99,6 @@ class Server $this->_soapServerFactory = $soapServerFactory; $this->_typeProcessor = $typeProcessor; $this->_scopeConfig = $scopeConfig; - /** Enable or disable SOAP extension WSDL cache depending on Magento configuration. */ - $wsdlCacheEnabled = $this->_scopeConfig->isSetFlag( - self::CONFIG_PATH_WSDL_CACHE_ENABLED, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); - if ($wsdlCacheEnabled) { - ini_set('soap.wsdl_cache_enabled', '1'); - } else { - ini_set('soap.wsdl_cache_enabled', '0'); - } } /** diff --git a/app/code/Magento/Webapi/Test/Unit/Controller/RestTest.php b/app/code/Magento/Webapi/Test/Unit/Controller/RestTest.php index 734a50ea3e2a3b5e0de99fed4c66aea7a41ac936..30a175b6024bfaacf78b4079203ceffb36e2256b 100644 --- a/app/code/Magento/Webapi/Test/Unit/Controller/RestTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Controller/RestTest.php @@ -82,7 +82,7 @@ class RestTest extends \PHPUnit_Framework_TestCase * @var \PHPUnit_Framework_MockObject_MockObject */ protected $areaMock; - + /** * @var \Magento\Webapi\Controller\Rest\ParamsOverrider|\PHPUnit_Framework_MockObject_MockObject */ diff --git a/app/code/Magento/Webapi/Test/Unit/Model/Config/_files/webapi.php b/app/code/Magento/Webapi/Test/Unit/Model/Config/_files/webapi.php index 4f48117117fe5802137e04dc002b86c4a472a0f5..aecbdbde2dcecb4ea98897510899513cb08a7528 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/Config/_files/webapi.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/Config/_files/webapi.php @@ -6,26 +6,30 @@ return [ 'services' => [ 'Magento\Customer\Api\CustomerRepositoryInterface' => [ - 'getById' => [ - 'resources' => [ - 'Magento_Customer::customer_self', - 'Magento_Customer::read', - ], - 'secure' => false, - ], - 'save' => [ - 'resources' => [ - 'Magento_Customer::customer_self', - 'Magento_Customer::manage' - ], - 'secure' => true, - ], - 'deleteById' => [ - 'resources' => [ - 'Magento_Customer::manage', - 'Magento_Customer::delete', + 'V1' => [ + 'methods' => [ + 'getById' => [ + 'resources' => [ + 'Magento_Customer::customer_self', + 'Magento_Customer::read', + ], + 'secure' => false, + ], + 'save' => [ + 'resources' => [ + 'Magento_Customer::customer_self', + 'Magento_Customer::manage' + ], + 'secure' => true, + ], + 'deleteById' => [ + 'resources' => [ + 'Magento_Customer::manage', + 'Magento_Customer::delete', + ], + 'secure' => false, + ], ], - 'secure' => false, ], ], ], diff --git a/app/code/Magento/Webapi/Test/Unit/Model/Soap/ConfigTest.php b/app/code/Magento/Webapi/Test/Unit/Model/Soap/ConfigTest.php index 27a4024682396bc3a020703a55262c1b20e6b17a..6c747b1f54a973c3de6396642b3521c16009e242 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/Soap/ConfigTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/Soap/ConfigTest.php @@ -6,6 +6,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + /** * Class implements tests for \Magento\Webapi\Model\Soap\Config class. */ @@ -39,23 +41,31 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $servicesConfig = [ 'services' => [ 'Magento\Customer\Api\AccountManagementInterface' => [ - 'activate' => [ - 'resources' => [ - [ - 'Magento_Customer::manage', + 'V1' => [ + 'methods' => [ + 'activate' => [ + 'resources' => [ + [ + 'Magento_Customer::manage', + ], + ], + 'secure' => false, ], ], - 'secure' => false, ], ], 'Magento\Customer\Api\CustomerRepositoryInterface' => [ - 'getById' => [ - 'resources' => [ - [ - 'Magento_Customer::customer', + 'V1' => [ + 'methods' => [ + 'getById' => [ + 'resources' => [ + [ + 'Magento_Customer::customer', + ], + ], + 'secure' => false, ], ], - 'secure' => false, ], ], ], @@ -98,17 +108,18 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetRequestedSoapServices() { $expectedResult = [ - [ - 'methods' => [ - 'activate' => [ - 'method' => 'activate', - 'inputRequired' => '', - 'isSecure' => '', - 'resources' => [['Magento_Customer::manage']], + 'customerAccountManagementV1' => + [ + 'methods' => [ + 'activate' => [ + 'method' => 'activate', + 'inputRequired' => '', + 'isSecure' => '', + 'resources' => [['Magento_Customer::manage']], + ], ], + 'class' => 'Magento\Customer\Api\AccountManagementInterface', ], - 'class' => 'Magento\Customer\Api\AccountManagementInterface', - ], ]; $result = $this->_soapConfig->getRequestedSoapServices( ['customerAccountManagementV1', 'moduleBarV2', 'moduleBazV1'] @@ -135,58 +146,78 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $expectedResult = 'customerAccountManagementV1Activate'; $soapOperation = $this->_soapConfig - ->getSoapOperation('Magento\Customer\Api\AccountManagementInterface', 'activate'); + ->getSoapOperation('Magento\Customer\Api\AccountManagementInterface', 'activate', 'V1'); $this->assertEquals($expectedResult, $soapOperation); } + /** - * Test identifying service name parts including subservices using class name. + * Test identifying service name including subservices using class name. * - * @dataProvider serviceNamePartsDataProvider + * @dataProvider serviceNameDataProvider */ - public function testGetServiceNameParts($className, $preserveVersion, $expected) + public function testGetServiceName($className, $version, $preserveVersion, $expected) { - $actual = $this->_soapConfig->getServiceName($className, $preserveVersion); + $actual = $this->_soapConfig->getServiceName($className, $version, $preserveVersion); $this->assertEquals($expected, $actual); } /** - * Dataprovider for serviceNameParts + * Dataprovider for testGetServiceName * * @return string */ - public function serviceNamePartsDataProvider() + public function serviceNameDataProvider() { return [ - ['Magento\Customer\Api\AccountManagementInterface', false, 'customerAccountManagement'], - [ - 'Magento\Customer\Api\AddressRepositoryInterface', - true, - 'customerAddressRepositoryV1' - ], + ['Magento\Customer\Api\AccountManagementInterface', 'V1', false, 'customerAccountManagement'], + ['Magento\Customer\Api\AddressRepositoryInterface', 'V1', true, 'customerAddressRepositoryV1'], ]; } /** * @expectedException \InvalidArgumentException - * @dataProvider dataProviderForTestGetServiceNamePartsInvalidName + * @dataProvider dataProviderForTestGetServiceNameInvalidName */ - public function testGetServiceNamePartsInvalidName($interfaceClassName) + public function testGetServiceNameInvalidName($interfaceClassName, $version) { - $this->_soapConfig->getServiceName($interfaceClassName); + $this->_soapConfig->getServiceName($interfaceClassName, $version); } - public function dataProviderForTestGetServiceNamePartsInvalidName() + /** + * Dataprovider for testGetServiceNameInvalidName + * + * @return string + */ + public function dataProviderForTestGetServiceNameInvalidName() { return [ - ['BarV1Interface'], // Missed vendor, module, 'Service' - ['Service\\V1Interface'], // Missed vendor and module - ['Magento\\Foo\\Service\\BarVxInterface'], // Version number should be a number - ['Magento\\Foo\\Service\\BarInterface'], // Version missed - ['Magento\\Foo\\Service\\BarV1'], // 'Interface' missed - ['Foo\\Service\\BarV1Interface'], // Module missed - ['Foo\\BarV1Interface'] // Module and 'Service' missed + ['BarV1Interface', 'V1'], // Missed vendor, module, 'Service' + ['Service\\V1Interface', 'V1'], // Missed vendor and module + ['Magento\\Foo\\Service\\BarVxInterface', 'V1'], // Version number should be a number + ['Magento\\Foo\\Service\\BarInterface', 'V1'], // Version missed + ['Magento\\Foo\\Service\\BarV1', 'V1'], // 'Interface' missed + ['Foo\\Service\\BarV1Interface', 'V1'], // Module missed + ['Foo\\BarV1Interface', 'V1'] // Module and 'Service' missed ]; } + + public function testGetServiceMetadata() + { + $expectedResult = [ + 'methods' => [ + 'activate' => [ + 'method' => 'activate', + 'inputRequired' => '', + 'isSecure' => '', + 'resources' => [['Magento_Customer::manage']], + ], + ], + 'class' => 'Magento\Customer\Api\AccountManagementInterface', + ]; + $result = $this->_soapConfig->getServiceMetadata('customerAccountManagementV1'); + $this->assertEquals($expectedResult, $result); + + } } require_once realpath(__DIR__ . '/../../_files/test_interfaces.php'); diff --git a/app/code/Magento/Webapi/etc/adminhtml/system.xml b/app/code/Magento/Webapi/etc/adminhtml/system.xml index 9335abf34b7128239f69a3a0c9a6cff20e1e0ea9..12671fe2ba7793f4c17a7fd970d573b56c7c223f 100644 --- a/app/code/Magento/Webapi/etc/adminhtml/system.xml +++ b/app/code/Magento/Webapi/etc/adminhtml/system.xml @@ -19,11 +19,6 @@ <label>Default Response Charset</label> <comment>If empty, UTF-8 will be used.</comment> </field> - <field id="wsdl_cache_enabled" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Enable WSDL Cache</label> - <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> - <backend_model>Magento\Config\Model\Config\Backend\Store</backend_model> - </field> </group> </section> </system> diff --git a/app/code/Magento/Weee/etc/config.xml b/app/code/Magento/Weee/etc/config.xml index bf472cca89956ba848db6c37637832615fa0ee93..164097b1280fa003f1c8d62ed9db74efb31ee6cb 100644 --- a/app/code/Magento/Weee/etc/config.xml +++ b/app/code/Magento/Weee/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <sales> <totals_sort> diff --git a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml index 514906a84d00ff47e4d92a7c496fc691cf4fc4b4..6208eb2f551cfd9d1178a5ff0ab87495c9e14ef4 100644 --- a/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml +++ b/app/code/Magento/Weee/view/adminhtml/templates/renderer/tax.phtml @@ -48,9 +48,9 @@ $data = ['fptAttribute' => [ </div> <script data-role="row-template" type="text/x-magento-template"> - <tr id="<?php echo $block->getElement()->getHtmlId() ?>_weee_tax_row_<%= data.index %>" data-role="fpt-item-row"> + <tr id="<?php echo $block->getElement()->getHtmlId() ?>_weee_tax_row_<%- data.index %>" data-role="fpt-item-row"> <td class="col-website" <?php if (!$block->isMultiWebsites()): ?>style="display: none"<?php endif; ?>> - <select name="<?php echo $block->getElement()->getName() ?>[<%= data.index %>][website_id]" + <select name="<?php echo $block->getElement()->getName() ?>[<%- data.index %>][website_id]" class="<?php echo $block->getElement()->getClass() ?> website required-entry" data-role="select-website"> <?php foreach ($block->getWebsites() as $_websiteId => $_info): ?> <option value="<?php echo $_websiteId ?>"><?php echo $_info['name'] ?><?php if (!empty($_info['currency'])): ?>[<?php echo $_info['currency'] ?>]<?php endif; ?></option> @@ -58,26 +58,26 @@ $data = ['fptAttribute' => [ </select> </td> <td class="col-country"> - <select id="<?php echo $block->getElement()->getName() ?>_weee_tax_row_<%= data.index %>_country" - name="<?php echo $block->getElement()->getName() ?>[<%= data.index %>][country]" + <select id="<?php echo $block->getElement()->getName() ?>_weee_tax_row_<%- data.index %>_country" + name="<?php echo $block->getElement()->getName() ?>[<%- data.index %>][country]" class="<?php echo $block->getElement()->getClass() ?> country required-entry" data-role="select-country"> <?php foreach ($block->getCountries() as $_country): ?> <option value="<?php echo $_country['value'] ?>"><?php echo htmlspecialchars($_country['label']) ?></option> <?php endforeach ?> </select> - <select id="<?php echo $block->getElement()->getName() ?>_weee_tax_row_<%= data.index %>_state" - name="<?php echo $block->getElement()->getName() ?>[<%= data.index %>][state]" + <select id="<?php echo $block->getElement()->getName() ?>_weee_tax_row_<%- data.index %>_state" + name="<?php echo $block->getElement()->getName() ?>[<%- data.index %>][state]" class="<?php echo $block->getElement()->getClass() ?> state" disabled="" data-role="select-state"> <option value="0">*</option> </select> </td> <td class="col-tax"> - <input name="<?php echo $block->getElement()->getName() ?>[<%= data.index %>][price]" + <input name="<?php echo $block->getElement()->getName() ?>[<%- data.index %>][price]" class="<?php echo $block->getElement()->getClass() ?> required-entry validate-greater-than-zero" - type="text" value="<%= data.value %>"/> + type="text" value="<%- data.value %>"/> </td> <td class="col-action"> - <input name="<?php echo $block->getElement()->getName() ?>[<%= data.index %>][delete]" class="delete" type="hidden" value="" data-role="delete-fpt-item"/> + <input name="<?php echo $block->getElement()->getName() ?>[<%- data.index %>][delete]" class="delete" type="hidden" value="" data-role="delete-fpt-item"/> <?php echo $block->getChildHtml('delete_button') ?> </td> </tr> diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php index 9e879eb5c447417f2135c7c26d6682e8e8b02df2..367b9388e712658be041342d61c1c4983780e87d 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php @@ -130,13 +130,13 @@ class Layout extends \Magento\Backend\Block\Template implements \Magento\Framewo $selectBlock = $this->getLayout()->createBlock( 'Magento\Framework\View\Element\Html\Select' )->setName( - 'widget_instance[<%= data.id %>][page_group]' + 'widget_instance[<%- data.id %>][page_group]' )->setId( - 'widget_instance[<%= data.id %>][page_group]' + 'widget_instance[<%- data.id %>][page_group]' )->setClass( 'required-entry page_group_select select' )->setExtraParams( - "onchange=\"WidgetInstance.displayPageGroup(this.value+\'_<%= data.id %>\')\"" + "onchange=\"WidgetInstance.displayPageGroup(this.value+\'_<%- data.id %>\')\"" )->setOptions( $this->_getDisplayOnOptions() ); @@ -244,7 +244,7 @@ class Layout extends \Magento\Backend\Block\Template implements \Magento\Framewo $chooserBlock = $this->getLayout()->createBlock( 'Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser\Layout' )->setName( - 'widget_instance[<%= data.id %>][pages][layout_handle]' + 'widget_instance[<%- data.id %>][pages][layout_handle]' )->setId( 'layout_handle' )->setClass( @@ -270,7 +270,7 @@ class Layout extends \Magento\Backend\Block\Template implements \Magento\Framewo $chooserBlock = $this->getLayout()->createBlock( 'Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser\DesignAbstraction' )->setName( - 'widget_instance[<%= data.id %>][page_layouts][layout_handle]' + 'widget_instance[<%- data.id %>][page_layouts][layout_handle]' )->setId( 'layout_handle' )->setClass( 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 b472b456cb83fe44902b485b11b68d9e0dbd78ab..e713d016d789da9625a1c7fd68e66a7dc6d671fe 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 @@ -170,7 +170,7 @@ class Settings extends \Magento\Backend\Block\Widget\Form\Generic implements { return $this->getUrl( 'adminhtml/*/*', - ['_current' => true, 'code' => '<%= data.code %>', 'theme_id' => '<%= data.theme_id %>'] + ['_current' => true, 'code' => '<%- data.code %>', 'theme_id' => '<%- data.theme_id %>'] ); } diff --git a/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml b/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml index d7c9156e1abb285a6e91be4d568dc8af08ba4679..b3a294959551111b2dd789d1f6ead5b382606ed5 100644 --- a/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml +++ b/app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml @@ -17,16 +17,17 @@ </fieldset> <script> require([ + 'jquery', 'mage/template', "prototype", "extjs/ext-tree-checkbox" -], function (mageTemplate) { +], function (jQuery, mageTemplate) { //<![CDATA[ -var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id="page_group_container_<%= data.id %>">'+ +var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id="page_group_container_<%- data.id %>">'+ '<div class="fieldset-wrapper-title">'+ - '<label for="widget_instance[<%= data.id %>][page_group]">Display on <span class="required">*</span></label>'+ + '<label for="widget_instance[<%- data.id %>][page_group]">Display on <span class="required">*</span></label>'+ '<?php echo $block->getDisplayOnSelectHtml(); ?>'+ '<div class="actions">'+ <?php echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getRemoveLayoutButtonHtml()) ?> + @@ -34,10 +35,10 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '</div>'+ '<div class="fieldset-wrapper-content">'+ <?php foreach ($block->getDisplayOnContainers() as $container): ?> - '<div class="no-display <?php echo $container['code'] ?> group_container" id="<?php echo $container['name'] ?>_<%= data.id %>">'+ - '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>]" />'+ - '<input disabled="disabled" type="hidden" name="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>][page_id]" value="<%= data.page_id %>" />'+ - '<input disabled="disabled" type="hidden" class="layout_handle_pattern" name="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>][layout_handle]" value="<?php echo $container['layout_handle'] ?>" />'+ + '<div class="no-display <?php echo $container['code'] ?> group_container" id="<?php echo $container['name'] ?>_<%- data.id %>">'+ + '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>]" />'+ + '<input disabled="disabled" type="hidden" name="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>][page_id]" value="<%- data.page_id %>" />'+ + '<input disabled="disabled" type="hidden" class="layout_handle_pattern" name="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>][layout_handle]" value="<?php echo $container['layout_handle'] ?>" />'+ '<table cellspacing="0" class="data-table">'+ '<col width="200" />'+ '<thead>'+ @@ -50,10 +51,10 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '<tbody>'+ '<tr>'+ '<td>'+ - '<input disabled="disabled" type="radio" class="radio for_all" id="all_<?php echo $container['name'] ?>_<%= data.id %>" name="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>][for]" value="all" onclick="WidgetInstance.togglePageGroupChooser(this)" checked="checked" /> '+ - '<label for="all_<?php echo $container['name'] ?>_<%= data.id %>"><?php echo $block->escapeJsQuote(__('All')) ?></label><br />'+ - '<input disabled="disabled" type="radio" class="radio for_specific" id="specific_<?php echo $container['name'] ?>_<%= data.id %>" name="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>][for]" value="specific" onclick="WidgetInstance.togglePageGroupChooser(this)" /> '+ - '<label for="specific_<?php echo $container['name'] ?>_<%= data.id %>"><?php echo $block->escapeJsQuote(__('Specific %1', $container['label'])) ?></label>'+ + '<input disabled="disabled" type="radio" class="radio for_all" id="all_<?php echo $container['name'] ?>_<%- data.id %>" name="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>][for]" value="all" onclick="WidgetInstance.togglePageGroupChooser(this)" checked="checked" /> '+ + '<label for="all_<?php echo $container['name'] ?>_<%- data.id %>"><?php echo $block->escapeJsQuote(__('All')) ?></label><br />'+ + '<input disabled="disabled" type="radio" class="radio for_specific" id="specific_<?php echo $container['name'] ?>_<%- data.id %>" name="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>][for]" value="specific" onclick="WidgetInstance.togglePageGroupChooser(this)" /> '+ + '<label for="specific_<?php echo $container['name'] ?>_<%- data.id %>"><?php echo $block->escapeJsQuote(__('Specific %1', $container['label'])) ?></label>'+ '</td>'+ '<td>'+ '<div class="block_reference_container">'+ @@ -68,15 +69,15 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '</tr>'+ '</tbody>'+ '</table>'+ - '<div class="no-display chooser_container" id="<?php echo $container['name'] ?>_ids_<%= data.id %>">'+ - '<input disabled="disabled" type="hidden" class="is_anchor_only" name="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>][is_anchor_only]" value="<?php echo $container['is_anchor_only'] ?>" />'+ - '<input disabled="disabled" type="hidden" class="product_type_id" name="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>][product_type_id]" value="<?php echo $container['product_type_id'] ?>" />'+ + '<div class="no-display chooser_container" id="<?php echo $container['name'] ?>_ids_<%- data.id %>">'+ + '<input disabled="disabled" type="hidden" class="is_anchor_only" name="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>][is_anchor_only]" value="<?php echo $container['is_anchor_only'] ?>" />'+ + '<input disabled="disabled" type="hidden" class="product_type_id" name="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>][product_type_id]" value="<?php echo $container['product_type_id'] ?>" />'+ '<p>' + - '<input disabled="disabled" type="text" class="input-text entities" name="widget_instance[<%= data.id %>][<?php echo $container['name'] ?>][entities]" value="<%= data.<?php echo $container['name'] ?>_entities %>" readonly="readonly" /> ' + - '<a class="widget-option-chooser" href="javascript:void(0)" onclick="WidgetInstance.displayEntityChooser(\'<?php echo $container['code'] ?>\', \'<?php echo $container['name'] ?>_ids_<%= data.id %>\')" title="<?php echo $block->escapeJsQuote(__('Open Chooser')) ?>">' + + '<input disabled="disabled" type="text" class="input-text entities" name="widget_instance[<%- data.id %>][<?php echo $container['name'] ?>][entities]" value="<%- data.<?php echo $container['name'] ?>_entities %>" readonly="readonly" /> ' + + '<a class="widget-option-chooser" href="javascript:void(0)" onclick="WidgetInstance.displayEntityChooser(\'<?php echo $container['code'] ?>\', \'<?php echo $container['name'] ?>_ids_<%- data.id %>\')" title="<?php echo $block->escapeJsQuote(__('Open Chooser')) ?>">' + '<img src="<?php echo $block->getViewFileUrl('images/rule_chooser_trigger.gif') ?>" alt="<?php echo $block->escapeJsQuote(__('Open Chooser')); ?>" />' + '</a> ' + - '<a href="javascript:void(0)" onclick="WidgetInstance.hideEntityChooser(\'<?php echo $container['name'] ?>_ids_<%= data.id %>\')" title="<?php echo $block->escapeJsQuote(__('Apply')); ?>">' + + '<a href="javascript:void(0)" onclick="WidgetInstance.hideEntityChooser(\'<?php echo $container['name'] ?>_ids_<%- data.id %>\')" title="<?php echo $block->escapeJsQuote(__('Apply')); ?>">' + '<img src="<?php echo $block->getViewFileUrl('images/rule_component_apply.gif') ?>" alt="<?php echo $block->escapeJsQuote(__('Apply')); ?>" />' + '</a>' + '</p>'+ @@ -84,11 +85,11 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '</div>'+ '</div>'+ <?php endforeach; ?> -'<div class="no-display all_pages group_container" id="all_pages_<%= data.id %>">'+ - '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%= data.id %>][all_pages]" />'+ - '<input disabled="disabled" type="hidden" name="widget_instance[<%= data.id %>][all_pages][page_id]" value="<%= data.page_id %>" />'+ - '<input disabled="disabled" type="hidden" class="layout_handle_pattern" name="widget_instance[<%= data.id %>][all_pages][layout_handle]" value="default" />'+ - '<input disabled="disabled" type="hidden" class="for_all" name="widget_instance[<%= data.id %>][all_pages][for]" value="all" />'+ +'<div class="no-display all_pages group_container" id="all_pages_<%- data.id %>">'+ + '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%- data.id %>][all_pages]" />'+ + '<input disabled="disabled" type="hidden" name="widget_instance[<%- data.id %>][all_pages][page_id]" value="<%- data.page_id %>" />'+ + '<input disabled="disabled" type="hidden" class="layout_handle_pattern" name="widget_instance[<%- data.id %>][all_pages][layout_handle]" value="default" />'+ + '<input disabled="disabled" type="hidden" class="for_all" name="widget_instance[<%- data.id %>][all_pages][for]" value="all" />'+ '<table cellspacing="0" class="data-table">'+ '<col width="200" />'+ '<thead>'+ @@ -115,10 +116,10 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '</tbody>'+ '</table>'+ '</div>'+ -'<div class="no-display ignore-validate pages group_container" id="pages_<%= data.id %>">'+ - '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%= data.id %>][pages]" />'+ - '<input disabled="disabled" type="hidden" name="widget_instance[<%= data.id %>][pages][page_id]" value="<%= data.page_id %>" />'+ - '<input disabled="disabled" type="hidden" class="for_all" name="widget_instance[<%= data.id %>][pages][for]" value="all" />'+ +'<div class="no-display ignore-validate pages group_container" id="pages_<%- data.id %>">'+ + '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%- data.id %>][pages]" />'+ + '<input disabled="disabled" type="hidden" name="widget_instance[<%- data.id %>][pages][page_id]" value="<%- data.page_id %>" />'+ + '<input disabled="disabled" type="hidden" class="for_all" name="widget_instance[<%- data.id %>][pages][for]" value="all" />'+ '<table cellspacing="0" class="data-table">'+ '<col width="200" />'+ '<thead>'+ @@ -146,10 +147,10 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id=" '</tbody>'+ '</table>'+ '</div>'+ -'<div class="no-display ignore-validate pages group_container" id="page_layouts_<%= data.id %>">'+ - '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%= data.id %>][page_layouts]" />'+ - '<input disabled="disabled" type="hidden" name="widget_instance[<%= data.id %>][page_layouts][page_id]" value="<%= data.page_id %>" />'+ - '<input disabled="disabled" type="hidden" class="for_all" name="widget_instance[<%= data.id %>][page_layouts][for]" value="all" />'+ +'<div class="no-display ignore-validate pages group_container" id="page_layouts_<%- data.id %>">'+ + '<input disabled="disabled" type="hidden" class="container_name" name="__[container_name]" value="widget_instance[<%- data.id %>][page_layouts]" />'+ + '<input disabled="disabled" type="hidden" name="widget_instance[<%- data.id %>][page_layouts][page_id]" value="<%- data.page_id %>" />'+ + '<input disabled="disabled" type="hidden" class="for_all" name="widget_instance[<%- data.id %>][page_layouts][for]" value="all" />'+ '<table cellspacing="0" class="data-table">'+ '<col width="200" />'+ '<thead>'+ @@ -476,7 +477,7 @@ var WidgetInstance = { window.WidgetInstance = WidgetInstance; -Ext.onReady(function(){ +jQuery(function(){ <?php foreach ($block->getPageGroups() as $pageGroup): ?> WidgetInstance.addPageGroup(<?php echo Zend_Json::encode($pageGroup) ?>); <?php endforeach; ?> diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php index 671ca5c98c92fbd288d5dc446727ff2c00230bc7..9a86641155cc6c1bc7c2c6e428a6d5b5bcd068e5 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php @@ -30,12 +30,16 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock */ protected $_formKey; + /** @var \Magento\Customer\Helper\Session\CurrentCustomer */ + protected $currentCustomer; + /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Framework\App\Http\Context $httpContext * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param \Magento\Framework\Data\Form\FormKey $formKey + * @param \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer * @param array $data */ public function __construct( @@ -44,16 +48,18 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, \Magento\Framework\Data\Form\FormKey $formKey, + \Magento\Customer\Helper\Session\CurrentCustomer $currentCustomer, array $data = [] ) { - $this->_formKey = $formKey; - $this->_helperPool = $helperPool; parent::__construct( $context, $httpContext, $productRepository, $data ); + $this->_formKey = $formKey; + $this->_helperPool = $helperPool; + $this->currentCustomer = $currentCustomer; } /** @@ -209,4 +215,16 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock ['wishlist_id' => $this->getWishlistInstance()->getId(), 'form_key' => $this->_formKey->getFormKey()] ); } + + /** + * @return string + */ + protected function _toHtml() + { + if ($this->currentCustomer->getCustomerId()) { + return parent::_toHtml(); + } else { + return ''; + } + } } diff --git a/app/code/Magento/Wishlist/Controller/Index/Add.php b/app/code/Magento/Wishlist/Controller/Index/Add.php index d19ecf32ff670c82b1ff4045a4557cf7f9340e37..997590a667ded0dfeea35e441ed5d1759b45f7e4 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Add.php +++ b/app/code/Magento/Wishlist/Controller/Index/Add.php @@ -112,10 +112,6 @@ class Add extends Action\Action implements IndexInterface $referer = $this->_redirect->getRefererUrl(); } - /** - * Set referer to avoid referring to the compare popup window - */ - $session->setAddActionReferer($referer); /** @var $helper \Magento\Wishlist\Helper\Data */ $helper = $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); diff --git a/app/code/Magento/Wishlist/Controller/Index/Index.php b/app/code/Magento/Wishlist/Controller/Index/Index.php index 12fa1224384affd7e608c486aa87831a6d0ce909..56f08a2e53190b4d28b46d11c9e23642c6b72ea5 100644 --- a/app/code/Magento/Wishlist/Controller/Index/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index/Index.php @@ -17,22 +17,14 @@ class Index extends Action\Action implements IndexInterface */ protected $wishlistProvider; - /** - * @var \Magento\Customer\Model\Session - */ - protected $_customerSession; - /** * @param Action\Context $context - * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Wishlist\Controller\WishlistProviderInterface $wishlistProvider */ public function __construct( Action\Context $context, - \Magento\Customer\Model\Session $customerSession, \Magento\Wishlist\Controller\WishlistProviderInterface $wishlistProvider ) { - $this->_customerSession = $customerSession; $this->wishlistProvider = $wishlistProvider; parent::__construct($context); } @@ -49,19 +41,7 @@ class Index extends Action\Action implements IndexInterface throw new NotFoundException(); } $this->_view->loadLayout(); - - $session = $this->_customerSession; - $block = $this->_view->getLayout()->getBlock('customer.wishlist'); - $referer = $session->getAddActionReferer(true); - if ($block) { - $block->setRefererUrl($this->_redirect->getRefererUrl()); - if ($referer) { - $block->setRefererUrl($referer); - } - } - $this->_view->getLayout()->initMessages(); - $this->_view->renderLayout(); } } diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index fcff26f30b664a28a1c1866ed00ecced2d49bd64..0914b03d69877239bf3678b47a5001fd78da1974 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -387,7 +387,14 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper protected function _getCartUrlParameters($item) { $continueUrl = $this->urlEncoder->encode( - $this->_getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true, '_scope_to_url' => true]) + $this->_getUrl( + 'wishlist/index/index', + [ + '_current' => true, + '_use_rewrite' => true, + '_scope_to_url' => true + ] + ) ); return [ diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/AddTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/AddTest.php index 7efb091fa1718dbf272bd2d56c95f400f26dcde2..6b6695e96fa80008a4b0010f77c751f0c8f88e3a 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/AddTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/AddTest.php @@ -255,7 +255,7 @@ class AddTest extends \PHPUnit_Framework_TestCase ->method('getParams') ->will($this->returnValue([])); - $om = $this->getMock('Magento\Framework\App\ObjectManager', null, [], '', false ); + $om = $this->getMock('Magento\Framework\App\ObjectManager', null, [], '', false); $response = $this->getMock('Magento\Framework\App\Response\Http', null, [], '', false); $eventManager = $this->getMock('Magento\Framework\Event\Manager', null, [], '', false); $url = $this->getMock('Magento\Framework\Url', null, [], '', false); @@ -350,9 +350,9 @@ class AddTest extends \PHPUnit_Framework_TestCase ->method('getParams') ->will($this->returnValue(['product' => 2])); - $om = $this->getMock('Magento\Framework\App\ObjectManager', null, [], '', false ); + $om = $this->getMock('Magento\Framework\App\ObjectManager', null, [], '', false); $response = $this->getMock('Magento\Framework\App\Response\Http', null, [], '', false); - $eventManager = $this->getMock('Magento\Framework\Event\Manager', null, [], '', false ); + $eventManager = $this->getMock('Magento\Framework\Event\Manager', null, [], '', false); $url = $this->getMock('Magento\Framework\Url', null, [], '', false); $actionFlag = $this->getMock('Magento\Framework\App\ActionFlag', null, [], '', false); $redirect = $this->getMock('\Magento\Store\App\Response\Redirect', ['redirect'], [], '', false); @@ -460,9 +460,9 @@ class AddTest extends \PHPUnit_Framework_TestCase ->method('getParams') ->will($this->returnValue(['product' => 2])); - $om = $this->getMock('Magento\Framework\App\ObjectManager', null, [], '', false ); + $om = $this->getMock('Magento\Framework\App\ObjectManager', null, [], '', false); $response = $this->getMock('Magento\Framework\App\Response\Http', null, [], '', false); - $eventManager = $this->getMock('Magento\Framework\Event\Manager', null, [], '', false ); + $eventManager = $this->getMock('Magento\Framework\Event\Manager', null, [], '', false); $url = $this->getMock('Magento\Framework\Url', null, [], '', false); $actionFlag = $this->getMock('Magento\Framework\App\ActionFlag', null, [], '', false); $redirect = $this->getMock('\Magento\Store\App\Response\Redirect', ['redirect'], [], '', false); @@ -589,7 +589,7 @@ class AddTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($product)); $exception = new \Exception('Exception'); - $wishListItem = new \stdClass(); + $wishListItem = new \stdClass(); $wishlist = $this->getMock('Magento\Wishlist\Model\Wishlist', ['addNewItem', 'save', 'getId'], [], '', false); $wishlist @@ -649,8 +649,8 @@ class AddTest extends \PHPUnit_Framework_TestCase ->method('critical') ->with($exception) ->will($this->returnValue(true)); - - $om = $this->getMock('Magento\Framework\App\ObjectManager', ['get'], [], '', false ); + + $om = $this->getMock('Magento\Framework\App\ObjectManager', ['get'], [], '', false); $om ->expects($this->at(0)) ->method('get') @@ -671,9 +671,9 @@ class AddTest extends \PHPUnit_Framework_TestCase ->method('get') ->with('Psr\Log\LoggerInterface') ->will($this->returnValue($logger)); - + $response = $this->getMock('Magento\Framework\App\Response\Http', null, [], '', false); - $eventManager = $this->getMock('Magento\Framework\Event\Manager', ['dispatch'], [], '', false ); + $eventManager = $this->getMock('Magento\Framework\Event\Manager', ['dispatch'], [], '', false); $eventManager ->expects($this->once()) ->method('dispatch') @@ -757,11 +757,6 @@ class AddTest extends \PHPUnit_Framework_TestCase ->expects($this->once()) ->method('getBeforeWishlistUrl') ->will($this->returnValue('http://test-url.com')); - $this->customerSession - ->expects($this->once()) - ->method('setAddActionReferer') - ->with('http://test-url.com') - ->will($this->returnValue(null)); $this->customerSession ->expects($this->once()) ->method('setBeforeWishlistUrl') diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/IndexTest.php index e247ea5fbd595450f3558c82c0ba5ea7a08e1c3f..7199faa0652cb2eb5d9af9f4f585d83bd47c1113 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/IndexTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/IndexTest.php @@ -28,11 +28,6 @@ class IndexTest extends \PHPUnit_Framework_TestCase */ protected $wishlistProvider; - /** - * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject - */ - protected $customerSession; - /** * @var \Magento\Framework\App\View|\PHPUnit_Framework_MockObject_MockObject */ @@ -48,7 +43,6 @@ class IndexTest extends \PHPUnit_Framework_TestCase $this->context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false); $this->request = $this->getMock('Magento\Framework\App\Request\Http', [], [], '', false); $this->response = $this->getMock('Magento\Framework\App\Response\Http', [], [], '', false); - $this->customerSession = $this->getMock('Magento\Customer\Model\Session', [], [], '', false); $this->wishlistProvider = $this->getMock('Magento\Wishlist\Controller\WishlistProvider', [], [], '', false); $this->view = $this->getMock('Magento\Framework\App\View', [], [], '', false); $this->redirect = $this->getMock('\Magento\Store\App\Response\Redirect', [], [], '', false); @@ -105,7 +99,6 @@ class IndexTest extends \PHPUnit_Framework_TestCase $this->prepareContext(); return new \Magento\Wishlist\Controller\Index\Index( $this->context, - $this->customerSession, $this->wishlistProvider ); } @@ -126,29 +119,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase { $wishlist = $this->getMock('Magento\Wishlist\Model\Wishlist', [], [], '', false); - $block = $this->getMock('Magento\Ui\Component\Form\Element\Input', [], [], '', false); - $block - ->expects($this->at(0)) - ->method('__call') - ->with('setRefererUrl', ['http://referer-url-test.com']) - ->willReturn(true); - $block - ->expects($this->at(1)) - ->method('__call') - ->with('setRefererUrl', ['http://referer-url.com']) - ->willReturn(true); - - $this->redirect - ->expects($this->once()) - ->method('getRefererUrl') - ->willReturn('http://referer-url-test.com'); - $layout = $this->getMock('Magento\Framework\View\Layout', [], [], '', false); - $layout - ->expects($this->once()) - ->method('getBlock') - ->with('customer.wishlist') - ->willReturn($block); $layout ->expects($this->once()) ->method('initMessages') @@ -164,7 +135,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase ->method('loadLayout') ->willReturn(true); $this->view - ->expects($this->exactly(2)) + ->expects($this->once()) ->method('getLayout') ->willReturn($layout); $this->view @@ -172,12 +143,6 @@ class IndexTest extends \PHPUnit_Framework_TestCase ->method('renderLayout') ->willReturn(true); - $this->customerSession - ->expects($this->once()) - ->method('__call') - ->with('getAddActionReferer', [true]) - ->willReturn('http://referer-url.com'); - $this->getController()->execute(); } } diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php index 6a317fb288eb3dd3ddb7412562778d444093bb26..f971e7af207e8780a89b6743121875a2a93b1ef2 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Index/UpdateItemOptionsTest.php @@ -182,12 +182,11 @@ class UpdateItemOptionsTest extends \PHPUnit_Framework_TestCase ->with('product') ->willReturn(2); - $exception = $this->getMock('Magento\Framework\Exception\NoSuchEntityException', [], [], '', false); $this->productRepository ->expects($this->once()) ->method('getById') ->with(2) - ->willThrowException($exception); + ->willThrowException(new \Magento\Framework\Exception\NoSuchEntityException()); $this->messageManager ->expects($this->once()) @@ -369,16 +368,15 @@ class UpdateItemOptionsTest extends \PHPUnit_Framework_TestCase ->with('wishlist_update_item', ['wishlist' => $wishlist, 'product' => $product, 'item' => $item]) ->willReturn(true); - $exception = $this->getMock('\Magento\Framework\Exception\LocalizedException', [], [], '', false); $this->messageManager ->expects($this->once()) ->method('addSuccess') ->with('Test name has been updated in your wish list.', null) - ->willThrowException($exception); + ->willThrowException(new \Magento\Framework\Exception\LocalizedException('error-message')); $this->messageManager ->expects($this->once()) ->method('addError') - ->with('', null) + ->with('error-message', null) ->willReturn(true); $this->redirect @@ -399,7 +397,7 @@ class UpdateItemOptionsTest extends \PHPUnit_Framework_TestCase $item = $this->getMock('Magento\Wishlist\Model\Item', [], [], '', false); $helper = $this->getMock('Magento\Wishlist\Helper\Data', [], [], '', false); $logger = $this->getMock('Magento\Framework\Logger\Monolog', [], [], '', false); - $exception = $this->getMock('Exception', [], [], '', false); + $exception = new \Exception(); $logger ->expects($this->once()) diff --git a/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php b/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php index 5bb6173097935c6100c2fa4b4ad1902fd7776e71..08108bf77b12d79d8f9768eceac6c0db4ecf24d3 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Helper/DataTest.php @@ -72,7 +72,7 @@ class DataTest extends \PHPUnit_Framework_TestCase } else { $urlBuilder->expects($this->any()) ->method('getUrl') - ->with('*/*/*', ['_current' => true, '_use_rewrite' => true, '_scope_to_url' => true]) + ->with('wishlist/index/index', ['_current' => true, '_use_rewrite' => true, '_scope_to_url' => true]) ->will($this->returnValue($this->url)); } diff --git a/app/code/Magento/Wishlist/etc/config.xml b/app/code/Magento/Wishlist/etc/config.xml index cdb6ad259a73c23099cc0e14420d84242e45efab..77c070c2b505b4679a54b7dfbd36e5295955be49 100644 --- a/app/code/Magento/Wishlist/etc/config.xml +++ b/app/code/Magento/Wishlist/etc/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Store/etc/config.xsd"> <default> <wishlist> <general> diff --git a/app/code/Magento/Wishlist/etc/frontend/page_types.xml b/app/code/Magento/Wishlist/etc/frontend/page_types.xml index cd44dd1f773edd2f4e179b0d24f5eb5b888d10c0..9d938ce725b41fca3bbdf872201865c8bca55131 100644 --- a/app/code/Magento/Wishlist/etc/frontend/page_types.xml +++ b/app/code/Magento/Wishlist/etc/frontend/page_types.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Core/etc/page_types.xsd"> +<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd"> <type id="wishlist_index_index" label="Customer My Account My Wish List"/> <type id="wishlist_index_share" label="Customer My Account Wish List Sharing Form"/> <type id="wishlist_shared_index" label="Customer Shared Wish List View"/> diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml index 874fa3beb833d6396c21af38e820c31521851564..b67ab0352d844cb2edd890d8b2b00b2593cdac7f 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure.xml @@ -9,7 +9,7 @@ <update handle="catalog_product_view"/> <body> <referenceContainer name="product.info.social"> - <block class="Magento\Wishlist\Block\Item\Configure" name="product.info.addto" as="addto" template="Magento_Wishlist::item/configure/addto.phtml"/> + <block class="Magento\Wishlist\Block\Item\Configure" name="product.info.addto" as="addto" template="Magento_Wishlist::item/configure/addto.phtml" cacheable="false"/> </referenceContainer> </body> </page> diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml index 5f000a79c1859578ac853abd49df7f58ad7d65e1..6943f7e2ee4f9407a94822274ea69ac442d37747 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_index.xml @@ -12,12 +12,12 @@ <block class="Magento\Framework\View\Element\Js\Components" name="wishlist_head_components" template="Magento_Wishlist::js/components.phtml"/> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Wishlist\Block\Customer\Wishlist" name="customer.wishlist" template="view.phtml" cacheable="false"> + <block class="Magento\Wishlist\Block\Customer\Wishlist" name="customer.wishlist" template="view.phtml"> <block class="Magento\Wishlist\Block\Rss\Link" name="wishlist.rss.link" template="rss/wishlist.phtml"/> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Items" name="customer.wishlist.items" as="items" template="item/list.phtml" cacheable="false"> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Image" name="customer.wishlist.item.image" template="item/column/image.phtml" cacheable="false"/> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Info" name="customer.wishlist.item.name" template="item/column/name.phtml" cacheable="false"/> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.price" template="item/column/price.phtml" cacheable="false"> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Items" name="customer.wishlist.items" as="items" template="item/list.phtml"> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Image" name="customer.wishlist.item.image" template="item/column/image.phtml"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Info" name="customer.wishlist.item.name" template="item/column/name.phtml"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.price" template="item/column/price.phtml"> <block class="Magento\Catalog\Pricing\Render" name="product.price.render.wishlist"> <arguments> <argument name="price_render" xsi:type="string">product.price.render.default</argument> @@ -26,36 +26,36 @@ <argument name="zone" xsi:type="string">item_list</argument> </arguments> </block> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Options" name="customer.wishlist.item.options" cacheable="false"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Options" name="customer.wishlist.item.options"/> </block> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.inner" template="item/column/actions.phtml" cacheable="false"> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.inner" template="item/column/actions.phtml"> <arguments> <argument name="css_class" xsi:type="string">product-item-inner</argument> </arguments> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Comment" name="customer.wishlist.item.comment" template="item/column/comment.phtml" cacheable="false"> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Comment" name="customer.wishlist.item.comment" template="item/column/comment.phtml"> <arguments> <argument name="title" translate="true" xsi:type="string">Product Details and Comment</argument> </arguments> </block> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.cart" template="item/column/cart.phtml" cacheable="false"> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Cart" name="customer.wishlist.item.cart" template="item/column/cart.phtml"> <arguments> <argument name="title" translate="true" xsi:type="string">Add to Cart</argument> </arguments> </block> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.actions" template="item/column/actions.phtml" cacheable="false"> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Actions" name="customer.wishlist.item.actions" template="item/column/actions.phtml"> <arguments> <argument name="css_class" xsi:type="string">product-item-actions</argument> </arguments> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Edit" name="customer.wishlist.item.edit" template="item/column/edit.phtml" before="-" cacheable="false"/> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Remove" name="customer.wishlist.item.remove" template="item/column/remove.phtml" cacheable="false"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Edit" name="customer.wishlist.item.edit" template="item/column/edit.phtml" before="-"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Item\Column\Remove" name="customer.wishlist.item.remove" template="item/column/remove.phtml"/> </block> </block> </block> <container name="customer.wishlist.buttons" as="control_buttons" label="Wishlist Control Buttons"> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.update" template="button/update.phtml" cacheable="false"/> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.share" template="button/share.phtml" cacheable="false"/> - <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.toCart" template="button/tocart.phtml" cacheable="false"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.update" template="button/update.phtml"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.share" template="button/share.phtml"/> + <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.toCart" template="button/tocart.phtml"/> </container> </block> </referenceContainer> diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml index bbd6e63589e08eb13901d6d12e858b62f108d21f..5a5133f980e51888c900ff3c31f864540c1b1cb4 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/item/configure/addto.phtml @@ -22,15 +22,10 @@ </a> <?php endif; ?> </div> -<script> - require([ - "jquery", - "mage/mage" - ], function(jQuery){ - - jQuery('body').mage('addToWishlist', - <?php echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode(['productType' => $_product->getTypeId()])?> - ); - - }); -</script> +<script type="text/x-magento-init"> + { + "body": { + "addToWishlist": <?php echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode(['productType' => $_product->getTypeId()])?> + } + } +</script> \ No newline at end of file diff --git a/app/code/Magento/Wishlist/view/frontend/templates/shared.phtml b/app/code/Magento/Wishlist/view/frontend/templates/shared.phtml index 9b145c00421d1ac1884b166358cf13ac9d081aef..9a94c0a193811fa75baa0a8cc99aaa121adfbde4 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/shared.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/shared.phtml @@ -11,7 +11,7 @@ $imageBlock = $block->getLayout()->createBlock('Magento\Catalog\Block\Product\I ?> <?php if ($block->hasWishlistItems()): ?> - <form class="form shared wishlist" action="<?php echo $block->getUrl('*/*/update') ?>" method="post"> + <form class="form shared wishlist" action="<?php echo $block->getUrl('wishlist/index/update') ?>" method="post"> <div class="wishlist table-wrapper"> <table class="table data wishlist" id="wishlist-table"> <caption class="table-caption"><?php echo __('Wish List'); ?></caption> diff --git a/app/code/Magento/Wishlist/view/frontend/templates/view.phtml b/app/code/Magento/Wishlist/view/frontend/templates/view.phtml index 836074bbae2f72122ce7c0e3dad96adc1b6b361f..035364489f3caa8386c6d57bd34e6994b2d965ac 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/view.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/view.phtml @@ -25,7 +25,7 @@ "confirmRemoveMessage":"<?php echo __("Are you sure you want to remove this product from your wishlist?") ?>", "addAllToCartUrl":"<?php echo $block->getAddAllToCartUrl(); ?>", "commentString":""}, - "validation": {}}' action="<?php echo $block->getUrl('*/*/update', ['wishlist_id' => $block->getWishlistInstance()->getId()]) ?>" method="post"> + "validation": {}}' action="<?php echo $block->getUrl('wishlist/index/update', ['wishlist_id' => $block->getWishlistInstance()->getId()]) ?>" method="post"> <?php echo $block->getChildHtml('top'); ?> <?php if ($block->hasWishlistItems()): ?> <?php echo $block->getBlockHtml('formkey');?> @@ -47,17 +47,17 @@ </div> </form> <script id="form-tmpl" type="text/x-magento-template"> - <form id="wishlist-hidden-form" method="post" action="<%= data.url %>" class="no-display"> + <form id="wishlist-hidden-form" method="post" action="<%- data.url %>" class="no-display"> <% if (data.qty) { %> - <input name="qty" value="<%= data.qty %>"> + <input name="qty" value="<%- data.qty %>"> <% } %> <% if (data.item) { %> - <input name="item" value="<%= data.item %>"> + <input name="item" value="<%- data.item %>"> <% } %> <% if (data.entity) { %> - <input name="entity" value="<%= data.entity %>"> + <input name="entity" value="<%- data.entity %>"> <% } %> </form> </script> diff --git a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less index e96d4b1f33cecb1eb25ddb04e38e4a78934f2bae..35ecf5e74e4fca8cdb6d78ad77368808c74a5066 100644 --- a/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less @@ -210,6 +210,13 @@ .product-reviews-summary .reviews-actions { .font-size(@font-size__base); } + .product-options-wrapper { + .field { + .note { + display: block; + } + } + } } .product-info-main, diff --git a/app/design/frontend/Magento/blank/Magento_CatalogSearch/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_CatalogSearch/web/css/source/_module.less index 2217a6cf6e39b5ea20b35374044fac7fefe94b4a..66009f0069383e2a7f2352c3cc90a784ce45b42b 100644 --- a/app/design/frontend/Magento/blank/Magento_CatalogSearch/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_CatalogSearch/web/css/source/_module.less @@ -22,6 +22,9 @@ display: none; } } + .block-content { + margin-bottom: 0; + } .label { .icon-font( @_icon-font-content: @icon-search, diff --git a/app/design/frontend/Magento/blank/web/css/source/_forms.less b/app/design/frontend/Magento/blank/web/css/source/_forms.less index 7d172a1ddaa54005a265cace63d7b958ff6909f7..563084653f5611d0b8877b492d984b77cac69e91 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_forms.less +++ b/app/design/frontend/Magento/blank/web/css/source/_forms.less @@ -92,7 +92,9 @@ select:focus ~ .tooltip .tooltip-content { margin: 0; > .field:not(.choice) >, .fields > .field { - margin: 0 0 @form-field__vertical-indent; + &:not(:last-child) { + margin: 0 0 @form-field__vertical-indent; + } .label { margin: 0 0 4px; padding: 0 0 @indent__xs; diff --git a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less index 95aded3d85ad63e0ec74da5035e4ca60e26c54e2..839f0571a4a4d7b56002f25d4fe7b2d5004e4107 100644 --- a/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less @@ -249,6 +249,14 @@ margin-top: @form-field__vertical-indent; } } + .product-options-wrapper { + .field { + .note { + display: block; + .css(margin-top, @indent__xs); + } + } + } } .product-options-bottom .price-box, diff --git a/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less index d2a5755580a566f7dc8fb679dae7bed14df3e8ec..c51347a3b6e9b5ffae159d4604c82511a9d6fbe3 100644 --- a/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less @@ -22,6 +22,9 @@ display: none; } } + .block-content { + margin-bottom: 0; + } .label { .icon-font( @_icon-font-content: @icon-search, @@ -61,7 +64,6 @@ .nested { display: none; } - } .search-autocomplete { diff --git a/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less index 15f34bcbb6588e7be51ec879682f277f9045dee6..a38d28d2443c18e53258eec7ee2343a946cd48c1 100644 --- a/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less @@ -137,8 +137,10 @@ //-------------------------------------- .block { &:extend(.abs-margin-for-blocks-and-widgets all); - &:last-child { - margin-bottom: 0; + .column.main & { + &:last-child { + margin-bottom: 0; + } } .title { strong { diff --git a/app/design/frontend/Magento/luma/web/css/source/_forms.less b/app/design/frontend/Magento/luma/web/css/source/_forms.less index 8c882c19f315aff01d8a282acfd310eaf0dabca5..e9a975768c81f2216d0adc5cc5830bd611f595fc 100644 --- a/app/design/frontend/Magento/luma/web/css/source/_forms.less +++ b/app/design/frontend/Magento/luma/web/css/source/_forms.less @@ -117,7 +117,9 @@ select:focus ~ .tooltip .tooltip-content { margin: 0; > .field:not(.choice) >, .fields > .field { - margin: 0 0 @form-field__vertical-indent; + &:not(:last-child) { + margin: 0 0 @form-field__vertical-indent; + } .label { margin: 0 0 4px; padding: 0 0 @indent__xs; diff --git a/app/etc/di.xml b/app/etc/di.xml index 6ae1eaa1529f5d0f392f41de92ef6248fa7d94f0..fe752e71c22539f98bb5247288575f86ee683aad 100755 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -82,8 +82,8 @@ <preference for="Magento\Framework\Mview\View\SubscriptionInterface" type="Magento\Framework\Mview\View\Subscription" /> <preference for="Magento\Framework\Mview\View\ChangelogInterface" type="Magento\Framework\Mview\View\Changelog" /> <preference for="Magento\Framework\View\Design\FileResolution\Fallback\CacheDataInterface" type="Magento\Framework\View\Design\FileResolution\Fallback\CacheData\Flat"/> - <preference for="Magento\Framework\Api\AttributeMetadataBuilderInterface" type="Magento\Framework\Api\AttributeMetadataBuilder"/> - <preference for="Magento\Framework\Api\MetadataServiceInterface" type="Magento\Framework\Api\Config\MetadataConfig"/> + <preference for="Magento\Framework\Api\MetadataServiceInterface" type="Magento\Framework\Api\DefaultMetadataService"/> + <preference for="Magento\Framework\Api\MetadataObjectInterface" type="Magento\Framework\Api\AttributeMetadata"/> <preference for="Magento\Framework\Api\SearchCriteriaInterface" type="Magento\Framework\Api\SearchCriteria"/> <preference for="Magento\Framework\App\Rss\UrlBuilderInterface" type="Magento\Framework\App\Rss\UrlBuilder"/> <preference for="Magento\Framework\DB\LoggerInterface" type="Magento\Framework\DB\Logger\Null"/> @@ -671,27 +671,6 @@ <argument name="raise_php_limits" xsi:type="boolean">false</argument> </arguments> </type> - <type name="Magento\Framework\View\Asset\PreProcessor\Pool"> - <arguments> - <argument name="preProcessors" xsi:type="array"> - <item name="less" xsi:type="array"> - <item name="css" xsi:type="array"> - <item name="less_css" xsi:type="string">Magento\Framework\Css\PreProcessor\Less</item> - <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item> - </item> - <item name="less" xsi:type="array"> - <item name="magento_import" xsi:type="string">Magento\Framework\Less\PreProcessor\Instruction\MagentoImport</item> - <item name="import" xsi:type="string">Magento\Framework\Less\PreProcessor\Instruction\Import</item> - </item> - </item> - <item name="css" xsi:type="array"> - <item name="css" xsi:type="array"> - <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item> - </item> - </item> - </argument> - </arguments> - </type> <type name="Magento\Framework\App\DefaultPath\DefaultPath"> <arguments> <argument name="parts" xsi:type="array"> diff --git a/composer.json b/composer.json index e29f9de8be6ff85c6eeebf84e5da449dedeba559..aad787f6282507de20e66d00875d130a09c659cc 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,6 @@ "magento/module-configurable-product": "self.version", "magento/module-contact": "self.version", "magento/module-cookie": "self.version", - "magento/module-core": "self.version", "magento/module-cron": "self.version", "magento/module-currency-symbol": "self.version", "magento/module-customer": "self.version", diff --git a/composer.lock b/composer.lock index 5337e32b2c094312a9be6fb56bafbc7632a931d5..097347dd21bfd76087c53e0b2424d5ee3b4a3d2d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "933a1cf749db0c7e6d16e357c12cdaa8", + "hash": "8633d753763a17a13717a8380e3cb46b", "packages": [ { "name": "composer/composer", diff --git a/dev/shell/dependency.php b/dev/shell/dependency.php index 29ee2cd8aa6981e3bd85f128cee1c85139c82611..bd6fd8de21af01a3fd46f45efb75b3d090e1a30a 100644 --- a/dev/shell/dependency.php +++ b/dev/shell/dependency.php @@ -19,8 +19,6 @@ const KEY_COMPONENT_NAME = 'name'; const KEY_COMPONENT_DEPENDENCIES = 'dependencies'; const KEY_COMPONENT_DEPENDENTS = 'dependents'; -const KEY_MAGENTO_CORE_MODULE = 'magento/module-core'; - $modules = []; $componentsByName = []; @@ -256,8 +254,6 @@ function initialize() if (count($component[KEY_COMPONENT_MODULES]) == 1) { $component[KEY_COMPONENT_NAME] = $component[KEY_COMPONENT_MODULES][0]; $modules[$component[KEY_COMPONENT_MODULES][0]][KEY_MODULE_COMPONENT] = $component[KEY_COMPONENT_NAME]; - } elseif (in_array(KEY_MAGENTO_CORE_MODULE, $component[KEY_COMPONENT_MODULES])) { - $component[KEY_COMPONENT_NAME] = KEY_MAGENTO_CORE_MODULE; } else { $component[KEY_COMPONENT_NAME] = implode(':', $component[KEY_COMPONENT_MODULES]); } diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/AllSoapAndRest.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/AllSoapAndRest.php index 8975db0fa437fa639d6a685694cafdb36c826ad7..0c7df325f28d5d13ade1d440364c0f48e4b9e32d 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/AllSoapAndRest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/AllSoapAndRest.php @@ -5,32 +5,32 @@ */ namespace Magento\TestModule1\Service\V1; -use Magento\TestModule1\Service\V1\Entity\CustomAttributeDataObjectBuilder; +use Magento\TestModuleMSC\Model\Data\CustomAttributeDataObjectFactory; use Magento\TestModule1\Service\V1\Entity\Item; -use Magento\TestModule1\Service\V1\Entity\ItemBuilder; +use Magento\TestModule1\Service\V1\Entity\ItemFactory; class AllSoapAndRest implements \Magento\TestModule1\Service\V1\AllSoapAndRestInterface { /** - * @var ItemBuilder + * @var ItemFactory */ - protected $itemBuilder; + protected $itemFactory; /** - * @var CustomAttributeDataObjectBuilder + * @var CustomAttributeDataObjectFactory */ - protected $customAttributeDataObjectBuilder; + protected $customAttributeDataObjectFactory; /** - * @param ItemBuilder $itemBuilder - * @param CustomAttributeDataObjectBuilder $customAttributeNestedDataObjectBuilder + * @param ItemFactory $itemFactory + * @param CustomAttributeDataObjectFactory $customAttributeNestedDataObjectFactory */ public function __construct( - ItemBuilder $itemBuilder, - CustomAttributeDataObjectBuilder $customAttributeNestedDataObjectBuilder + ItemFactory $itemFactory, + CustomAttributeDataObjectFactory $customAttributeNestedDataObjectFactory ) { - $this->itemBuilder = $itemBuilder; - $this->customAttributeDataObjectBuilder = $customAttributeNestedDataObjectBuilder; + $this->itemFactory = $itemFactory; + $this->customAttributeDataObjectFactory = $customAttributeNestedDataObjectFactory; } /** @@ -38,7 +38,7 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V1\AllSoapAndRestIn */ public function item($itemId) { - return $this->itemBuilder->setItemId($itemId)->setName('testProduct1')->create(); + return $this->itemFactory->create()->setItemId($itemId)->setName('testProduct1'); } /** @@ -46,8 +46,8 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V1\AllSoapAndRestIn */ public function items() { - $result1 = $this->itemBuilder->setItemId(1)->setName('testProduct1')->create(); - $result2 = $this->itemBuilder->setItemId(2)->setName('testProduct2')->create(); + $result1 = $this->itemFactory->create()->setItemId(1)->setName('testProduct1'); + $result2 = $this->itemFactory->create()->setItemId(2)->setName('testProduct2'); return [$result1, $result2]; } @@ -57,7 +57,7 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V1\AllSoapAndRestIn */ public function create($name) { - return $this->itemBuilder->setItemId(rand())->setName($name)->create(); + return $this->itemFactory->create()->setItemId(rand())->setName($name); } /** @@ -65,17 +65,16 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V1\AllSoapAndRestIn */ public function update(Item $entityItem) { - return $this->itemBuilder->setItemId($entityItem->getItemId()) - ->setName('Updated' . $entityItem->getName()) - ->create(); + return $this->itemFactory->create()->setItemId($entityItem->getItemId()) + ->setName('Updated' . $entityItem->getName()); } public function testOptionalParam($name = null) { if (is_null($name)) { - return $this->itemBuilder->setItemId(3)->setName('No Name')->create(); + return $this->itemFactory->create()->setItemId(3)->setName('No Name'); } else { - return $this->itemBuilder->setItemId(3)->setName($name)->create(); + return $this->itemFactory->create()->setItemId(3)->setName($name); } } @@ -92,17 +91,15 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V1\AllSoapAndRestIn */ public function getPreconfiguredItem() { - $customAttributeDataObject = $this->customAttributeDataObjectBuilder + $customAttributeDataObject = $this->customAttributeDataObjectFactory->create() ->setName('nameValue') - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); + ->setCustomAttribute('custom_attribute_int', 1); - $item = $this->itemBuilder + $item = $this->itemFactory->create() ->setItemId(1) ->setName('testProductAnyType') ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); + ->setCustomAttribute('custom_attribute_string', 'someStringValue'); return $item; } diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeDataObject.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeDataObject.php deleted file mode 100644 index c902c5ad8d9877c416e1546b522f3b4c5371dde1..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeDataObject.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule1\Service\V1\Entity; - -class CustomAttributeDataObject extends \Magento\Framework\Api\AbstractExtensibleObject -{ - /** - * @return string - */ - public function getName() - { - return $this->_data['name']; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeDataObjectBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeDataObjectBuilder.php deleted file mode 100644 index b66f00c0f4a1bc29bf18254f57ea1e09c836c7dd..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeDataObjectBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\TestModule1\Service\V1\Entity; - -class CustomAttributeDataObjectBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param string $name - * - * @return $this - */ - public function setName($name) - { - $this->data['name'] = $name; - return $this; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeNestedDataObject.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeNestedDataObject.php deleted file mode 100644 index a794774c3f7f314e95d9a01ce0a56860341331cc..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeNestedDataObject.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule1\Service\V1\Entity; - -class CustomAttributeNestedDataObject extends \Magento\Framework\Api\AbstractExtensibleObject -{ - /** - * @return string - */ - public function getName() - { - return $this->_data['name']; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeNestedDataObjectBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeNestedDataObjectBuilder.php deleted file mode 100644 index 84ec340dc087fd3274e2ac6ac2b5a5089d0f891c..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/CustomAttributeNestedDataObjectBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\TestModule1\Service\V1\Entity; - -class CustomAttributeNestedDataObjectBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param string $name - * - * @return $this - */ - public function setName($name) - { - $this->data['name'] = $name; - return $this; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Eav/AttributeMetadata.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Eav/AttributeMetadata.php deleted file mode 100644 index 0541cefb3e8ffe665c087a93b033e1ae43a96cb8..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Eav/AttributeMetadata.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule1\Service\V1\Entity\Eav; - -use Magento\Framework\Api\AbstractExtensibleObject; -use Magento\Framework\Api\MetadataObjectInterface; - -/** - * Class AttributeMetadata - */ -class AttributeMetadata extends AbstractExtensibleObject implements MetadataObjectInterface -{ - /**#@+ - * Constants used as keys into $_data - */ - const ATTRIBUTE_ID = 'attribute_id'; - - const ATTRIBUTE_CODE = 'attribute_code'; - /**#@-*/ - - /** - * Retrieve id of the attribute. - * - * @return string|null - */ - public function getAttributeId() - { - return $this->_get(self::ATTRIBUTE_ID); - } - - /** - * Retrieve code of the attribute. - * - * @return string|null - */ - public function getAttributeCode() - { - return $this->_get(self::ATTRIBUTE_CODE); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Eav/AttributeMetadataBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Eav/AttributeMetadataBuilder.php deleted file mode 100644 index 84a3d9cb0f4207e5f4703bbaa302928b1ace35a1..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Eav/AttributeMetadataBuilder.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule1\Service\V1\Entity\Eav; - -use Magento\Framework\Api\AttributeMetadataBuilderInterface; -use Magento\Framework\Api\ExtensibleObjectBuilder; - -/** - * Class AttributeMetadataBuilder - */ -class AttributeMetadataBuilder extends ExtensibleObjectBuilder implements AttributeMetadataBuilderInterface -{ - /** - * Set attribute id - * - * @param int $attributeId - * @return $this - */ - public function setAttributeId($attributeId) - { - return $this->_set(AttributeMetadata::ATTRIBUTE_ID, $attributeId); - } - - /** - * Set attribute code - * - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode) - { - return $this->_set(AttributeMetadata::ATTRIBUTE_CODE, $attributeCode); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Item.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Item.php index 80ec81c542d9a4e52a4260256781d9e8cbd4ea2b..3abf3f7134834175768cd408f1e8e0df48a0e578 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Item.php +++ b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/Item.php @@ -7,6 +7,14 @@ namespace Magento\TestModule1\Service\V1\Entity; class Item extends \Magento\Framework\Api\AbstractExtensibleObject { + /**#@+ + * Custom attribute code constants + */ + const CUSTOM_ATTRIBUTE_1 = 'custom_attribute1'; + const CUSTOM_ATTRIBUTE_2 = 'custom_attribute2'; + const CUSTOM_ATTRIBUTE_3 = 'custom_attribute3'; + /**#@-*/ + /** * @return int */ @@ -15,6 +23,15 @@ class Item extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_data['item_id']; } + /** + * @param int $itemId + * @return $this + */ + public function setItemId($itemId) + { + return $this->setData('item_id', $itemId); + } + /** * @return string */ @@ -22,4 +39,26 @@ class Item extends \Magento\Framework\Api\AbstractExtensibleObject { return $this->_data['name']; } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } + + /** + * Template method used to configure the attribute codes for the custom attributes + * + * @return string[] + */ + protected function getCustomAttributesCodes() + { + return array_merge( + parent::getCustomAttributesCodes(), + [self::CUSTOM_ATTRIBUTE_1, self::CUSTOM_ATTRIBUTE_2, self::CUSTOM_ATTRIBUTE_3] + ); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/ItemBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/ItemBuilder.php deleted file mode 100644 index 5da49d73bba44d8306061118c31f1a5546e28f97..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V1/Entity/ItemBuilder.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule1\Service\V1\Entity; - -class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /**#@+ - * Custom attribute code constants - */ - const CUSTOM_ATTRIBUTE_1 = 'custom_attribute1'; - const CUSTOM_ATTRIBUTE_2 = 'custom_attribute2'; - const CUSTOM_ATTRIBUTE_3 = 'custom_attribute3'; - /**#@-*/ - - /** - * @param int $itemId - * - * @return \Magento\TestModule1\Service\V1\Entity\ItemBuilder - */ - public function setItemId($itemId) - { - $this->data['item_id'] = $itemId; - return $this; - } - - /** - * @param string $name - * - * @return \Magento\TestModule1\Service\V1\Entity\ItemBuilder - */ - public function setName($name) - { - $this->data['name'] = $name; - return $this; - } - - /** - * Template method used to configure the attribute codes for the custom attributes - * - * @return string[] - */ - public function getCustomAttributesCodes() - { - return array_merge( - parent::getCustomAttributesCodes(), - [self::CUSTOM_ATTRIBUTE_1, self::CUSTOM_ATTRIBUTE_2, self::CUSTOM_ATTRIBUTE_3] - ); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/AllSoapAndRest.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/AllSoapAndRest.php index 407086eacee8989460d982407f276df4a4f76e77..de633fa9a193b6ce5810c576da21f6a5bbef8887 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/AllSoapAndRest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/AllSoapAndRest.php @@ -6,21 +6,21 @@ namespace Magento\TestModule1\Service\V2; use Magento\TestModule1\Service\V2\Entity\Item; -use Magento\TestModule1\Service\V2\Entity\ItemBuilder; +use Magento\TestModule1\Service\V2\Entity\ItemFactory; class AllSoapAndRest implements \Magento\TestModule1\Service\V2\AllSoapAndRestInterface { /** - * @var ItemBuilder + * @var ItemFactory */ - protected $itemBuilder; + protected $itemFactory; /** - * @param ItemBuilder $itemBuilder + * @param ItemFactory $itemFactory */ - public function __construct(ItemBuilder $itemBuilder) + public function __construct(ItemFactory $itemFactory) { - $this->itemBuilder = $itemBuilder; + $this->itemFactory = $itemFactory; } /** @@ -28,7 +28,7 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V2\AllSoapAndRestIn */ public function item($id) { - return $this->itemBuilder->setId($id)->setName('testProduct1')->setPrice('1')->create(); + return $this->itemFactory->create()->setId($id)->setName('testProduct1')->setPrice('1'); } /** @@ -37,8 +37,8 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V2\AllSoapAndRestIn public function items($filters = [], $sortOrder = 'ASC') { $result = []; - $firstItem = $this->itemBuilder->setId(1)->setName('testProduct1')->setPrice('1')->create(); - $secondItem = $this->itemBuilder->setId(2)->setName('testProduct2')->setPrice('2')->create(); + $firstItem = $this->itemFactory->create()->setId(1)->setName('testProduct1')->setPrice('1'); + $secondItem = $this->itemFactory->create()->setId(2)->setName('testProduct2')->setPrice('2'); /** Simple filtration implementation */ if (!empty($filters)) { @@ -62,7 +62,7 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V2\AllSoapAndRestIn */ public function create($name) { - return $this->itemBuilder->setId(rand())->setName($name)->setPrice('10')->create(); + return $this->itemFactory->create()->setId(rand())->setName($name)->setPrice('10'); } /** @@ -70,10 +70,10 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V2\AllSoapAndRestIn */ public function update(Item $entityItem) { - return $this->itemBuilder + return $this->itemFactory->create() ->setId($entityItem->getId()) ->setName('Updated' . $entityItem->getName()) - ->setPrice('5')->create(); + ->setPrice('5'); } /** @@ -81,6 +81,6 @@ class AllSoapAndRest implements \Magento\TestModule1\Service\V2\AllSoapAndRestIn */ public function delete($id) { - return $this->itemBuilder->setId($id)->setName('testProduct1')->setPrice('1')->create(); + return $this->itemFactory->create()->setId($id)->setName('testProduct1')->setPrice('1'); } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/Entity/Item.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/Entity/Item.php index 9d3f4b857e3ab95523185331d20510871e5debee..891ff49d1cffc949d3302c200e87e93586fa437b 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/Entity/Item.php +++ b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/Entity/Item.php @@ -15,6 +15,15 @@ class Item extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_data['id']; } + /** + * @param int $id + * @return $this + */ + public function setId($id) + { + return $this->setData('id', $id); + } + /** * @return string */ @@ -23,6 +32,15 @@ class Item extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_data['name']; } + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } + /** * @return string */ @@ -30,4 +48,13 @@ class Item extends \Magento\Framework\Api\AbstractExtensibleObject { return $this->_data['price']; } + + /** + * @param string $price + * @return $this + */ + public function setPrice($price) + { + return $this->setData('price', $price); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/Entity/ItemBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/Entity/ItemBuilder.php deleted file mode 100644 index 44cc72e7ce63fcf2b1fa3ec95b7cf72d95d8a17f..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule1/Service/V2/Entity/ItemBuilder.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule1\Service\V2\Entity; - -class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param int $id - * - * @return \Magento\TestModule1\Service\V2\Entity\ItemBuilder - */ - public function setId($id) - { - $this->data['id'] = $id; - return $this; - } - - /** - * @param string $name - * - * @return \Magento\TestModule1\Service\V2\Entity\ItemBuilder - */ - public function setName($name) - { - $this->data['name'] = $name; - return $this; - } - - /** - * @param string $price - * - * @return \Magento\TestModule1\Service\V2\Entity\ItemBuilder - */ - public function setPrice($price) - { - $this->data['price'] = $price; - return $this; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/etc/data_object.xml b/dev/tests/api-functional/_files/Magento/TestModule1/etc/data_object.xml index 19cdbc3710a713062ae5a42677ebf9d551c75e55..de2236e2195f380aedd5614447065bc9e480f7aa 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule1/etc/data_object.xml +++ b/dev/tests/api-functional/_files/Magento/TestModule1/etc/data_object.xml @@ -7,11 +7,11 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd"> <custom_attributes for="Magento\TestModule1\Service\V1\Entity\Item"> - <attribute code="custom_attribute_data_object" type="Magento\TestModule1\Service\V1\Entity\CustomAttributeDataObject" /> + <attribute code="custom_attribute_data_object" type="Magento\TestModuleMSC\Model\Data\CustomAttributeDataObject" /> <attribute code="custom_attribute_string" type="string" /> </custom_attributes> - <custom_attributes for="Magento\TestModule1\Service\V1\Entity\CustomAttributeDataObject"> - <attribute code="custom_attribute_nested" type="Magento\TestModule1\Service\V1\Entity\CustomAttributeNestedDataObject" /> + <custom_attributes for="Magento\TestModuleMSC\Model\Data\CustomAttributeDataObject"> + <attribute code="custom_attribute_nested" type="Magento\TestModuleMSC\Model\Data\CustomAttributeNestedDataObject" /> <attribute code="custom_attribute_int" type="int" /> </custom_attributes> </config> diff --git a/dev/tests/api-functional/_files/Magento/TestModule1/etc/di.xml b/dev/tests/api-functional/_files/Magento/TestModule1/etc/di.xml index 254ba3ba70abcbd81992dd06649eb4ecd48f774d..61cdfb19a09e0b1b59a27663d261969600e6340e 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule1/etc/di.xml +++ b/dev/tests/api-functional/_files/Magento/TestModule1/etc/di.xml @@ -11,7 +11,7 @@ <virtualType name="Magento\TestModule1\Service\Config\TestModule1MetadataConfig" type="Magento\Framework\Api\Config\MetadataConfig"> <arguments> - <argument name="attributeMetadataBuilder" xsi:type="object">Magento\TestModule1\Service\V1\Entity\Eav\AttributeMetadataBuilder</argument> + <argument name="attributeMetadataBuilder" xsi:type="object">Magento\TestModuleMSC\Model\Data\Eav\AttributeMetadataBuilder</argument> <argument name="dataObjectClassName" xsi:type="string">Magento\TestModule1\Service\V1\Entity\Item</argument> </arguments> </virtualType> diff --git a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/Entity/Item.php b/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/Entity/Item.php index 4781959355d4f152d466f3a054b3e358eeadc580..677ea39860129e85c6f705a0d0bf001b366d8b09 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/Entity/Item.php +++ b/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/Entity/Item.php @@ -15,6 +15,16 @@ class Item extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_data['id']; } + /** + * @param int $id + * @return $this + */ + public function setId($id) + { + return $this->setData('id', $id); + } + + /** * @return string */ @@ -22,4 +32,12 @@ class Item extends \Magento\Framework\Api\AbstractExtensibleObject { return $this->_data['name']; } + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/Entity/ItemBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/Entity/ItemBuilder.php deleted file mode 100644 index d53919e16d7736aa61a9584467de296687d0d4d1..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/Entity/ItemBuilder.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule2\Service\V1\Entity; - -class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param int $id - * @return \Magento\TestModule2\Service\V1\Entity\ItemBuilder - */ - public function setId($id) - { - $this->data['id'] = $id; - return $this; - } - - /** - * @param string $name - * @return \Magento\TestModule2\Service\V1\Entity\ItemBuilder - */ - public function setName($name) - { - $this->data['name'] = $name; - return $this; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/NoWebApiXml.php b/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/NoWebApiXml.php index b4983e6ed8ade4de16e61ff44542fe89273eed65..b7d8143b9864249e32656a86f1308b7bd04e4614 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/NoWebApiXml.php +++ b/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/NoWebApiXml.php @@ -6,21 +6,21 @@ namespace Magento\TestModule2\Service\V1; use Magento\TestModule2\Service\V1\Entity\Item; -use Magento\TestModule2\Service\V1\Entity\ItemBuilder; +use Magento\TestModule2\Service\V1\Entity\ItemFactory; class NoWebApiXml implements \Magento\TestModule2\Service\V1\NoWebApiXmlInterface { /** - * @var ItemBuilder + * @var ItemFactory */ - protected $itemBuilder; + protected $itemFactory; /** - * @param ItemBuilder $itemBuilder + * @param ItemFactory $itemFactory */ - public function __construct(ItemBuilder $itemBuilder) + public function __construct(ItemFactory $itemFactory) { - $this->itemBuilder = $itemBuilder; + $this->itemFactory = $itemFactory; } /** @@ -28,7 +28,7 @@ class NoWebApiXml implements \Magento\TestModule2\Service\V1\NoWebApiXmlInterfac */ public function item($id) { - return $this->itemBuilder->setId($id)->setName('testProduct1')->create(); + return $this->itemFactory->create()->setId($id)->setName('testProduct1'); } /** @@ -36,9 +36,9 @@ class NoWebApiXml implements \Magento\TestModule2\Service\V1\NoWebApiXmlInterfac */ public function items() { - $result1 = $this->itemBuilder->setId(1)->setName('testProduct1')->create(); + $result1 = $this->itemFactory->create()->setId(1)->setName('testProduct1'); - $result2 = $this->itemBuilder->setId(2)->setName('testProduct2')->create(); + $result2 = $this->itemFactory->create()->setId(2)->setName('testProduct2'); return [$result1, $result2]; } @@ -48,7 +48,7 @@ class NoWebApiXml implements \Magento\TestModule2\Service\V1\NoWebApiXmlInterfac */ public function create($name) { - return $this->itemBuilder->setId(rand())->setName($name)->create(); + return $this->itemFactory->create()->setId(rand())->setName($name); } /** @@ -56,6 +56,6 @@ class NoWebApiXml implements \Magento\TestModule2\Service\V1\NoWebApiXmlInterfac */ public function update(Item $item) { - return $this->itemBuilder->setId($item->getId())->setName('Updated' . $item->getName())->create(); + return $this->itemFactory->create()->setId($item->getId())->setName('Updated' . $item->getName()); } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/SubsetRest.php b/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/SubsetRest.php index cbf9d7e2da58e7b543b51f32c1c3379cec30dad8..afd604a46d49215edb35e2a8c02b92bf174c99b1 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/SubsetRest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule2/Service/V1/SubsetRest.php @@ -6,21 +6,21 @@ namespace Magento\TestModule2\Service\V1; use Magento\TestModule2\Service\V1\Entity\Item; -use Magento\TestModule2\Service\V1\Entity\ItemBuilder; +use Magento\TestModule2\Service\V1\Entity\ItemFactory; class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface { /** - * @var ItemBuilder + * @var ItemFactory */ - protected $itemBuilder; + protected $itemFactory; /** - * @param ItemBuilder $itemBuilder + * @param ItemFactory $itemFactory */ - public function __construct(ItemBuilder $itemBuilder) + public function __construct(ItemFactory $itemFactory) { - $this->itemBuilder = $itemBuilder; + $this->itemFactory = $itemFactory; } /** @@ -28,7 +28,7 @@ class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface */ public function item($id) { - return $this->itemBuilder->setId($id)->setName('testItem' . $id)->create(); + return $this->itemFactory->create()->setId($id)->setName('testItem' . $id); } /** @@ -36,9 +36,9 @@ class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface */ public function items() { - $result1 = $this->itemBuilder->setId(1)->setName('testItem1')->create(); + $result1 = $this->itemFactory->create()->setId(1)->setName('testItem1'); - $result2 = $this->itemBuilder->setId(2)->setName('testItem2')->create(); + $result2 = $this->itemFactory->create()->setId(2)->setName('testItem2'); return [$result1, $result2]; } @@ -48,7 +48,7 @@ class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface */ public function create($name) { - return $this->itemBuilder->setId(rand())->setName($name)->create(); + return $this->itemFactory->create()->setId(rand())->setName($name); } /** @@ -56,7 +56,7 @@ class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface */ public function update(Item $item) { - return $this->itemBuilder->setId($item->getId())->setName('Updated' . $item->getName())->create(); + return $this->itemFactory->create()->setId($item->getId())->setName('Updated' . $item->getName()); } /** @@ -64,6 +64,6 @@ class SubsetRest implements \Magento\TestModule2\Service\V1\SubsetRestInterface */ public function remove($id) { - return $this->itemBuilder->setId(1)->create(); + return $this->itemFactory->create()->setId(1); } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/Parameter.php b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/Parameter.php index 44f22d3fb830c493019e2ee6bfae1900c9c71479..59e4c84ac24f0b1988eccb1a73ae07db43d1bcee 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/Parameter.php +++ b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/Parameter.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\TestModule3\Service\V1\Entity; class Parameter extends \Magento\Framework\Api\AbstractExtensibleObject @@ -17,6 +20,17 @@ class Parameter extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_data['name']; } + /** + * Set Name. + * + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } + /** * Get value. * @@ -26,4 +40,15 @@ class Parameter extends \Magento\Framework\Api\AbstractExtensibleObject { return $this->_data['value']; } + + /** + * Set value. + * + * @param string $value + * @return $this + */ + public function setValue($value) + { + return $this->setData('value', $value); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/ParameterBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/ParameterBuilder.php deleted file mode 100644 index faad247d90deeb017b09fa1b4f3bcfdb2daffbba..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/ParameterBuilder.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule3\Service\V1\Entity; - -class ParameterBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * Set Name. - * - * @param string $name - * @return \Magento\TestModule3\Service\V1\Entity\ParameterBuilder - */ - public function setName($name) - { - $this->data['name'] = $name; - return $this; - } - - /** - * Set value. - * - * @param string $value - * @return \Magento\TestModule3\Service\V1\Entity\ParameterBuilder - */ - public function setValue($value) - { - $this->data['value'] = $value; - return $this; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/WrappedErrorParameter.php b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/WrappedErrorParameter.php index 5308640833578aca09c156bf43e0d5903cdc6d7a..a08ea627cfaa7a4eca4ecd4666f372d030ff65da 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/WrappedErrorParameter.php +++ b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/WrappedErrorParameter.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\TestModule3\Service\V1\Entity; class WrappedErrorParameter extends \Magento\Framework\Api\AbstractExtensibleObject @@ -27,4 +29,26 @@ class WrappedErrorParameter extends \Magento\Framework\Api\AbstractExtensibleObj { return $this->_data['value']; } + + /** + * Set field name. + * + * @param string $fieldName + * @return $this + */ + public function setFieldName($fieldName) + { + return $this->setData('field_name', $fieldName); + } + + /** + * Set value. + * + * @param string $value + * @return $this + */ + public function setValue($value) + { + return $this->setData('value', $value); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/WrappedErrorParameterBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/WrappedErrorParameterBuilder.php deleted file mode 100644 index ff7df239f39135e29b2b2514251238c8f76a6226..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Entity/WrappedErrorParameterBuilder.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\TestModule3\Service\V1\Entity; - -class WrappedErrorParameterBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * Set field name. - * - * @param string $fieldName - * @return $this - */ - public function setFieldName($fieldName) - { - $this->data['field_name'] = $fieldName; - return $this; - } - - /** - * Set value. - * - * @param string $value - * @return $this - */ - public function setValue($value) - { - $this->data['value'] = $value; - return $this; - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php index 8306194ceee0617c1ad7fd88920a55cd2e8c1ce6..e1f4b6a99564875820989179cb5959df14e9bbc1 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php +++ b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php @@ -12,21 +12,21 @@ use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\TestModule3\Service\V1\Entity\Parameter; -use Magento\TestModule3\Service\V1\Entity\ParameterBuilder; +use Magento\TestModule3\Service\V1\Entity\ParameterFactory; class Error implements \Magento\TestModule3\Service\V1\ErrorInterface { /** - * @var ParameterBuilder + * @var ParameterFactory */ - protected $parameterBuilder; + protected $parameterFactory; /** - * @param ParameterBuilder $parameterBuilder + * @param ParameterFactory $parameterFactory */ - public function __construct(ParameterBuilder $parameterBuilder) + public function __construct(ParameterFactory $parameterFactory) { - $this->parameterBuilder = $parameterBuilder; + $this->parameterFactory = $parameterFactory; } /** @@ -34,7 +34,7 @@ class Error implements \Magento\TestModule3\Service\V1\ErrorInterface */ public function success() { - return $this->parameterBuilder->setName('id')->setValue('a good id')->create(); + return $this->parameterFactory->create()->setName('id')->setValue('a good id'); } /** diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/DataObjectService.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/DataObjectService.php index 04ad6935cd37907acf0ea930bdd106f0a4e50fd3..c988c6a1821c66ab89504d5b557c3a4bebda0e3e 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/DataObjectService.php +++ b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/DataObjectService.php @@ -6,23 +6,23 @@ namespace Magento\TestModule4\Service\V1; use Magento\TestModule4\Service\V1\Entity\DataObjectRequest; -use Magento\TestModule4\Service\V1\Entity\DataObjectResponseBuilder; +use Magento\TestModule4\Service\V1\Entity\DataObjectResponseFactory; use Magento\TestModule4\Service\V1\Entity\ExtensibleRequestInterface; use Magento\TestModule4\Service\V1\Entity\NestedDataObjectRequest; class DataObjectService implements \Magento\TestModule4\Service\V1\DataObjectServiceInterface { /** - * @var DataObjectResponseBuilder + * @var DataObjectResponseFactory */ - protected $responseBuilder; + protected $responseFactory; /** - * @param DataObjectResponseBuilder $responseBuilder + * @param DataObjectResponseFactory $responseFactory */ - public function __construct(DataObjectResponseBuilder $responseBuilder) + public function __construct(DataObjectResponseFactory $responseFactory) { - $this->responseBuilder = $responseBuilder; + $this->responseFactory = $responseFactory; } /** @@ -30,7 +30,7 @@ class DataObjectService implements \Magento\TestModule4\Service\V1\DataObjectSer */ public function getData($id) { - return $this->responseBuilder->setEntityId($id)->setName("Test")->create(); + return $this->responseFactory->create()->setEntityId($id)->setName("Test"); } /** @@ -38,7 +38,7 @@ class DataObjectService implements \Magento\TestModule4\Service\V1\DataObjectSer */ public function updateData($id, DataObjectRequest $request) { - return $this->responseBuilder->setEntityId($id)->setName($request->getName())->create(); + return $this->responseFactory->create()->setEntityId($id)->setName($request->getName()); } /** @@ -46,7 +46,7 @@ class DataObjectService implements \Magento\TestModule4\Service\V1\DataObjectSer */ public function nestedData($id, NestedDataObjectRequest $request) { - return $this->responseBuilder->setEntityId($id)->setName($request->getDetails()->getName())->create(); + return $this->responseFactory->create()->setEntityId($id)->setName($request->getDetails()->getName()); } /** @@ -65,6 +65,6 @@ class DataObjectService implements \Magento\TestModule4\Service\V1\DataObjectSer */ public function extensibleDataObject($id, ExtensibleRequestInterface $request) { - return $this->responseBuilder->setEntityId($id)->setName($request->getName())->create(); + return $this->responseFactory->create()->setEntityId($id)->setName($request->getName()); } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectRequest.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectRequest.php index b14e85d1a5b0096737cccb40ab8fd1b82accc060..5de8dafbba3d55a92126665d35b37db5efadecb6 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectRequest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectRequest.php @@ -15,6 +15,15 @@ class DataObjectRequest extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_get('name'); } + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } + /** * @return int|null */ @@ -22,4 +31,13 @@ class DataObjectRequest extends \Magento\Framework\Api\AbstractExtensibleObject { return $this->_get('entity_id'); } + + /** + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData('entity_id', $entityId); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectRequestBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectRequestBuilder.php deleted file mode 100644 index 47d1c1966922fda5f0cd0e750b4cb21fd8c908cb..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectRequestBuilder.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule4\Service\V1\Entity; - -class DataObjectRequestBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param string $name - * @return DataObjectRequest - */ - public function setName($name) - { - return $this->_set('name', $name); - } - - /** - * @param int $entityId - * @return DataObjectRequest - */ - public function setEntityId($entityId) - { - return $this->_set('entity_id', $entityId); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectResponse.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectResponse.php index 0d69fd2c777e27166f0e37f9a0db897c8c7b48f4..f66ebab1ecee90efa699a5c7c59d3fbd178ed7fe 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectResponse.php +++ b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectResponse.php @@ -15,6 +15,15 @@ class DataObjectResponse extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_get('entity_id'); } + /** + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData('entity_id', $entityId); + } + /** * @return string */ @@ -22,4 +31,13 @@ class DataObjectResponse extends \Magento\Framework\Api\AbstractExtensibleObject { return $this->_get('name'); } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectResponseBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectResponseBuilder.php deleted file mode 100644 index 22a3b1b58ad489982b6fd16871c91f2d78f58534..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/DataObjectResponseBuilder.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule4\Service\V1\Entity; - -class DataObjectResponseBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param int $entityId - * @return DataObjectResponseBuilder - */ - public function setEntityId($entityId) - { - return $this->_set('entity_id', $entityId); - } - - /** - * @param string $name - * @return DataObjectResponseBuilder - */ - public function setName($name) - { - return $this->_set('name', $name); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequest.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequest.php index d96ca365fbd34fa3d1efa4fb02efa4267243ccfa..114f9a9dc9a07533f3db9e334c965eb65621d7ce 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequest.php @@ -8,10 +8,33 @@ namespace Magento\TestModule4\Service\V1\Entity; +/** + * Class ExtensibleRequest + * + * @method \Magento\TestModule4\Service\V1\Entity\ExtensibleRequestExtensionInterface getExtensionAttributes() + */ class ExtensibleRequest extends \Magento\Framework\Model\AbstractExtensibleModel implements ExtensibleRequestInterface { public function getName() { return $this->getData("name"); } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData("name", $name); + } + + /** + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData("entity_id", $entityId); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequestInterface.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequestInterface.php index 4b6c422a3447ecc31a24564b50efa19db57f4eac..cd0f2902c5c3a5d729c60ebd6ae0cf48dfeae146 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequestInterface.php +++ b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/ExtensibleRequestInterface.php @@ -12,8 +12,20 @@ interface ExtensibleRequestInterface extends \Magento\Framework\Api\ExtensibleDa */ public function getName(); + /** + * @param string $name + * @return $this + */ + public function setName($name); + /** * @return int|null */ public function getEntityId(); + + /** + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId); } diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/NestedDataObjectRequest.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/NestedDataObjectRequest.php index 5af1942295499f25ccb9fcdd4059a5712c771aa9..47b38e59a6f26c07ad040ddd4ecdfba390bf3b6d 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/NestedDataObjectRequest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/NestedDataObjectRequest.php @@ -14,4 +14,13 @@ class NestedDataObjectRequest extends \Magento\Framework\Api\AbstractExtensibleO { return $this->_get('details'); } + + /** + * @param \Magento\TestModule4\Service\V1\Entity\DataObjectRequest $details + * @return $this + */ + public function setDetails(\Magento\TestModule4\Service\V1\Entity\DataObjectRequest $details = null) + { + return $this->setData('details', $details); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/NestedDataObjectRequestBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/NestedDataObjectRequestBuilder.php deleted file mode 100644 index 7b24d19b4e26696b40531342acd7b7d0a3d2ee24..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule4/Service/V1/Entity/NestedDataObjectRequestBuilder.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule4\Service\V1\Entity; - -class NestedDataObjectRequestBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param \Magento\TestModule4\Service\V1\Entity\DataObjectRequest $details - * @return \Magento\TestModule4\Service\V1\Entity\DataObjectRequest - */ - public function setDetails(DataObjectRequest $details) - { - return $this->_set('details', $details); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/AllSoapAndRest.php b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/AllSoapAndRest.php index 2d8376547315d07a6d66b03a8d9107efd2359d2b..bbcc323d6cd67bd7f5b18d55dcfc90a4c886281c 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/AllSoapAndRest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/AllSoapAndRest.php @@ -5,21 +5,21 @@ */ namespace Magento\TestModule5\Service\V1; -use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestBuilder; +use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory; class AllSoapAndRest implements \Magento\TestModule5\Service\V1\AllSoapAndRestInterface { /** - * @var AllSoapAndRestBuilder + * @var AllSoapAndRestFactory */ - protected $builder; + protected $factory; /** - * @param AllSoapAndRestBuilder $builder + * @param AllSoapAndRestFactory $factory */ - public function __construct(AllSoapAndRestBuilder $builder) + public function __construct(AllSoapAndRestFactory $factory) { - $this->builder = $builder; + $this->factory = $factory; } /** @@ -27,12 +27,11 @@ class AllSoapAndRest implements \Magento\TestModule5\Service\V1\AllSoapAndRestIn */ public function item($entityId) { - return $this->builder + return $this->factory->create() ->setEntityId($entityId) ->setName('testItemName') ->setIsEnabled(true) - ->setHasOrders(true) - ->create(); + ->setHasOrders(true); } /** @@ -40,8 +39,8 @@ class AllSoapAndRest implements \Magento\TestModule5\Service\V1\AllSoapAndRestIn */ public function items() { - $allSoapAndRest1 = $this->builder->setEntityId(1)->setName('testProduct1')->create(); - $allSoapAndRest2 = $this->builder->setEntityId(2)->setName('testProduct2')->create(); + $allSoapAndRest1 = $this->factory->create()->setEntityId(1)->setName('testProduct1'); + $allSoapAndRest2 = $this->factory->create()->setEntityId(2)->setName('testProduct2'); return [$allSoapAndRest1, $allSoapAndRest2]; } @@ -50,7 +49,11 @@ class AllSoapAndRest implements \Magento\TestModule5\Service\V1\AllSoapAndRestIn */ public function create(\Magento\TestModule5\Service\V1\Entity\AllSoapAndRest $item) { - return $this->builder->populate($item)->create(); + return $this->factory->create() + ->setEntityId($item->getEntityId()) + ->setName($item->getName()) + ->setIsEnabled($item->isEnabled()) + ->setHasOrders($item->hasOrders()); } /** diff --git a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/Entity/AllSoapAndRest.php b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/Entity/AllSoapAndRest.php index b777d90ded0e486eeed942312a49d542c73a431a..bcbb0e2a2c0bf456d12cb7718b23c019019c6a94 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/Entity/AllSoapAndRest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/Entity/AllSoapAndRest.php @@ -28,6 +28,17 @@ class AllSoapAndRest extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_get(self::ID); } + /** + * Set item ID. + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData(self::ID, $entityId); + } + /** * Retrieve item Name. * @@ -38,6 +49,17 @@ class AllSoapAndRest extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_get(self::NAME); } + /** + * Set item Name. + * + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData(self::NAME, $name); + } + /** * Check if entity is enabled * @@ -48,6 +70,17 @@ class AllSoapAndRest extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_get(self::ENABLED); } + /** + * Set if entity is enabled + * + * @param bool $isEnabled + * @return bool + */ + public function setIsEnabled($isEnabled) + { + return $this->setData(self::ENABLED, $isEnabled); + } + /** * Check if current entity has a property defined * @@ -58,6 +91,17 @@ class AllSoapAndRest extends \Magento\Framework\Api\AbstractExtensibleObject return $this->_get(self::HAS_ORDERS); } + /** + * Set whether current entity has a property defined + * + * @param bool $setHasOrders + * @return $this + */ + public function setHasOrders($hasOrders) + { + return $this->setData(self::HAS_ORDERS, $hasOrders); + } + /** * Method which will not be used when adding complex type field to WSDL. * diff --git a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/Entity/AllSoapAndRestBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/Entity/AllSoapAndRestBuilder.php deleted file mode 100644 index 46dd6dd72de5eae31ce168c67d74f304ee69d6ee..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/Entity/AllSoapAndRestBuilder.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule5\Service\V1\Entity; - -use Magento\Framework\Api\AbstractSimpleObjectBuilder; - -/** - * Some Data Object short description. - * - * Data Object long - * multi line description. - */ -class AllSoapAndRestBuilder extends AbstractSimpleObjectBuilder -{ - /** - * @param int $id - * @return AllSoapAndRestBuilder - */ - public function setEntityId($id) - { - return $this->_set(AllSoapAndRest::ID, $id); - } - - /** - * @param string $name - * @return AllSoapAndRestBuilder - */ - public function setName($name) - { - return $this->_set(AllSoapAndRest::NAME, $name); - } - - /** - * Set flag if entity is enabled - * - * @param bool $isEnabled - * @return AllSoapAndRestBuilder - */ - public function setIsEnabled($isEnabled) - { - return $this->_set(AllSoapAndRest::ENABLED, $isEnabled); - } - - /** - * Set flag if entity has orders - * - * @param bool $hasOrders - * @return AllSoapAndRestBuilder - */ - public function setHasOrders($hasOrders) - { - return $this->_set(AllSoapAndRest::HAS_ORDERS, $hasOrders); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/OverrideService.php b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/OverrideService.php index 1e174932cbcc67a95c95c9a765c8bcb60cf68593..4e8653a17741d7a1933c22082d13075664b48901 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/OverrideService.php +++ b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V1/OverrideService.php @@ -6,31 +6,30 @@ namespace Magento\TestModule5\Service\V1; -use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestBuilder; +use Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory; class OverrideService implements OverrideServiceInterface { /** - * @var AllSoapAndRestBuilder + * @var AllSoapAndRestFactory */ - protected $builder; + protected $factory; /** - * @param AllSoapAndRestBuilder $builder + * @param AllSoapAndRestFactory $factory */ - public function __construct(AllSoapAndRestBuilder $builder) + public function __construct(AllSoapAndRestFactory $factory) { - $this->builder = $builder; + $this->factory = $factory; } /** * {@inheritdoc} */ public function scalarUpdate($entityId, $name, $hasOrders) { - return $this->builder + return $this->factory->create() ->setEntityId($entityId) ->setName($name) - ->setHasOrders($hasOrders) - ->create(); + ->setHasOrders($hasOrders); } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V2/AllSoapAndRest.php b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V2/AllSoapAndRest.php index b5b6044a9bfca7caa6ce29d11fffc987e6a10e2e..b02a14ce675403f04d093864eb186e68c3dddba2 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V2/AllSoapAndRest.php +++ b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V2/AllSoapAndRest.php @@ -6,21 +6,21 @@ namespace Magento\TestModule5\Service\V2; use Magento\TestModule5\Service\V2\Entity\AllSoapAndRest as AllSoapAndRestEntity; -use Magento\TestModule5\Service\V2\Entity\AllSoapAndRestBuilder; +use Magento\TestModule5\Service\V2\Entity\AllSoapAndRestFactory; class AllSoapAndRest implements AllSoapAndRestInterface { /** - * @var AllSoapAndRestBuilder + * @var AllSoapAndRestFactory */ - protected $builder; + protected $factory; /** - * @param AllSoapAndRestBuilder $builder + * @param AllSoapAndRestFactory $factory */ - public function __construct(AllSoapAndRestBuilder $builder) + public function __construct(AllSoapAndRestFactory $factory) { - $this->builder = $builder; + $this->factory = $factory; } /** @@ -28,7 +28,7 @@ class AllSoapAndRest implements AllSoapAndRestInterface */ public function item($id) { - return $this->builder->setPrice(1)->setId($id)->setName('testItemName')->create(); + return $this->factory->create()->setPrice(1)->setId($id)->setName('testItemName'); } /** @@ -36,8 +36,8 @@ class AllSoapAndRest implements AllSoapAndRestInterface */ public function items() { - $allSoapAndRest1 = $this->builder->setPrice(1)->setId(1)->setName('testProduct1')->create(); - $allSoapAndRest2 = $this->builder->setPrice(1)->setId(2)->setName('testProduct2')->create(); + $allSoapAndRest1 = $this->factory->create()->setPrice(1)->setId(1)->setName('testProduct1'); + $allSoapAndRest2 = $this->factory->create()->setPrice(1)->setId(2)->setName('testProduct2'); return [$allSoapAndRest1, $allSoapAndRest2]; } @@ -46,7 +46,7 @@ class AllSoapAndRest implements AllSoapAndRestInterface */ public function create(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item) { - return $this->builder->populate($item)->create(); + return $this->factory->create()->setPrice($item->getPrice()); } /** @@ -55,7 +55,7 @@ class AllSoapAndRest implements AllSoapAndRestInterface public function update(\Magento\TestModule5\Service\V2\Entity\AllSoapAndRest $item) { $item->setName('Updated' . $item->getName()); - return $this->builder->populate($item)->create(); + return $item; } /** @@ -65,6 +65,6 @@ class AllSoapAndRest implements AllSoapAndRestInterface */ public function delete($id) { - return $this->builder->setPrice(1)->setId($id)->setName('testItemName')->create(); + return $this->factory->create()->setPrice(1)->setId($id)->setName('testItemName'); } } diff --git a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V2/Entity/AllSoapAndRestBuilder.php b/dev/tests/api-functional/_files/Magento/TestModule5/Service/V2/Entity/AllSoapAndRestBuilder.php deleted file mode 100644 index 996b4c8760c086567720f0dd1b1a8d765499b8af..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModule5/Service/V2/Entity/AllSoapAndRestBuilder.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModule5\Service\V2\Entity; - -use Magento\TestModule5\Service\V1\Entity; - -class AllSoapAndRestBuilder extends \Magento\TestModule5\Service\V1\Entity\AllSoapAndRestBuilder -{ - const PRICE = 'price'; - - /** - * @param int $price - * @return \Magento\TestModule5\Service\V2\Entity\AllSoapAndRestBuilder - */ - public function setPrice($price) - { - return $this->_set(self::PRICE, $price); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeDataObjectInterface.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeDataObjectInterface.php index 8bc01d6b0747a294dde62dc8c38ab7a2d8dfb995..405595033957432ca56c442db93f82ba25eef5d4 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeDataObjectInterface.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeDataObjectInterface.php @@ -13,4 +13,10 @@ interface CustomAttributeDataObjectInterface extends \Magento\Framework\Api\Exte * @return string */ public function getName(); + + /** + * @param string $name + * @return $this + */ + public function setName($name); } diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeNestedDataObjectInterface.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeNestedDataObjectInterface.php index 2392f27f39df89ead9d4210dc68e3b6d0193080c..86053d02c6df5c0f42ed25a37b1429f3b066e553 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeNestedDataObjectInterface.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/CustomAttributeNestedDataObjectInterface.php @@ -11,4 +11,10 @@ interface CustomAttributeNestedDataObjectInterface extends \Magento\Framework\Ap * @return string */ public function getName(); + + /** + * @param string $name + * @return $this + */ + public function setName($name); } diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/ItemInterface.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/ItemInterface.php index ab84970f9d1f476d283fd215c89c9ad3737c6dda..3a3f81cf1b0b53fc657f6774a435f00d723c0e8f 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/ItemInterface.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Api/Data/ItemInterface.php @@ -12,8 +12,20 @@ interface ItemInterface extends \Magento\Framework\Api\ExtensibleDataInterface */ public function getItemId(); + /** + * @param int $itemId + * @return $this + */ + public function setItemId($itemId); + /** * @return string */ public function getName(); + + /** + * @param string $name + * @return $this + */ + public function setName($name); } diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/AllSoapAndRest.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/AllSoapAndRest.php index 3d42fc29470579a942b29c16fcf26d6796dc7c60..12f56f0bc4775839281f3d46076eaefb78b20832 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/AllSoapAndRest.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/AllSoapAndRest.php @@ -5,31 +5,31 @@ */ namespace Magento\TestModuleMSC\Model; -use Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectDataBuilder; -use Magento\TestModuleMSC\Api\Data\ItemDataBuilder; +use Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectInterfaceFactory; +use Magento\TestModuleMSC\Api\Data\ItemInterfaceFactory; class AllSoapAndRest implements \Magento\TestModuleMSC\Api\AllSoapAndRestInterface { /** - * @var ItemDataBuilder + * @var ItemInterfaceFactory */ - protected $itemDataBuilder; + protected $itemDataFactory; /** - * @var CustomAttributeDataObjectDataBuilder + * @var CustomAttributeDataObjectInterfaceFactory */ - protected $customAttributeDataObjectDataBuilder; + protected $customAttributeDataObjectDataFactory; /** - * @param ItemDataBuilder $itemDataBuilder - * @param CustomAttributeDataObjectDataBuilder $customAttributeNestedDataObjectBuilder + * @param ItemInterfaceFactory $itemDataFactory + * @param CustomAttributeDataObjectInterfaceFactory $customAttributeNestedDataObjectFactory */ public function __construct( - ItemDataBuilder $itemDataBuilder, - CustomAttributeDataObjectDataBuilder $customAttributeNestedDataObjectBuilder + ItemInterfaceFactory $itemDataFactory, + CustomAttributeDataObjectInterfaceFactory $customAttributeNestedDataObjectFactory ) { - $this->itemDataBuilder = $itemDataBuilder; - $this->customAttributeDataObjectDataBuilder = $customAttributeNestedDataObjectBuilder; + $this->itemDataFactory = $itemDataFactory; + $this->customAttributeDataObjectDataFactory = $customAttributeNestedDataObjectFactory; } /** @@ -37,7 +37,7 @@ class AllSoapAndRest implements \Magento\TestModuleMSC\Api\AllSoapAndRestInterfa */ public function item($itemId) { - return $this->itemDataBuilder->setItemId($itemId)->setName('testProduct1')->create(); + return $this->itemDataFactory->create()->setItemId($itemId)->setName('testProduct1'); } /** @@ -45,8 +45,8 @@ class AllSoapAndRest implements \Magento\TestModuleMSC\Api\AllSoapAndRestInterfa */ public function items() { - $result1 = $this->itemDataBuilder->setItemId(1)->setName('testProduct1')->create(); - $result2 = $this->itemDataBuilder->setItemId(2)->setName('testProduct2')->create(); + $result1 = $this->itemDataFactory->create()->setItemId(1)->setName('testProduct1'); + $result2 = $this->itemDataFactory->create()->setItemId(2)->setName('testProduct2'); return [$result1, $result2]; } @@ -56,7 +56,7 @@ class AllSoapAndRest implements \Magento\TestModuleMSC\Api\AllSoapAndRestInterfa */ public function create($name) { - return $this->itemDataBuilder->setItemId(rand())->setName($name)->create(); + return $this->itemDataFactory->create()->setItemId(rand())->setName($name); } /** @@ -64,17 +64,16 @@ class AllSoapAndRest implements \Magento\TestModuleMSC\Api\AllSoapAndRestInterfa */ public function update(\Magento\TestModuleMSC\Api\Data\ItemInterface $entityItem) { - return $this->itemDataBuilder->setItemId($entityItem->getItemId()) - ->setName('Updated' . $entityItem->getName()) - ->create(); + return $this->itemDataFactory->create()->setItemId($entityItem->getItemId()) + ->setName('Updated' . $entityItem->getName()); } public function testOptionalParam($name = null) { if (is_null($name)) { - return $this->itemDataBuilder->setItemId(3)->setName('No Name')->create(); + return $this->itemDataFactory->create()->setItemId(3)->setName('No Name'); } else { - return $this->itemDataBuilder->setItemId(3)->setName($name)->create(); + return $this->itemDataFactory->create()->setItemId(3)->setName($name); } } @@ -91,17 +90,15 @@ class AllSoapAndRest implements \Magento\TestModuleMSC\Api\AllSoapAndRestInterfa */ public function getPreconfiguredItem() { - $customAttributeDataObject = $this->customAttributeDataObjectDataBuilder + $customAttributeDataObject = $this->customAttributeDataObjectDataFactory->create() ->setName('nameValue') - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); + ->setCustomAttribute('custom_attribute_int', 1); - $item = $this->itemDataBuilder + $item = $this->itemDataFactory->create() ->setItemId(1) ->setName('testProductAnyType') ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); + ->setCustomAttribute('custom_attribute_string', 'someStringValue'); return $item; } diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeDataObject.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeDataObject.php index 54dbbdffc5accd97a9fe58f133001127574f8bf2..02e45da759543fdb8b9d94ae95c6020cf0f64abe 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeDataObject.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeDataObject.php @@ -11,6 +11,11 @@ namespace Magento\TestModuleMSC\Model\Data; use Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectInterface; use Magento\Framework\Api\AbstractExtensibleObject; +/** + * Class CustomAttributeDataObject + * + * @method \Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectExtensionInterface getExtensionAttributes() + */ class CustomAttributeDataObject extends AbstractExtensibleObject implements CustomAttributeDataObjectInterface { /** @@ -20,4 +25,13 @@ class CustomAttributeDataObject extends AbstractExtensibleObject implements Cust { return $this->_data['name']; } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeNestedDataObject.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeNestedDataObject.php index 24937c7ecae46870cb3af65c34e1cad80daf9310..ee683aa1610b713010c1812adaff87ebc3d9e61f 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeNestedDataObject.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/CustomAttributeNestedDataObject.php @@ -10,6 +10,11 @@ namespace Magento\TestModuleMSC\Model\Data; use Magento\TestModuleMSC\Api\Data\CustomAttributeNestedDataObjectInterface; +/** + * Class CustomAttributeNestedDataObject + * + * @method \Magento\TestModuleMSC\Api\Data\CustomAttributeNestedDataObjectExtensionInterface getExtensionAttributes() + */ class CustomAttributeNestedDataObject extends \Magento\Framework\Model\AbstractExtensibleModel implements CustomAttributeNestedDataObjectInterface { @@ -20,4 +25,13 @@ class CustomAttributeNestedDataObject extends \Magento\Framework\Model\AbstractE { return $this->_data['name']; } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Eav/AttributeMetadata.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Eav/AttributeMetadata.php index b8cca857d3c044e13448fb5a165377988eee1911..6d243943177acee07873ecf99bbfbaea58b48e93 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Eav/AttributeMetadata.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Eav/AttributeMetadata.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\TestModuleMSC\Model\Data\Eav; use Magento\Framework\Api\AbstractExtensibleObject; @@ -31,6 +34,17 @@ class AttributeMetadata extends AbstractExtensibleObject implements MetadataObje return $this->_get(self::ATTRIBUTE_ID); } + /** + * Set id of the attribute. + * + * @param string $attributeId + * @return $this + */ + public function setAttributeId($attributeId) + { + return $this->setData(self::ATTRIBUTE_ID, $attributeId); + } + /** * Retrieve code of the attribute. * @@ -40,4 +54,15 @@ class AttributeMetadata extends AbstractExtensibleObject implements MetadataObje { return $this->_get(self::ATTRIBUTE_CODE); } + + /** + * Set code of the attribute. + * + * @param string $attributeCode + * @return $this + */ + public function setAttributeCode($attributeCode) + { + return $this->setData(self::ATTRIBUTE_CODE, $attributeCode); + } } diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Eav/AttributeMetadataBuilder.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Eav/AttributeMetadataBuilder.php deleted file mode 100644 index 64ceb50d1395acac795546d8ae2134d63fb62002..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Eav/AttributeMetadataBuilder.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\TestModuleMSC\Model\Data\Eav; - -use Magento\Framework\Api\AttributeMetadataBuilderInterface; -use Magento\Framework\Api\ExtensibleObjectBuilder; - -/** - * Class AttributeMetadataBuilder - */ -class AttributeMetadataBuilder extends ExtensibleObjectBuilder implements AttributeMetadataBuilderInterface -{ - /** - * Set attribute id - * - * @param int $attributeId - * @return $this - */ - public function setAttributeId($attributeId) - { - return $this->_set(AttributeMetadata::ATTRIBUTE_ID, $attributeId); - } - - /** - * Set attribute code - * - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode) - { - return $this->_set(AttributeMetadata::ATTRIBUTE_CODE, $attributeCode); - } -} diff --git a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Item.php b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Item.php index c35147c0e7745c3829215f1c93ba772894a9f0f5..1d57017fabd42b6b01749771e25db25ef63aff48 100644 --- a/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Item.php +++ b/dev/tests/api-functional/_files/Magento/TestModuleMSC/Model/Data/Item.php @@ -10,6 +10,11 @@ namespace Magento\TestModuleMSC\Model\Data; use Magento\TestModuleMSC\Api\Data\ItemInterface; +/** + * Class Item + * + * @method \Magento\TestModuleMSC\Api\Data\ItemExtensionInterface getExtensionAttributes() + */ class Item extends \Magento\Framework\Model\AbstractExtensibleModel implements ItemInterface { /** @@ -20,6 +25,15 @@ class Item extends \Magento\Framework\Model\AbstractExtensibleModel implements I return $this->_data['item_id']; } + /** + * @param int $itemId + * @return $this + */ + public function setItemId($itemId) + { + return $this->setData('item_id', $itemId); + } + /** * @return string */ @@ -27,4 +41,13 @@ class Item extends \Magento\Framework\Model\AbstractExtensibleModel implements I { return $this->_data['name']; } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } } diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/Helper/Customer.php b/dev/tests/api-functional/framework/Magento/TestFramework/Helper/Customer.php index 3e23b454e67df29659f9896c4ca97535093925a7..746bea41561c61ea1fc80233fabdee38b698bd40 100644 --- a/dev/tests/api-functional/framework/Magento/TestFramework/Helper/Customer.php +++ b/dev/tests/api-functional/framework/Magento/TestFramework/Helper/Customer.php @@ -176,7 +176,11 @@ class Customer extends WebapiAbstract ], ]; $customer = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($customer, $customerData); + $this->dataObjectHelper->populateWithArray( + $customer, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); return $customer; } } diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php index 36cf0e0afaa83e7285e6a1d17f2c74185362ca5e..463f490480ce06c6e3016e5606971eb6ee1fe392 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductLinkManagementTest.php @@ -91,11 +91,11 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb */ private function addChild($productSku, $optionId, $linkedProduct) { - $resourcePath = self::RESOURCE_PATH . '/:productSku/links/:optionId'; + $resourcePath = self::RESOURCE_PATH . '/:sku/links/:optionId'; $serviceInfo = [ 'rest' => [ 'resourcePath' => str_replace( - [':productSku', ':optionId'], + [':sku', ':optionId'], [$productSku, $optionId], $resourcePath ), @@ -109,7 +109,7 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb ]; return $this->_webApiCall( $serviceInfo, - ['productSku' => $productSku, 'optionId' => $optionId, 'linkedProduct' => $linkedProduct] + ['sku' => $productSku, 'optionId' => $optionId, 'linkedProduct' => $linkedProduct] ); } @@ -125,7 +125,7 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb protected function removeChild($productSku, $optionId, $childSku) { - $resourcePath = self::RESOURCE_PATH . '/%s/option/%s/child/%s'; + $resourcePath = self::RESOURCE_PATH . '/%s/options/%s/children/%s'; $serviceInfo = [ 'rest' => [ 'resourcePath' => sprintf($resourcePath, $productSku, $optionId, $childSku), @@ -137,7 +137,7 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb 'operation' => self::SERVICE_NAME . 'removeChild', ], ]; - $requestData = ['productSku' => $productSku, 'optionId' => $optionId, 'childSku' => $childSku]; + $requestData = ['sku' => $productSku, 'optionId' => $optionId, 'childSku' => $childSku]; return $this->_webApiCall($serviceInfo, $requestData); } diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php index e18965c0753e60490561c6facf4aca2c6d8e615c..325e35ee8291041dd553575d39ed4523f71e5284 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php @@ -10,7 +10,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi { const SERVICE_NAME = 'bundleProductOptionRepositoryV1'; const SERVICE_VERSION = 'V1'; - const RESOURCE_PATH = '/V1/bundle-products/:productSku/option'; + const RESOURCE_PATH = '/V1/bundle-products/:sku/options'; /** * @magentoApiDataFixture Magento/Bundle/_files/product.php @@ -166,7 +166,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi { $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/bundle-products/option/' . $optionId, + 'resourcePath' => '/V1/bundle-products/options/' . $optionId, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], 'soap' => [ @@ -190,7 +190,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi { $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/bundle-products/option/add', + 'resourcePath' => '/V1/bundle-products/options/add', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ @@ -211,7 +211,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi { $serviceInfo = [ 'rest' => [ - 'resourcePath' => str_replace(':productSku', $productSku, self::RESOURCE_PATH) . '/' . $optionId, + 'resourcePath' => str_replace(':sku', $productSku, self::RESOURCE_PATH) . '/' . $optionId, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, ], 'soap' => [ @@ -220,7 +220,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi 'operation' => self::SERVICE_NAME . 'DeleteById', ], ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'optionId' => $optionId]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'optionId' => $optionId]); } /** @@ -231,7 +231,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi { $serviceInfo = [ 'rest' => [ - 'resourcePath' => str_replace(':productSku', $productSku, self::RESOURCE_PATH) . '/all', + 'resourcePath' => str_replace(':sku', $productSku, self::RESOURCE_PATH) . '/all', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ @@ -240,7 +240,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi 'operation' => self::SERVICE_NAME . 'GetList', ], ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku]); } /** @@ -252,7 +252,7 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi { $serviceInfo = [ 'rest' => [ - 'resourcePath' => str_replace(':productSku', $productSku, self::RESOURCE_PATH) . '/' . $optionId, + 'resourcePath' => str_replace(':sku', $productSku, self::RESOURCE_PATH) . '/' . $optionId, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ @@ -261,6 +261,6 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi 'operation' => self::SERVICE_NAME . 'Get', ], ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'optionId' => $optionId]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'optionId' => $optionId]); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionTypeListTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionTypeListTest.php index 9e355b5aae83a17d9c48f5fffa42b3fda302d5e9..7fc41226c9bb09319afd87db1c280484fe0a795f 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionTypeListTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionTypeListTest.php @@ -10,7 +10,7 @@ class ProductOptionTypeListTest extends \Magento\TestFramework\TestCase\WebapiAb { const SERVICE_READ_NAME = 'bundleProductOptionTypeListV1'; const SERVICE_VERSION = 'V1'; - const RESOURCE_PATH = '/V1/bundle-products/option/types'; + const RESOURCE_PATH = '/V1/bundle-products/options/types'; public function testGetTypes() { diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php index 6c9d7c92c3cda782f13bbd5f8298d95cbbb26588..1a817b18d3b593df2cbbef8280a42e40f0d5b84c 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductServiceTest.php @@ -7,7 +7,7 @@ namespace Magento\Bundle\Api; use Magento\Catalog\Api\Data\ProductInterface; -use Magento\Framework\Api\AbstractExtensibleObject; +use Magento\Framework\Api\ExtensibleDataInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\WebapiAbstract; @@ -61,18 +61,19 @@ class ProductServiceTest extends WebapiAbstract */ public function testCreateBundle() { + $this->markTestSkipped('Processing of custom attributes has been changed in MAGETWO-34448.'); $bundleProductOptions = [ - "attribute_code" => "bundle_product_options", - "value" => [ - [ - "title" => "test option", - "type" => "checkbox", - "required" => 1, - "product_links" => [ - [ - "sku" => 'simple', - "qty" => 1, - ], + [ + "title" => "test option", + "type" => "checkbox", + "required" => true, + "product_links" => [ + [ + "sku" => 'simple', + "qty" => 1, + 'is_default' => false, + 'price' => 1.0, + 'price_type' => 1 ], ], ], @@ -85,36 +86,25 @@ class ProductServiceTest extends WebapiAbstract "type_id" => "bundle", "price" => 50, 'attribute_set_id' => 4, - "custom_attributes" => [ - "price_type" => [ - 'attribute_code' => 'price_type', - 'value' => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC - ], + "extension_attributes" => [ + "price_type" => \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC, "bundle_product_options" => $bundleProductOptions, - "price_view" => [ - "attribute_code" => "price_view", - "value" => "test", - ], + "price_view" => "test" ], ]; $response = $this->createProduct($product); $this->assertEquals($uniqueId, $response[ProductInterface::SKU]); - $this->assertEquals( - $bundleProductOptions, - $response[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]["bundle_product_options"] - ); + $resultBundleProductOptions + = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]; + $this->assertEquals($bundleProductOptions, $resultBundleProductOptions); + $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]); $response = $this->getProduct($uniqueId); - $foundBundleProductOptions = false; - foreach ($response[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY] as $customAttribute) { - if ($customAttribute["attribute_code"] === 'bundle_product_options') { - $this->assertEquals('simple', $customAttribute["value"][0]["product_links"][0]["sku"]); - $foundBundleProductOptions = true; - } - } - $this->assertTrue($foundBundleProductOptions); + $resultBundleProductOptions + = $response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["bundle_product_options"]; + $this->assertEquals('simple', $resultBundleProductOptions[0]["product_links"][0]["sku"]); } /** @@ -138,7 +128,7 @@ class ProductServiceTest extends WebapiAbstract ]; $response = (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) ? - $this->_webApiCall($serviceInfo, ['productSku' => $productSku]) : $this->_webApiCall($serviceInfo); + $this->_webApiCall($serviceInfo, ['sku' => $productSku]) : $this->_webApiCall($serviceInfo); return $response; } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeOptionManagementInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeOptionManagementInterfaceTest.php index 61a54a548800a4e33b8c5710d63de95a4af30b87..345f76e3d923aade74604d952acc321c1e79c446 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeOptionManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeOptionManagementInterfaceTest.php @@ -15,6 +15,7 @@ class CategoryAttributeOptionManagementInterfaceTest extends WebapiAbstract public function testGetItems() { + $this->_markTestAsRestOnly('Fix inconsistencies in WSDL and Data interfaces'); $testAttributeCode = 'include_in_menu'; $expectedOptions = [ [ diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryLinkRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryLinkRepositoryTest.php index 0cc379dc881fbf4a064ed18227a34b5deed9e67c..84588ac82171ea29d17ba377b753d9265c5417db 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryLinkRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryLinkRepositoryTest.php @@ -121,7 +121,7 @@ class CategoryLinkRepositoryTest extends WebapiAbstract ]; $result = $this->_webApiCall( $serviceInfo, - ['productSku' => 'simple', 'categoryId' => $this->categoryId] + ['sku' => 'simple', 'categoryId' => $this->categoryId] ); $this->assertTrue($result); $this->assertFalse($this->isProductInCategory($this->categoryId, 333, 10)); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php index 9cf88f3b541a85659aa4780f336b9178688bb100..6a61347d6d211ad498aabff70b382545b3550748 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryRepositoryTest.php @@ -166,13 +166,13 @@ class CategoryRepositoryTest extends WebapiAbstract 'name' => isset($categoryData['name']) ? $categoryData['name'] : uniqid('Category-', true), 'is_active' => '1', + 'include_in_menu' => "1", 'custom_attributes' => [ ['attribute_code' => 'url_key', 'value' => ''], ['attribute_code' => 'description', 'value' => 'Custom description'], ['attribute_code' => 'meta_title', 'value' => ''], ['attribute_code' => 'meta_keywords', 'value' => ''], ['attribute_code' => 'meta_description', 'value' => ''], - ['attribute_code' => 'include_in_menu', 'value' => '1'], ['attribute_code' => 'display_mode', 'value' => 'PRODUCTS'], ['attribute_code' => 'landing_page', 'value' => ''], ['attribute_code' => 'is_anchor', 'value' => '0'], @@ -250,6 +250,8 @@ class CategoryRepositoryTest extends WebapiAbstract $data['id'] = $id; return $this->_webApiCall($serviceInfo, ['id' => $id, 'category' => $data]); } else { + $data['id'] = $id; + return $this->_webApiCall($serviceInfo, ['id' => $id, 'category' => $data]); return $this->_webApiCall($serviceInfo, ['category' => $data]); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php index c8e4a55b1eeb5f9181ce660ec91d33d9ccb954d8..4ea45309be3c9c937a6c15bbc2e5d7eccf50fc13 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php @@ -20,7 +20,7 @@ class ProductAttributeManagementTest extends \Magento\TestFramework\TestCase\Web public function testGetAttributes() { - $attributeSetId = \Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID; + $attributeSetId = 4; $serviceInfo = [ 'rest' => [ @@ -155,7 +155,7 @@ class ProductAttributeManagementTest extends \Magento\TestFramework\TestCase\Web $serviceInfo, [ 'attributeSetId' => $payload['attributeSetId'], - 'attributeCode' => $payload['attributeCode'] + 'attributeCode' => $payload['attributeCode'], ] ) ); @@ -164,10 +164,10 @@ class ProductAttributeManagementTest extends \Magento\TestFramework\TestCase\Web protected function getAttributeData() { return [ - 'attributeSetId' => \Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID, + 'attributeSetId' => 4, 'attributeGroupId' => 8, 'attributeCode' => 'cost', - 'sortOrder' => 3 + 'sortOrder' => 3, ]; } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php index 2fa1f86b55c5aeac1673d1416df96c856d59e5b5..86a5c051ae44c64a74e5d01b23c84c1ab82e00ea 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterfaceTest.php @@ -40,7 +40,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $this->createServiceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/products/simple/media', + 'resourcePath' => '/V1/products/media', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ @@ -49,6 +49,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF 'operation' => 'catalogProductAttributeMediaGalleryManagementV1Create', ], ]; + $this->updateServiceInfo = [ 'rest' => [ 'resourcePath' => '/V1/products/simple/media', @@ -103,23 +104,27 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreate() { $requestData = [ - 'productSku' => 'simple', - 'entry' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'is_disabled' => false, - ], - 'entryContent' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', + "sku" => 'simple', + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image' + ] + ] + ], ], - // Store ID is not provided so the default one must be used ]; - $actualResult = $this->_webApiCall($this->createServiceInfo, $requestData); + $actualResult = $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); $targetProduct = $this->getTargetSimpleProduct(); $mediaGallery = $targetProduct->getData('media_gallery'); @@ -129,9 +134,6 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF $this->assertEquals('Image Text', $updatedImage['label']); $this->assertEquals(1, $updatedImage['position']); $this->assertEquals(0, $updatedImage['disabled']); - $this->assertEquals('Image Text', $updatedImage['label_default']); - $this->assertEquals(1, $updatedImage['position_default']); - $this->assertEquals(0, $updatedImage['disabled_default']); $this->assertStringStartsWith('/t/e/test_image', $updatedImage['file']); $this->assertEquals($updatedImage['file'], $targetProduct->getData('image')); } @@ -142,23 +144,28 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreateWithNotDefaultStoreId() { $requestData = [ - 'productSku' => 'simple', - 'entry' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'is_disabled' => false, - ], - 'entryContent' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ], - 'storeId' => 1, + 'sku' => 'simple', + 'store_id' => 1, + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', + ] + ] + ], + ] ]; - $actualResult = $this->_webApiCall($this->createServiceInfo, $requestData); + $actualResult = $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); $targetProduct = $this->getTargetSimpleProduct(); $mediaGallery = $targetProduct->getData('media_gallery'); $this->assertCount(1, $mediaGallery['images']); @@ -182,13 +189,13 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testUpdate() { $requestData = [ - 'productSku' => 'simple', + 'sku' => 'simple', 'entry' => [ 'id' => $this->getTargetGalleryEntryId(), 'label' => 'Updated Image Text', 'position' => 10, 'types' => ['thumbnail'], - 'is_disabled' => true, + 'disabled' => true, ], // Store ID is not provided so the default one must be used ]; @@ -220,15 +227,15 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testUpdateWithNotDefaultStoreId() { $requestData = [ - 'productSku' => 'simple', + 'sku' => 'simple', 'entry' => [ 'id' => $this->getTargetGalleryEntryId(), 'label' => 'Updated Image Text', 'position' => 10, 'types' => ['thumbnail'], - 'is_disabled' => true, + 'disabled' => true, ], - 'storeId' => 1, + 'store_id' => 1, ]; $this->updateServiceInfo['rest']['resourcePath'] = $this->updateServiceInfo['rest']['resourcePath'] @@ -262,7 +269,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF $entryId = $this->getTargetGalleryEntryId(); $this->deleteServiceInfo['rest']['resourcePath'] = "/V1/products/simple/media/{$entryId}"; $requestData = [ - 'productSku' => 'simple', + 'sku' => 'simple', 'entryId' => $this->getTargetGalleryEntryId(), ]; @@ -280,23 +287,28 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreateThrowsExceptionIfThereIsNoStoreWithProvidedStoreId() { $requestData = [ - 'productSku' => 'simple', - 'entry' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'is_disabled' => false, - ], - 'storeId' => 9999, // target store view does not exist - 'entryContent' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ], + 'sku' => 'simple', + 'store_id' => 9999, // target store view does not exist + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', + ] + ] + ], + ] ]; - $this->_webApiCall($this->createServiceInfo, $requestData); + $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); } /** @@ -308,23 +320,28 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $encodedContent = 'not_a_base64_encoded_content'; $requestData = [ - 'productSku' => 'simple', - 'entry' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'is_disabled' => false, - 'types' => ['image'], - ], - 'entryContent' => [ - 'entry_data' => $encodedContent, - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ], - 'storeId' => 0, + 'sku' => 'simple', + 'store_id' => 0, + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => $encodedContent, + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', + ] + ] + ], + ] ]; - $this->_webApiCall($this->createServiceInfo, $requestData); + $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); } /** @@ -336,23 +353,28 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $encodedContent = base64_encode('not_an_image'); $requestData = [ - 'productSku' => 'simple', - 'entry' => [ - 'id' => null, - 'is_disabled' => false, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - ], - 'entryContent' => [ - 'entry_data' => $encodedContent, - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ], - 'storeId' => 0, + 'sku' => 'simple', + 'store_id' => 0, + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => $encodedContent, + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', + ] + ] + ], + ] ]; - $this->_webApiCall($this->createServiceInfo, $requestData); + $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); } /** @@ -364,23 +386,28 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $encodedContent = base64_encode(file_get_contents($this->testImagePath)); $requestData = [ - 'entry' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'is_disabled' => false, - ], - 'productSku' => 'simple', - 'entryContent' => [ - 'entry_data' => $encodedContent, - 'mime_type' => 'wrong_mime_type', - 'name' => 'test_image', - ], - 'storeId' => 0, + 'sku' => 'simple', + 'store_id' => 0, + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => $encodedContent, + 'mime_type' => 'wrong_mime_type', + 'name' => 'test_image', + ] + ] + ], + ] ]; - $this->_webApiCall($this->createServiceInfo, $requestData); + $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); } /** @@ -389,25 +416,31 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF */ public function testCreateThrowsExceptionIfTargetProductDoesNotExist() { - $this->createServiceInfo['rest']['resourcePath'] = '/V1/products/wrong_product_sku/media'; + $this->createServiceInfo['rest']['resourcePath'] = '/V1/products/media'; + $requestData = [ - 'productSku' => 'wrong_product_sku', - 'entry' => [ - 'id' => null, - 'position' => 1, - 'label' => 'Image Text', - 'types' => ['image'], - 'is_disabled' => false, - ], - 'entryContent' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test_image', - ], - 'storeId' => 0, + 'sku' => 'wrong_product_sku', + 'store_id' => 0, + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test_image', + ] + ] + ], + ] ]; - $this->_webApiCall($this->createServiceInfo, $requestData); + $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); } /** @@ -418,23 +451,28 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testCreateThrowsExceptionIfProvidedImageNameContainsForbiddenCharacters() { $requestData = [ - 'productSku' => 'simple', - 'entry' => [ - 'id' => null, - 'label' => 'Image Text', - 'position' => 1, - 'types' => ['image'], - 'is_disabled' => false, - ], - 'entryContent' => [ - 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), - 'mime_type' => 'image/jpeg', - 'name' => 'test/\\{}|:"<>', // Cannot contain \ / : * ? " < > | - ], - 'storeId' => 0, + 'sku' => 'wrong_product_sku', + 'store_id' => 0, + "custom_attributes" => [ + "media_gallery" => [ + 'attribute_code' => 'media_gallery', + 'value' => [ + 'id' => null, + 'label' => 'Image Text', + 'position' => 1, + 'types' => ['image'], + 'disabled' => false, + 'content' => [ + 'entry_data' => base64_encode(file_get_contents($this->testImagePath)), + 'mime_type' => 'image/jpeg', + 'name' => 'test/\\{}|:"<>', // Cannot contain \ / : * ? " < > | + ] + ] + ], + ] ]; - $this->_webApiCall($this->createServiceInfo, $requestData); + $this->_webApiCall($this->createServiceInfo, ['product' => $requestData]); } /** @@ -445,15 +483,15 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testUpdateIfThereIsNoStoreWithProvidedStoreId() { $requestData = [ - 'productSku' => 'simple', + 'sku' => 'simple', 'entry' => [ 'id' => $this->getTargetGalleryEntryId(), 'label' => 'Updated Image Text', 'position' => 10, 'types' => ['thumbnail'], - 'is_disabled' => true, + 'disabled' => true, ], - 'storeId' => 9999, // target store view does not exist + 'store_id' => 9999, // target store view does not exist ]; $this->updateServiceInfo['rest']['resourcePath'] = $this->updateServiceInfo['rest']['resourcePath'] @@ -471,15 +509,15 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF $this->updateServiceInfo['rest']['resourcePath'] = '/V1/products/wrong_product_sku/media' . '/' . $this->getTargetGalleryEntryId(); $requestData = [ - 'productSku' => 'wrong_product_sku', + 'sku' => 'wrong_product_sku', 'entry' => [ 'id' => 9999, 'label' => 'Updated Image Text', 'position' => 1, 'types' => ['thumbnail'], - 'is_disabled' => true, + 'disabled' => true, ], - 'storeId' => 0, + 'store_id' => 0, ]; $this->_webApiCall($this->updateServiceInfo, $requestData); @@ -493,15 +531,15 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF public function testUpdateThrowsExceptionIfThereIsNoImageWithGivenId() { $requestData = [ - 'productSku' => 'simple', + 'sku' => 'simple', 'entry' => [ 'id' => 9999, 'label' => 'Updated Image Text', 'position' => 1, 'types' => ['thumbnail'], - 'is_disabled' => true, + 'disabled' => true, ], - 'storeId' => 0, + 'store_id' => 0, ]; $this->updateServiceInfo['rest']['resourcePath'] = $this->updateServiceInfo['rest']['resourcePath'] @@ -518,7 +556,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $this->deleteServiceInfo['rest']['resourcePath'] = '/V1/products/wrong_product_sku/media/9999'; $requestData = [ - 'productSku' => 'wrong_product_sku', + 'sku' => 'wrong_product_sku', 'entryId' => 9999, ]; @@ -534,7 +572,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF { $this->deleteServiceInfo['rest']['resourcePath'] = '/V1/products/simple/media/9999'; $requestData = [ - 'productSku' => 'simple', + 'sku' => 'simple', 'entryId' => 9999, ]; @@ -558,7 +596,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF $expected = [ 'label' => $image['label'], 'position' => $image['position'], - 'is_disabled' => (bool)$image['disabled'], + 'disabled' => (bool)$image['disabled'], 'file' => $image['file'], 'types' => ['image', 'small_image', 'thumbnail'], ]; @@ -575,16 +613,16 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF ], ]; $requestData = [ - 'productSku' => $productSku, + 'sku' => $productSku, 'imageId' => $imageId, ]; $data = $this->_webApiCall($serviceInfo, $requestData); - $actual = (array) $data; + $actual = (array)$data; $this->assertEquals($expected['label'], $actual['label']); $this->assertEquals($expected['position'], $actual['position']); $this->assertEquals($expected['file'], $actual['file']); $this->assertEquals($expected['types'], $actual['types']); - $this->assertEquals($expected['is_disabled'], (bool)$actual['is_disabled']); + $this->assertEquals($expected['disabled'], (bool)$actual['disabled']); } /** @@ -606,7 +644,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF ]; $requestData = [ - 'productSku' => $productSku, + 'sku' => $productSku, ]; $imageList = $this->_webApiCall($serviceInfo, $requestData); @@ -635,7 +673,7 @@ class ProductAttributeMediaGalleryManagementInterfaceTest extends \Magento\TestF ]; $requestData = [ - 'productSku' => $productSku, + 'sku' => $productSku, ]; if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) { $this->setExpectedException('SoapFault', 'Requested product doesn\'t exist'); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php index adc93f12c15337ab3a992586e3bae06bcb0b8a3a..2e31bec6182ee8d142cab94e7bc18eb3e49d9354 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeOptionManagementInterfaceTest.php @@ -17,6 +17,7 @@ class ProductAttributeOptionManagementInterfaceTest extends WebapiAbstract public function testGetItems() { + $this->_markTestAsRestOnly('Fix inconsistencies in WSDL and Data interfaces'); $testAttributeCode = 'quantity_and_stock_status'; $expectedOptions = [ [ @@ -52,6 +53,7 @@ class ProductAttributeOptionManagementInterfaceTest extends WebapiAbstract */ public function testAdd() { + $this->_markTestAsRestOnly('Fix inconsistencies in WSDL and Data interfaces'); $testAttributeCode = 'select_attribute'; $serviceInfo = [ 'rest' => [ @@ -100,6 +102,7 @@ class ProductAttributeOptionManagementInterfaceTest extends WebapiAbstract */ public function testDelete() { + $this->_markTestAsRestOnly('Fix inconsistencies in WSDL and Data interfaces'); $attributeCode = 'select_attribute'; //get option Id $optionList = $this->getAttributeOptions($attributeCode); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php index 39de9b517afe08198142a3807a6d8a12b16c8ae4..1ddf12ceb1bb39315bb2155415d39eaee067aaa4 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php @@ -55,7 +55,7 @@ class ProductCustomOptionRepositoryTest extends WebapiAbstract 'operation' => self::SERVICE_NAME . 'DeleteByIdentifier', ], ]; - $this->assertTrue($this->_webApiCall($serviceInfo, ['productSku' => $sku, 'optionId' => $optionId])); + $this->assertTrue($this->_webApiCall($serviceInfo, ['sku' => $sku, 'optionId' => $optionId])); /** @var \Magento\Catalog\Model\Product $product */ $product = $this->objectManager->create('Magento\Catalog\Model\Product'); $product->load(1); @@ -87,7 +87,7 @@ class ProductCustomOptionRepositoryTest extends WebapiAbstract 'operation' => self::SERVICE_NAME . 'Get', ], ]; - $option = $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'optionId' => $optionId]); + $option = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'optionId' => $optionId]); unset($option['product_sku']); unset($option['option_id']); $excepted = include '_files/product_options.php'; @@ -101,6 +101,7 @@ class ProductCustomOptionRepositoryTest extends WebapiAbstract */ public function testGetList() { + $this->_markTestAsRestOnly('Fix inconsistencies in WSDL and Data interfaces'); $productSku = 'simple'; $serviceInfo = [ 'rest' => [ @@ -113,7 +114,7 @@ class ProductCustomOptionRepositoryTest extends WebapiAbstract 'operation' => self::SERVICE_NAME . 'GetList', ], ]; - $options = $this->_webApiCall($serviceInfo, ['productSku' => $productSku]); + $options = $this->_webApiCall($serviceInfo, ['sku' => $productSku]); /** Unset dynamic data */ foreach ($options as $key => $value) { diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php index 882a95238d0b193d722299425f92d09d53c13d93..716a9ac564048a33fee8391647fc136da8f58d67 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductGroupPriceManagementTest.php @@ -32,7 +32,7 @@ class ProductGroupPriceManagementTest extends WebapiAbstract 'operation' => self::SERVICE_NAME . 'GetList', ], ]; - $groupPriceList = $this->_webApiCall($serviceInfo, ['productSku' => $productSku]); + $groupPriceList = $this->_webApiCall($serviceInfo, ['sku' => $productSku]); $this->assertCount(2, $groupPriceList); $this->assertEquals(9, $groupPriceList[0]['value']); $this->assertEquals(7, $groupPriceList[1]['value']); @@ -56,7 +56,7 @@ class ProductGroupPriceManagementTest extends WebapiAbstract 'operation' => self::SERVICE_NAME . 'Remove', ], ]; - $requestData = ['productSku' => $productSku, 'customerGroupId' => $customerGroupId]; + $requestData = ['sku' => $productSku, 'customerGroupId' => $customerGroupId]; $this->assertTrue($this->_webApiCall($serviceInfo, $requestData)); } @@ -77,7 +77,7 @@ class ProductGroupPriceManagementTest extends WebapiAbstract 'operation' => self::SERVICE_NAME . 'Add', ], ]; - $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'customerGroupId' => 1, 'price' => 10]); + $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'customerGroupId' => 1, 'price' => 10]); $objectManager = \Magento\TestFramework\ObjectManager::getInstance(); /** @var \Magento\Catalog\Api\ProductGroupPriceManagementInterface $service */ $service = $objectManager->get('Magento\Catalog\Api\ProductGroupPriceManagementInterface'); @@ -106,7 +106,7 @@ class ProductGroupPriceManagementTest extends WebapiAbstract ], ]; - $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'customerGroupId' => 1, 'price' => 10]); + $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'customerGroupId' => 1, 'price' => 10]); $objectManager = \Magento\TestFramework\ObjectManager::getInstance(); /** @var \Magento\Catalog\Api\ProductGroupPriceManagementInterface $service */ $service = $objectManager->get('Magento\Catalog\Api\ProductGroupPriceManagementInterface'); diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkManagementInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkManagementInterfaceTest.php index 0209428a759950a9e38c7f1339cec95801f2ee7d..5592363a2a8e2d9ed3e1e82b91c6e902c8aab5a2 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkManagementInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkManagementInterfaceTest.php @@ -76,7 +76,7 @@ class ProductLinkManagementInterfaceTest extends WebapiAbstract ], ]; - $actual = $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'type' => $linkType]); + $actual = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'type' => $linkType]); $this->assertEquals('simple', $actual[0]['linked_product_type']); $this->assertEquals('simple', $actual[0]['linked_product_sku']); @@ -112,7 +112,7 @@ class ProductLinkManagementInterfaceTest extends WebapiAbstract ]; $arguments = [ - 'productSku' => $productSku, + 'sku' => $productSku, 'items' => [$linkData], 'type' => $linkType, ]; diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php index 1f89a35c6c26a114b64148c8813869948cc7ea3d..30d9d54a86d48363882113e4ee024ec5e6dff2d9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductLinkRepositoryInterfaceTest.php @@ -47,7 +47,7 @@ class ProductLinkRepositoryInterfaceTest extends WebapiAbstract ], ], [ - 'productSku' => $productSku, + 'sku' => $productSku, 'type' => $linkType, 'linkedProductSku' => $linkedSku ] diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php index 931a8d2886447ed33379d6f21b548ec97cb5d9db..615675efa90a488421e7d4a4674d51b9355527f5 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php @@ -48,7 +48,7 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract ], ]; - $response = $this->_webApiCall($serviceInfo, ['productSku' => $productData[ProductInterface::SKU]]); + $response = $this->_webApiCall($serviceInfo, ['sku' => $productData[ProductInterface::SKU]]); foreach ([ProductInterface::SKU, ProductInterface::NAME, ProductInterface::PRICE] as $key) { $this->assertEquals($productData[$key], $response[$key]); } @@ -72,7 +72,7 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract $expectedMessage = 'Requested product doesn\'t exist'; try { - $this->_webApiCall($serviceInfo, ['productSku' => $invalidSku]); + $this->_webApiCall($serviceInfo, ['sku' => $invalidSku]); $this->fail("Expected throwing exception"); } catch (\SoapFault $e) { $this->assertContains( @@ -274,6 +274,6 @@ class ProductRepositoryInterfaceTest extends WebapiAbstract ]; return (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) ? - $this->_webApiCall($serviceInfo, ['productSku' => $sku]) : $this->_webApiCall($serviceInfo); + $this->_webApiCall($serviceInfo, ['sku' => $sku]) : $this->_webApiCall($serviceInfo); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiStoreTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiStoreTest.php index e31a51c9313abaff81f0ec9a2d8400aba77bddcc..b2939d3116b93cde0d5453a1eeb0ece5401a6a67 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiStoreTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiStoreTest.php @@ -34,7 +34,7 @@ class ProductRepositoryMultiStoreTest extends WebapiAbstract /** * Create another store one time for testSearch - * @magentoApiDataFixture Magento/Core/_files/store.php + * @magentoApiDataFixture Magento/Store/_files/core_fixturestore.php */ public function testCreateAnotherStore() { @@ -73,7 +73,7 @@ class ProductRepositoryMultiStoreTest extends WebapiAbstract ] ]; - $requestData = ['id' => $sku, 'productSku' => $sku]; + $requestData = ['id' => $sku, 'sku' => $sku]; $defaultStoreResponse = $this->_webApiCall($serviceInfo, $requestData); $nameInDefaultStore = 'Simple Product'; $this->assertEquals( diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php index 7fca11a150a627ae7f2d52fc09f5c9f0e48be37a..31e686b2e13dbd0edb704c85d4e772c9c7802cac 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductTierPriceManagementTest.php @@ -38,7 +38,7 @@ class ProductTierPriceManagementTest extends WebapiAbstract $groupPriceList = $this->_webApiCall( $serviceInfo, - ['productSku' => $productSku, 'customerGroupId' => $customerGroupId] + ['sku' => $productSku, 'customerGroupId' => $customerGroupId] ); $this->assertCount($count, $groupPriceList); @@ -78,7 +78,7 @@ class ProductTierPriceManagementTest extends WebapiAbstract 'operation' => self::SERVICE_NAME . 'Remove', ], ]; - $requestData = ['productSku' => $productSku, 'customerGroupId' => $customerGroupId, 'qty' => $qty]; + $requestData = ['sku' => $productSku, 'customerGroupId' => $customerGroupId, 'qty' => $qty]; $this->assertTrue($this->_webApiCall($serviceInfo, $requestData)); } @@ -114,7 +114,7 @@ class ProductTierPriceManagementTest extends WebapiAbstract ]; $requestData = [ - 'productSku' => $productSku, + 'sku' => $productSku, 'customerGroupId' => $customerGroupId, 'qty' => $qty, 'price' => $price, @@ -152,7 +152,7 @@ class ProductTierPriceManagementTest extends WebapiAbstract ], ]; $requestData = [ - 'productSku' => $productSku, + 'sku' => $productSku, 'customerGroupId' => $customerGroupId, 'qty' => $qty, 'price' => $price, @@ -190,7 +190,7 @@ class ProductTierPriceManagementTest extends WebapiAbstract ], ]; $requestData = [ - 'productSku' => $productSku, + 'sku' => $productSku, 'customerGroupId' => $customerGroupId, 'qty' => $qty, 'price' => $price, diff --git a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/LowStockItemsTest.php b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/LowStockItemsTest.php index 308fc41b83120d62e4cbc942b7363bebd46b6f2f..27212e5419f214927c1530baea17946f810ee54e 100644 --- a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/LowStockItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/LowStockItemsTest.php @@ -13,7 +13,7 @@ use Magento\TestFramework\TestCase\WebapiAbstract; class LowStockItemsTest extends WebapiAbstract { const SERVICE_VERSION = 'V1'; - const RESOURCE_PATH = '/V1/stockItem/lowStock/'; + const RESOURCE_PATH = '/V1/stockItems/lowStock/'; /** * @param float $qty diff --git a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php index 99f1f84fae540d5ed828f7e9f1cd5495b319aee8..0513f5e68abfdbe603bb5972604abb8d21453165 100644 --- a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php +++ b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockItemTest.php @@ -29,7 +29,7 @@ class StockItemTest extends WebapiAbstract /** * Resource path */ - const RESOURCE_PATH = '/V1/stockItem'; + const RESOURCE_PATH = '/V1/stockItems'; /** @var \Magento\Catalog\Model\Resource\Product\Collection */ protected $productCollection; diff --git a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockStatusTest.php b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockStatusTest.php index a751be1959c467ca45d503b4ec489d7dcde106bd..19579fe3325b58468582789c7654974c0b01ba3e 100644 --- a/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockStatusTest.php +++ b/dev/tests/api-functional/testsuite/Magento/CatalogInventory/Api/StockStatusTest.php @@ -14,7 +14,7 @@ use Magento\TestFramework\TestCase\WebapiAbstract; class StockStatusTest extends WebapiAbstract { const SERVICE_VERSION = 'V1'; - const RESOURCE_PATH = '/V1/stockStatus'; + const RESOURCE_PATH = '/V1/stockStatuses'; /** * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php index dc65d9ff0833cbaa152805997163794f657bcd54..dcb84bd552027feece69841952457ad583076c67 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/LinkManagementTest.php @@ -61,7 +61,7 @@ class LinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAbstract 'operation' => self::SERVICE_NAME . 'AddChild' ] ]; - $res = $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'childSku' => $childSku]); + $res = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'childSku' => $childSku]); $this->assertTrue($res); } @@ -77,7 +77,7 @@ class LinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAbstract protected function removeChild($productSku, $childSku) { - $resourcePath = self::RESOURCE_PATH . '/%s/child/%s'; + $resourcePath = self::RESOURCE_PATH . '/%s/children/%s'; $serviceInfo = [ 'rest' => [ 'resourcePath' => sprintf($resourcePath, $productSku, $childSku), @@ -89,7 +89,7 @@ class LinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAbstract 'operation' => self::SERVICE_NAME . 'RemoveChild' ] ]; - $requestData = ['productSku' => $productSku, 'childSku' => $childSku]; + $requestData = ['sku' => $productSku, 'childSku' => $childSku]; return $this->_webApiCall($serviceInfo, $requestData); } @@ -110,6 +110,6 @@ class LinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAbstract 'operation' => self::SERVICE_NAME . 'GetChildren' ] ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku]); } } diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php index 9c37f1453eaf044172e8dc1ecbb23c35ed7bd246..a14d5e9bd009e50963660a04d82769531ced3c1b 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php @@ -166,7 +166,7 @@ class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstrac ], ]; /** @var int $result */ - $result = $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'option' => $option]); + $result = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'option' => $option]); $this->assertGreaterThan(0, $result); } @@ -196,7 +196,7 @@ class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstrac $requestBody = ['option' => $option]; if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) { - $requestBody['productSku'] = $productSku; + $requestBody['sku'] = $productSku; $requestBody['option']['id'] = $optionId; } @@ -223,7 +223,7 @@ class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstrac 'operation' => self::SERVICE_NAME . 'GetList' ] ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku]); } /** @@ -244,7 +244,7 @@ class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstrac 'operation' => self::SERVICE_NAME . 'DeleteById' ] ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'optionId' => $optionId]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'id' => $optionId]); } /** @@ -265,7 +265,7 @@ class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstrac 'operation' => self::SERVICE_NAME . 'Get' ] ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'optionId' => $optionId]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'id' => $optionId]); } /** @@ -285,6 +285,6 @@ class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstrac 'operation' => self::SERVICE_NAME . 'GetList' ] ]; - return $this->_webApiCall($serviceInfo, ['productSku' => $productSku]); + return $this->_webApiCall($serviceInfo, ['sku' => $productSku]); } } diff --git a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionTypesListTest.php b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionTypesListTest.php index 6998a2266e52fec98c4a9971bac45f40f408e237..a96d5ca79a5cb22ccf148210a39a37f0b545ba81 100644 --- a/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionTypesListTest.php +++ b/dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionTypesListTest.php @@ -10,7 +10,7 @@ class OptionTypesListTest extends \Magento\TestFramework\TestCase\WebapiAbstract { const SERVICE_READ_NAME = 'configurableProductOptionTypesListV1'; const SERVICE_VERSION = 'V1'; - const RESOURCE_PATH = '/V1/configurable-products/:productSku/options/'; + const RESOURCE_PATH = '/V1/configurable-products/:sku/options/'; public function testGetTypes() { @@ -26,7 +26,7 @@ class OptionTypesListTest extends \Magento\TestFramework\TestCase\WebapiAbstract { $serviceInfo = [ 'rest' => [ - 'resourcePath' => str_replace(':productSku/', '', self::RESOURCE_PATH) . 'types', + 'resourcePath' => str_replace(':sku/', '', self::RESOURCE_PATH) . 'types', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php index 91b10316172d00186756c1acd8a67892662507c7..f7e988d062bbba12ccc7b951b6e18ddb3fb32c20 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php @@ -213,7 +213,11 @@ class CustomerRepositoryTest extends WebapiAbstract $lastName = $existingCustomerDataObject->getLastname(); $customerData[Customer::LASTNAME] = $lastName . 'Updated'; $newCustomerDataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($newCustomerDataObject, $customerData); + $this->dataObjectHelper->populateWithArray( + $newCustomerDataObject, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $serviceInfo = [ 'rest' => [ @@ -249,7 +253,11 @@ class CustomerRepositoryTest extends WebapiAbstract $lastName = $existingCustomerDataObject->getLastname(); $customerData[Customer::LASTNAME] = $lastName . 'Updated'; $newCustomerDataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($newCustomerDataObject, $customerData); + $this->dataObjectHelper->populateWithArray( + $newCustomerDataObject, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $serviceInfo = [ 'rest' => [ @@ -296,7 +304,11 @@ class CustomerRepositoryTest extends WebapiAbstract $customerData[Customer::LASTNAME] = $lastName . 'Updated'; $customerData[Customer::ID] = -1; $newCustomerDataObject = $this->customerDataFactory->create(); - $this->dataObjectHelper->populateWithArray($newCustomerDataObject, $customerData); + $this->dataObjectHelper->populateWithArray( + $newCustomerDataObject, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $serviceInfo = [ 'rest' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php index 78bb435b7af4d2c3a2ac98e7e7a8fde51a831566..56434acaf7b0135bb0d9bedc154a8b14b67a7a14 100644 --- a/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php @@ -113,7 +113,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => true, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Title', 'sort_order' => 1, @@ -159,7 +159,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Store View Title', 'sort_order' => 1, @@ -197,7 +197,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link with URL resources', 'sort_order' => 1, @@ -234,7 +234,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link with URL resources', 'sort_order' => 1, @@ -256,7 +256,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 1, @@ -285,7 +285,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 1, @@ -312,7 +312,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Title', 'sort_order' => 15, @@ -339,7 +339,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 1, @@ -368,7 +368,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 1, @@ -392,7 +392,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 1, @@ -419,7 +419,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 1, @@ -457,7 +457,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => $sortOrder, @@ -493,7 +493,7 @@ class LinkRepositoryTest extends WebapiAbstract { $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 0, @@ -529,7 +529,7 @@ class LinkRepositoryTest extends WebapiAbstract $this->createServiceInfo['rest']['resourcePath'] = '/V1/products/simple/downloadable-links'; $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'simple', + 'sku' => 'simple', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 50, @@ -554,7 +554,7 @@ class LinkRepositoryTest extends WebapiAbstract $this->createServiceInfo['rest']['resourcePath'] = '/V1/products/wrong-sku/downloadable-links'; $requestData = [ 'isGlobalScopeContent' => false, - 'productSku' => 'wrong-sku', + 'sku' => 'wrong-sku', 'linkContent' => [ 'title' => 'Link Title', 'sort_order' => 15, @@ -581,7 +581,7 @@ class LinkRepositoryTest extends WebapiAbstract $requestData = [ 'isGlobalScopeContent' => false, 'linkId' => $linkId, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Updated Title', 'sort_order' => 2, @@ -612,7 +612,7 @@ class LinkRepositoryTest extends WebapiAbstract $requestData = [ 'isGlobalScopeContent' => true, 'linkId' => $linkId, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Updated Title', 'sort_order' => 2, @@ -646,7 +646,7 @@ class LinkRepositoryTest extends WebapiAbstract $requestData = [ 'isGlobalScopeContent' => true, 'linkId' => 1, - 'productSku' => 'wrong-sku', + 'sku' => 'wrong-sku', 'linkContent' => [ 'title' => 'Updated Title', 'sort_order' => 2, @@ -671,7 +671,7 @@ class LinkRepositoryTest extends WebapiAbstract $requestData = [ 'isGlobalScopeContent' => true, 'linkId' => 9999, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Title', 'sort_order' => 2, @@ -698,7 +698,7 @@ class LinkRepositoryTest extends WebapiAbstract $requestData = [ 'isGlobalScopeContent' => false, 'linkId' => $linkId, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Updated Link Title', 'sort_order' => 2, @@ -725,7 +725,7 @@ class LinkRepositoryTest extends WebapiAbstract $requestData = [ 'isGlobalScopeContent' => false, 'linkId' => $linkId, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Updated Link Title', 'sort_order' => $sortOrder, @@ -751,7 +751,7 @@ class LinkRepositoryTest extends WebapiAbstract $requestData = [ 'isGlobalScopeContent' => false, 'linkId' => $linkId, - 'productSku' => 'downloadable-product', + 'sku' => 'downloadable-product', 'linkContent' => [ 'title' => 'Updated Link Title', 'sort_order' => 200, @@ -813,7 +813,7 @@ class LinkRepositoryTest extends WebapiAbstract ], ]; - $requestData = ['productSku' => $sku]; + $requestData = ['sku' => $sku]; $expectedMessage = 'Requested product doesn\'t exist'; try { @@ -845,7 +845,7 @@ class LinkRepositoryTest extends WebapiAbstract ], ]; - $requestData = ['productSku' => $sku]; + $requestData = ['sku' => $sku]; $list = $this->_webApiCall($serviceInfo, $requestData); $this->assertEmpty($list); @@ -871,7 +871,7 @@ class LinkRepositoryTest extends WebapiAbstract ], ]; - $requestData = ['productSku' => $sku]; + $requestData = ['sku' => $sku]; $list = $this->_webApiCall($serviceInfo, $requestData); diff --git a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php index 435333d1b1ff6a6668d12123126bf18119ada6fb..c4876bd7f9f14bb5627fcb6bffb6b2e5edbc6f93 100644 --- a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php @@ -73,7 +73,7 @@ class AttributeSetRepositoryTest extends WebapiAbstract $attributeSet = $this->getAttributeSetByName($attributeSetName); $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/eav/attribute-sets', + 'resourcePath' => '/V1/eav/attribute-sets/' . $attributeSet->getId(), 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkManagementTest.php b/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkManagementTest.php index 90cec13232000d8b00de2e09c49bc0e1027a5367..10e6d6f41ed029f84d9aab099da6cf27c462a736 100644 --- a/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkManagementTest.php @@ -32,7 +32,7 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb ], ]; - $actual = $this->_webApiCall($serviceInfo, ['productSku' => $productSku, 'type' => $linkType]); + $actual = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'type' => $linkType]); $expected = [ [ @@ -55,14 +55,14 @@ class ProductLinkManagementTest extends \Magento\TestFramework\TestCase\WebapiAb array_walk( $expected, function (&$item) { - $item['custom_attributes'] = [['attribute_code' => 'qty', 'value' => 1.0000]]; + $item['extension_attributes'] = ['qty' => 1.0000]; } ); } else { array_walk( $expected, function (&$item) { - $item['custom_attributes'] = [['attribute_code' => 'qty', 'value' => 1.0000]]; + $item['extension_attributes'] = ['qty' => 1.0000]; } ); } diff --git a/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkRepositoryTest.php index 4d375e84e39e9fadfea209c33cd29a5a9ef54d5b..69b1ef5073b6169102748462104bade23fc22017 100644 --- a/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GroupedProduct/Api/ProductLinkRepositoryTest.php @@ -37,8 +37,8 @@ class ProductLinkRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAb 'linked_product_type' => 'simple', 'linked_product_sku' => 'simple', 'position' => 3, - 'custom_attributes' => [ - 'qty' => ['attribute_code' => 'qty', 'value' => (float) 300.0000], + 'extension_attributes' => [ + 'qty' => (float) 300.0000, ], ]; @@ -55,7 +55,7 @@ class ProductLinkRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAb ]; $this->_webApiCall($serviceInfo, ['entity' => $productData]); - /** @var \Magento\Catalog\Model\ProductLink\Management $linkManagement */ + /** @var \Magento\Catalog\Api\ProductLinkManagementInterface $linkManagement */ $linkManagement = $this->objectManager->get('Magento\Catalog\Api\ProductLinkManagementInterface'); $actual = $linkManagement->getLinkedItemsByType($productSku, $linkType); array_walk($actual, function (&$item) { diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php index e411cc7903156b779ef651636eeebb0ca60f5b80..add493db96a143faf32a0d26e183122067aaa9e6 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/CartRepositoryTest.php @@ -153,18 +153,6 @@ class CartRepositoryTest extends WebapiAbstract { $cart = $this->getCart('test01'); - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => '/V1/carts', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, - ], - 'soap' => [ - 'service' => 'quoteCartRepositoryV1', - 'serviceVersion' => 'V1', - 'operation' => 'quoteCartRepositoryV1GetList', - ], - ]; - // The following two filters are used as alternatives. The target cart does not match the first one. $grandTotalFilter = $this->filterBuilder->setField('grand_total') ->setConditionType('gteq') @@ -195,6 +183,18 @@ class CartRepositoryTest extends WebapiAbstract $searchCriteria = $this->searchBuilder->create()->__toArray(); $requestData = ['searchCriteria' => $searchCriteria]; + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/carts' . '?' . http_build_query($requestData), + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => 'quoteCartRepositoryV1', + 'serviceVersion' => 'V1', + 'operation' => 'quoteCartRepositoryV1GetList', + ], + ]; + $searchResult = $this->_webApiCall($serviceInfo, $requestData); $this->assertArrayHasKey('total_count', $searchResult); $this->assertEquals(1, $searchResult['total_count']); diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoAddCommentTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoAddCommentTest.php index 86e5df82c426fb8954f32551900c45aed58f6b8e..909d1bf694e8fa61e9c4bf0b04b6108de30fffb0 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoAddCommentTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoAddCommentTest.php @@ -66,7 +66,7 @@ class CreditmemoAddCommentTest extends WebapiAbstract $requestData = ['entity' => $commentData]; $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/creditmemo/comment', + 'resourcePath' => '/V1/creditmemo/' . $creditmemo->getId() . '/comments', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoCreateTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoCreateTest.php index 5eb537e8fe78b44709fe801499ccc492bd38fe6a..1f3e32bcd3441fdde3cc3e07918bf2000b3a2746 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoCreateTest.php @@ -44,7 +44,7 @@ class CreditmemoCreateTest extends WebapiAbstract /** @var \Magento\Sales\Model\Order\Item $orderItem */ $orderItem = current($order->getAllItems()); $items = [ - $orderItem->getId() => ['qty' => $orderItem->getQtyInvoiced(), 'order_item_id' => $orderItem->getId()], + $orderItem->getId() => ['order_item_id' => $orderItem->getId(), 'qty' => $orderItem->getQtyInvoiced()], ]; $serviceInfo = [ 'rest' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceAddCommentTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceAddCommentTest.php index a6ad6436a54d3dd00bb3bfb3c2d16464716a85cc..fb69f3e2bf944ae199ce963c484f6638b87457be 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceAddCommentTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceAddCommentTest.php @@ -47,7 +47,7 @@ class InvoiceAddCommentTest extends WebapiAbstract $requestData = ['entity' => $commentData]; $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/invoice/comment', + 'resourcePath' => '/V1/invoices/comments', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCommentsListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCommentsListTest.php index 22f4c333de797034bf809714300a744abfaca2c2..d03981ed76af47d0c93b36984e1bd44acae0a1a4 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCommentsListTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCommentsListTest.php @@ -34,7 +34,7 @@ class InvoiceCommentsListTest extends WebapiAbstract $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/invoice/' . $invoice->getId() . '/comments', + 'resourcePath' => '/V1/invoices/' . $invoice->getId() . '/comments', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCreateTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCreateTest.php index 10c54d043e878d1ccbdddd0d877579266c6deb32..3237b600d6194811759404a099936f0d4b9e1f87 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceCreateTest.php @@ -12,7 +12,7 @@ use Magento\TestFramework\TestCase\WebapiAbstract; */ class InvoiceCreateTest extends WebapiAbstract { - const RESOURCE_PATH = '/V1/invoice'; + const RESOURCE_PATH = '/V1/invoices'; const SERVICE_READ_NAME = 'salesInvoiceRepositoryV1'; diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceEmailTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceEmailTest.php index 572becdd7c535fd6215a29faa109bf871a74fe8e..66ae7db9a299d598a630f249f377cce6d4d00472 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceEmailTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceEmailTest.php @@ -26,7 +26,7 @@ class InvoiceEmailTest extends WebapiAbstract $invoice = $invoiceCollection->getFirstItem(); $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/invoice/' . $invoice->getId() . '/email', + 'resourcePath' => '/V1/invoices/' . $invoice->getId() . '/emails', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php index da6c9291912d6c5fc839f27386551d32243ecb99..9e7758a570e5c6098ff156809b6341d6e58ce7d5 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php @@ -12,7 +12,7 @@ use Magento\TestFramework\TestCase\WebapiAbstract; */ class InvoiceGetTest extends WebapiAbstract { - const RESOURCE_PATH = '/V1/invoice'; + const RESOURCE_PATH = '/V1/invoices'; const SERVICE_READ_NAME = 'salesInvoiceRepositoryV1'; diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderAddressUpdateTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderAddressUpdateTest.php index 40a5fb8975ed64dd2df16026dc7cc4ed8c483ce2..337a532d256f520afa592be6a0b56df861f37e08 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderAddressUpdateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderAddressUpdateTest.php @@ -59,7 +59,7 @@ class OrderAddressUpdateTest extends WebapiAbstract $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/order/' . $order->getId(), + 'resourcePath' => '/V1/orders/' . $order->getId(), 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCancelTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCancelTest.php index e9b2afe36752e38637cab12fe107f39866b5c739..cd7cce323670340ab67a36af31dc722f5a1f4df9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCancelTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCancelTest.php @@ -23,7 +23,7 @@ class OrderCancelTest extends WebapiAbstract $order = $objectManager->get('Magento\Sales\Model\Order')->loadByIncrementId('100000001'); $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/order/' . $order->getId() . '/cancel', + 'resourcePath' => '/V1/orders/' . $order->getId() . '/cancel', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCommentsListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCommentsListTest.php index 4117b042e1fa72177eb1b1a6d3f8632785039260..50f697f2039bf680fd8150d2d8764ceb1b7a9a57 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCommentsListTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCommentsListTest.php @@ -28,7 +28,7 @@ class OrderCommentsListTest extends WebapiAbstract $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/order/' . $order->getId() . '/comments', + 'resourcePath' => '/V1/orders/' . $order->getId() . '/comments', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCreateTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCreateTest.php index d3bb09f340db73f6839c74e741fd89a1aca37fd7..9671029364b2c5fcfb594ddd02cf74d9aaf20e1b 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderCreateTest.php @@ -10,7 +10,7 @@ use Magento\TestFramework\TestCase\WebapiAbstract; class OrderCreateTest extends WebapiAbstract { - const RESOURCE_PATH = '/V1/order'; + const RESOURCE_PATH = '/V1/orders'; const SERVICE_READ_NAME = 'salesOrderRepositoryV1'; @@ -32,11 +32,11 @@ class OrderCreateTest extends WebapiAbstract { /** @var \Magento\Sales\Model\Order $orderBuilder */ $orderFactory = $this->objectManager->get('Magento\Sales\Model\OrderFactory'); - /** @var \Magento\Sales\Service\V1\Data\OrderItemBuilder $orderItemBuilder */ + /** @var \Magento\Sales\Api\Data\OrderItemFactory $orderItemFactory */ $orderItemFactory = $this->objectManager->get('Magento\Sales\Model\Order\ItemFactory'); - /** @var \Magento\Sales\Service\V1\Data\OrderPaymentBuilder $orderPaymentBuilder */ + /** @var \Magento\Sales\Api\Data\OrderPaymentFactory $orderPaymentFactory */ $orderPaymentFactory = $this->objectManager->get('Magento\Sales\Model\Order\PaymentFactory'); - /** @var \Magento\Sales\Service\V1\Data\OrderAddressBuilder $orderAddressBuilder */ + /** @var \Magento\Sales\Api\Data\OrderAddressFactory $orderAddressFactory */ $orderAddressFactory = $this->objectManager->get('Magento\Sales\Model\Order\AddressFactory'); $order = $orderFactory->create( diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderEmailTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderEmailTest.php index ed9722292bd9d10c6fb41f26ccec571cbaf1a8bb..6044e173013285687a27546625d9b1878a667fea 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderEmailTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderEmailTest.php @@ -24,7 +24,7 @@ class OrderEmailTest extends WebapiAbstract $order->loadByIncrementId('100000001'); $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/order/' . $order->getId() . '/email', + 'resourcePath' => '/V1/orders/' . $order->getId() . '/emails', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetStatusTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetStatusTest.php index 94f18257d8e443d4030dd2c6887c47cb088f1bd3..a45e17ccc48585457cf6b3e47748bd52f45c2794 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetStatusTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetStatusTest.php @@ -13,7 +13,7 @@ use Magento\TestFramework\TestCase\WebapiAbstract; */ class OrderGetStatusTest extends WebapiAbstract { - const RESOURCE_PATH = '/V1/order/%d/status'; + const RESOURCE_PATH = '/V1/orders/%d/statuses'; const SERVICE_READ_NAME = 'salesOrderManagementV1'; diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php index d590af9442b7f1f78fc5c2f617b6ffe2330f9a7d..46c3c7ca1b96392611dc62081e43bfb385eb478a 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php @@ -9,7 +9,7 @@ use Magento\TestFramework\TestCase\WebapiAbstract; class OrderGetTest extends WebapiAbstract { - const RESOURCE_PATH = '/V1/order'; + const RESOURCE_PATH = '/V1/orders'; const SERVICE_READ_NAME = 'salesOrderRepositoryV1'; diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderHoldTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderHoldTest.php index 72d05d8f6c79106b0ba33c48b99fb8bf0658646c..bd693a814ad3cc5e747972def80ef2722a1f8f57 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderHoldTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderHoldTest.php @@ -23,7 +23,7 @@ class OrderHoldTest extends WebapiAbstract $order = $objectManager->get('Magento\Sales\Model\Order')->loadByIncrementId('100000001'); $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/order/' . $order->getId() . '/hold', + 'resourcePath' => '/V1/orders/' . $order->getId() . '/hold', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderStatusHistoryAddTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderStatusHistoryAddTest.php index bb779d74cc0fd70f3eef788647fddc588e5ce141..95858cce508621c7d1bf7aa4d3dee5df379fd9d9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderStatusHistoryAddTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderStatusHistoryAddTest.php @@ -57,7 +57,7 @@ class OrderStatusHistoryAddTest extends WebapiAbstract $requestData = ['id' => $order->getId(), 'statusHistory' => $commentData]; $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/order/' . $order->getId() . '/comment', + 'resourcePath' => '/V1/orders/' . $order->getId() . '/comments', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderUnHoldTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderUnHoldTest.php index a8e2a81d6bda64ca1142cdddbd3c4bb8acefa80b..572ba2409e070865e0f9ef9b316c24e93b35c558 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderUnHoldTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderUnHoldTest.php @@ -27,7 +27,7 @@ class OrderUnHoldTest extends WebapiAbstract } $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/order/' . $order->getId() . '/unhold', + 'resourcePath' => '/V1/orders/' . $order->getId() . '/unhold', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentAddCommentTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentAddCommentTest.php index 3e76bd29340a90430ba96116673f82249d4049ea..330fd56c430b6dd682fa9f6d50e530fac74884a2 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentAddCommentTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentAddCommentTest.php @@ -61,7 +61,7 @@ class ShipmentAddCommentTest extends WebapiAbstract $requestData = ['entity' => $commentData]; $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/shipment/comment', + 'resourcePath' => '/V1/shipment/' . $shipment->getId() . '/comments', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentEmailTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentEmailTest.php index 947d51f70f4b15c1ac3fe0a3141116723614e4f9..d6b59d22475398ce532469035661fba7a51edd64 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentEmailTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentEmailTest.php @@ -27,7 +27,7 @@ class ShipmentEmailTest extends WebapiAbstract $shipment = $shipmentCollection->getFirstItem(); $serviceInfo = [ 'rest' => [ - 'resourcePath' => '/V1/shipment/' . $shipment->getId() . '/email', + 'resourcePath' => '/V1/shipment/' . $shipment->getId() . '/emails', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, ], 'soap' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php index 4827823190d200e3f3cfa0fcfea198a871cb31dc..1557278ce1bb31a76ac96d90a90c57b6bada4d21 100644 --- a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php @@ -23,7 +23,7 @@ class TaxClassRepositoryTest extends WebapiAbstract { const SERVICE_NAME = 'taxTaxClassRepositoryV1'; const SERVICE_VERSION = 'V1'; - const RESOURCE_PATH = '/V1/taxClass'; + const RESOURCE_PATH = '/V1/taxClasses'; /** @var SearchCriteriaBuilder */ private $searchCriteriaBuilder; diff --git a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php index 33b8a783507b35a5fbfbb355d093d1e3349e00a4..6bd1fb20cf5410ba7b209334bdf9437e02f376f4 100644 --- a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php @@ -18,7 +18,7 @@ class TaxRateRepositoryTest extends WebapiAbstract { const SERVICE_NAME = "taxTaxRateRepositoryV1"; const SERVICE_VERSION = "V1"; - const RESOURCE_PATH = "/V1/taxRate"; + const RESOURCE_PATH = "/V1/taxRates"; /** @var \Magento\Tax\Model\Calculation\Rate[] */ private $fixtureTaxRates; diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/DataObjectSerialization/CustomAttributeSerializationMSCTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/DataObjectSerialization/CustomAttributeSerializationMSCTest.php deleted file mode 100644 index 98f09fbe0795185b8614a36633af680685d2ec23..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/DataObjectSerialization/CustomAttributeSerializationMSCTest.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Webapi\DataObjectSerialization; - -use Magento\Framework\Reflection\DataObjectProcessor; -use Magento\Framework\Webapi\ServiceOutputProcessor; -use Magento\TestFramework\Helper\Bootstrap; -use Magento\TestModuleMSC\Api\Data\ItemDataBuilder; - -/** - * api-functional/testsuite/Magento/Webapi/DataObjectSerialization/CustomAttributeSerializationMSCTest.php - * Class to test if custom attributes are serialized correctly for the new Module Service Contract approach - */ -class CustomAttributeSerializationMSCTest extends \Magento\Webapi\Routing\BaseService -{ - /** - * @var string - */ - protected $_version; - /** - * @var string - */ - protected $_restResourcePath; - /** - * @var string - */ - protected $_soapService = 'testModuleMSCAllSoapAndRest'; - - /** - * @var ItemDataBuilder - */ - protected $itemDataBuilder; - - /** - * @var \Magento\TestModuleMSC\Api\Data\CustomAttributeNestedDataObjectDataBuilder - */ - protected $customAttributeNestedDataObjectDataBuilder; - - /** - * @var \Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectDataBuilder - */ - protected $customAttributeDataObjectDataBuilder; - - /** - * @var DataObjectProcessor $dataObjectProcessor - */ - protected $dataObjectProcessor; - - /** - * @var ServiceOutputProcessor $serviceOutputProcessor - */ - protected $serviceOutputProcessor; - - /** - * Set up custom attribute related data objects - */ - protected function setUp() - { - $this->_version = 'V1'; - $this->_soapService = 'testModuleMSCAllSoapAndRestV1'; - $this->_restResourcePath = "/{$this->_version}/testmoduleMSC/"; - - $this->itemDataBuilder = Bootstrap::getObjectManager()->create( - 'Magento\TestModuleMSC\Api\Data\ItemDataBuilder' - ); - - $this->customAttributeNestedDataObjectDataBuilder = Bootstrap::getObjectManager()->create( - 'Magento\TestModuleMSC\Api\Data\CustomAttributeNestedDataObjectDataBuilder' - ); - - $this->customAttributeDataObjectDataBuilder = Bootstrap::getObjectManager()->create( - 'Magento\TestModuleMSC\Api\Data\CustomAttributeDataObjectDataBuilder' - ); - - $this->dataObjectProcessor = Bootstrap::getObjectManager()->create( - 'Magento\Framework\Reflection\DataObjectProcessor' - ); - - $this->serviceOutputProcessor = Bootstrap::getObjectManager()->create( - 'Magento\Framework\Webapi\ServiceOutputProcessor' - ); - } - - public function testSimpleAndNonExistentCustomAttributes() - { - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemAnyType', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'ItemAnyType'], - ]; - $requestData = [ - 'item_id' => 1, - 'name' => 'testProductAnyType', - 'custom_attributes' => [ - 'non_existent' => [ - 'attribute_code' => 'non_existent', - 'value' => 'test', - ], - 'custom_attribute_string' => [ - 'attribute_code' => 'custom_attribute_string', - 'value' => 'someStringValue', - ], - ], - ]; - $result = $this->_webApiCall($serviceInfo, ['entityItem' => $requestData]); - - //The non_existent custom attribute should be dropped since its not a defined custom attribute - $expectedResponse = [ - 'item_id' => 1, - 'name' => 'testProductAnyType', - 'custom_attributes' => [ - [ - 'attribute_code' => 'custom_attribute_string', - 'value' => 'someStringValue', - ], - ], - ]; - - //\Magento\TestModuleMSC\Api\AllSoapAndRest::itemAnyType just return the input data back as response - $this->assertEquals($expectedResponse, $result); - } - - public function testDataObjectCustomAttributes() - { - $customAttributeDataObject = $this->customAttributeDataObjectDataBuilder - ->setName('nameValue') - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); - - $item = $this->itemDataBuilder - ->setItemId(1) - ->setName('testProductAnyType') - ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemAnyType', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'ItemAnyType'], - ]; - $requestData = $this->dataObjectProcessor->buildOutputDataArray( - $item, - '\Magento\TestModuleMSC\Api\Data\ItemInterface' - ); - $result = $this->_webApiCall($serviceInfo, ['entityItem' => $requestData]); - - $expectedResponse = $this->serviceOutputProcessor->process( - $item, - '\Magento\TestModuleMSC\Api\AllSoapAndRestInterface', - 'itemAnyType' - ); - //\Magento\TestModuleMSC\Api\AllSoapAndRest::itemAnyType just return the input data back as response - $this->assertEquals($expectedResponse, $result); - } - - public function testDataObjectCustomAttributesPreconfiguredItem() - { - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemPreconfigured', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'GetPreconfiguredItem'], - ]; - - $result = $this->_webApiCall($serviceInfo, []); - - $customAttributeDataObject = $this->customAttributeDataObjectDataBuilder - ->setName('nameValue') - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); - - $item = $this->itemDataBuilder - ->setItemId(1) - ->setName('testProductAnyType') - ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); - - $expectedResponse = $this->serviceOutputProcessor->process( - $item, - '\Magento\TestModuleMSC\Api\AllSoapAndRestInterface', - 'getPreconfiguredItem' - ); - $this->assertEquals($expectedResponse, $result); - } - - public function testNestedDataObjectCustomAttributes() - { - $customAttributeNestedDataObject = $this->customAttributeNestedDataObjectDataBuilder - ->setName('nestedNameValue') - ->create(); - - $customAttributeDataObject = $this->customAttributeDataObjectDataBuilder - ->setName('nameValue') - ->setCustomAttribute('custom_attribute_nested', $customAttributeNestedDataObject) - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); - - $item = $this->itemDataBuilder - ->setItemId(1) - ->setName('testProductAnyType') - ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemAnyType', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'ItemAnyType'], - ]; - $requestData = $this->dataObjectProcessor->buildOutputDataArray( - $item, - '\Magento\TestModuleMSC\Api\Data\ItemInterface' - ); - $result = $this->_webApiCall($serviceInfo, ['entityItem' => $requestData]); - - $expectedResponse = $this->serviceOutputProcessor->process( - $item, - '\Magento\TestModuleMSC\Api\AllSoapAndRestInterface', - 'itemAnyType' - ); - //\Magento\TestModuleMSC\Api\AllSoapAndRest::itemAnyType just return the input data back as response - $this->assertEquals($expectedResponse, $result); - } -} diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/DataObjectSerialization/CustomAttributeSerializationTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/DataObjectSerialization/CustomAttributeSerializationTest.php deleted file mode 100644 index c135e8e0adc2889f855cc7a7cefc1e397a5d5099..0000000000000000000000000000000000000000 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/DataObjectSerialization/CustomAttributeSerializationTest.php +++ /dev/null @@ -1,219 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * Class to test if custom attributes are serialized correctly - */ -namespace Magento\Webapi\DataObjectSerialization; - -use Magento\Framework\Webapi\ServiceOutputProcessor; -use Magento\TestFramework\Helper\Bootstrap; -use Magento\TestModule1\Service\V1\Entity\ItemBuilder; - -class CustomAttributeSerializationTest extends \Magento\Webapi\Routing\BaseService -{ - /** - * @var string - */ - protected $_version; - /** - * @var string - */ - protected $_restResourcePath; - /** - * @var string - */ - protected $_soapService = 'testModule1AllSoapAndRest'; - - /** - * @var ItemBuilder - */ - protected $itemBuilder; - - /** - * @var \Magento\TestModule1\Service\V1\Entity\CustomAttributeNestedDataObjectBuilder - */ - protected $customAttributeNestedDataObjectBuilder; - - /** - * @var \Magento\TestModule1\Service\V1\Entity\CustomAttributeDataObjectBuilder - */ - protected $customAttributeDataObjectBuilder; - - /** - * @var ServiceOutputProcessor $serviceOutputProcessor - */ - protected $serviceOutputProcessor; - - /** - * Set up custom attribute related data objects - */ - protected function setUp() - { - $this->_version = 'V1'; - $this->_soapService = 'testModule1AllSoapAndRestV1'; - $this->_restResourcePath = "/{$this->_version}/testmodule1/"; - - $this->itemBuilder = Bootstrap::getObjectManager()->create( - 'Magento\TestModule1\Service\V1\Entity\ItemBuilder' - ); - - $this->customAttributeNestedDataObjectBuilder = Bootstrap::getObjectManager()->create( - 'Magento\TestModule1\Service\V1\Entity\CustomAttributeNestedDataObjectBuilder' - ); - - $this->customAttributeDataObjectBuilder = Bootstrap::getObjectManager()->create( - 'Magento\TestModule1\Service\V1\Entity\CustomAttributeDataObjectBuilder' - ); - - $this->serviceOutputProcessor = Bootstrap::getObjectManager()->create( - 'Magento\Framework\Webapi\ServiceOutputProcessor' - ); - } - - public function testSimpleAndNonExistentCustomAttributes() - { - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemAnyType', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'ItemAnyType'], - ]; - $requestData = [ - 'item_id' => 1, - 'name' => 'testProductAnyType', - 'custom_attributes' => [ - 'non_existent' => [ - 'attribute_code' => 'non_existent', - 'value' => 'test', - ], - 'custom_attribute_string' => [ - 'attribute_code' => 'custom_attribute_string', - 'value' => 'someStringValue', - ], - ], - ]; - $result = $this->_webApiCall($serviceInfo, ['entityItem' => $requestData]); - - //The non_existent custom attribute should be dropped since its not a defined custom attribute - $expectedResponse = [ - 'item_id' => 1, - 'name' => 'testProductAnyType', - 'custom_attributes' => [ - [ - 'attribute_code' => 'custom_attribute_string', - 'value' => 'someStringValue', - ], - ], - ]; - - //\Magento\TestModule1\Service\V1\AllSoapAndRest::itemAnyType just return the input data back as response - $this->assertEquals($expectedResponse, $result); - } - - public function testDataObjectCustomAttributes() - { - $customAttributeDataObject = $this->customAttributeDataObjectBuilder - ->setName('nameValue') - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); - - $item = $this->itemBuilder - ->setItemId(1) - ->setName('testProductAnyType') - ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemAnyType', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'ItemAnyType'], - ]; - $requestData = $item->__toArray(); - $result = $this->_webApiCall($serviceInfo, ['entityItem' => $requestData]); - - $expectedResponse = $this->serviceOutputProcessor->process( - $item, - '\Magento\TestModule1\Service\V1\AllSoapAndRestInterface', - 'itemAnyType' - ); - //\Magento\TestModule1\Service\V1\AllSoapAndRest::itemAnyType just return the input data back as response - $this->assertEquals($expectedResponse, $result); - } - - public function testDataObjectCustomAttributesPreconfiguredItem() - { - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemPreconfigured', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'GetPreconfiguredItem'], - ]; - - $result = $this->_webApiCall($serviceInfo, []); - - $customAttributeDataObject = $this->customAttributeDataObjectBuilder - ->setName('nameValue') - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); - - $item = $this->itemBuilder - ->setItemId(1) - ->setName('testProductAnyType') - ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); - $expectedResponse = $this->serviceOutputProcessor->process( - $item, - '\Magento\TestModule1\Service\V1\AllSoapAndRestInterface', - 'getPreconfiguredItem' - ); - $this->assertEquals($expectedResponse, $result); - } - - public function testNestedDataObjectCustomAttributes() - { - $customAttributeNestedDataObject = $this->customAttributeNestedDataObjectBuilder - ->setName('nestedNameValue') - ->create(); - - $customAttributeDataObject = $this->customAttributeDataObjectBuilder - ->setName('nameValue') - ->setCustomAttribute('custom_attribute_nested', $customAttributeNestedDataObject) - ->setCustomAttribute('custom_attribute_int', 1) - ->create(); - - $item = $this->itemBuilder - ->setItemId(1) - ->setName('testProductAnyType') - ->setCustomAttribute('custom_attribute_data_object', $customAttributeDataObject) - ->setCustomAttribute('custom_attribute_string', 'someStringValue') - ->create(); - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $this->_restResourcePath . 'itemAnyType', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'ItemAnyType'], - ]; - $requestData = $item->__toArray(); - $result = $this->_webApiCall($serviceInfo, ['entityItem' => $requestData]); - - $expectedResponse = $this->serviceOutputProcessor->process( - $item, - '\Magento\TestModule1\Service\V1\AllSoapAndRestInterface', - 'itemAnyType' - ); - //\Magento\TestModule1\Service\V1\AllSoapAndRest::itemAnyType just return the input data back as response - $this->assertEquals($expectedResponse, $result); - } -} diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RequestIdOverrideTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RequestIdOverrideTest.php index f53fee3189db52c68b39ebefa24f1470f60c7bea..67eb179b9171f312c246898c27d636cec7bf88a5 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RequestIdOverrideTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RequestIdOverrideTest.php @@ -26,9 +26,9 @@ class RequestIdOverrideTest extends \Magento\Webapi\Routing\BaseService protected $_restResourcePath; /** - * @var \Magento\TestModule5\Service\V1\Entity\AllSoapAndRestBuilder + * @var \Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory */ - protected $itemBuilder; + protected $itemFactory; /** * @var string @@ -40,8 +40,8 @@ class RequestIdOverrideTest extends \Magento\Webapi\Routing\BaseService $this->_markTestAsRestOnly('Request Id overriding is a REST based feature.'); $this->_version = 'V1'; $this->_restResourcePath = "/{$this->_version}/TestModule5/"; - $this->itemBuilder = Bootstrap::getObjectManager() - ->create('Magento\TestModule5\Service\V1\Entity\AllSoapAndRestBuilder'); + $this->itemFactory = Bootstrap::getObjectManager() + ->create('Magento\TestModule5\Service\V1\Entity\AllSoapAndRestFactory'); } public function testOverride() @@ -54,10 +54,9 @@ class RequestIdOverrideTest extends \Magento\Webapi\Routing\BaseService 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], ]; - $item = $this->itemBuilder + $item = $this->itemFactory->create() ->setEntityId($incorrectItemId) - ->setName('test') - ->create(); + ->setName('test'); $requestData = ['entityItem' => $item->__toArray()]; $item = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals( @@ -78,10 +77,9 @@ class RequestIdOverrideTest extends \Magento\Webapi\Routing\BaseService 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], ]; - $item = $this->itemBuilder + $item = $this->itemFactory->create() ->setEntityId($incorrectItemId) - ->setName('test') - ->create(); + ->setName('test'); $requestData = ['entityItem' => $item->__toArray()]; $item = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals( @@ -100,9 +98,8 @@ class RequestIdOverrideTest extends \Magento\Webapi\Routing\BaseService 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, ], ]; - $item = $this->itemBuilder - ->setName('test') - ->create(); + $item = $this->itemFactory->create() + ->setName('test'); $requestData = ['entityItem' => $item->__toArray()]; $item = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals( diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/ServiceVersionV1Test.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/ServiceVersionV1Test.php index e2aa1d4098488e7bf5b7af4e4e899332fbde93a3..588c0e095d2760459f71e27e4d25c9d4143ae1e4 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/ServiceVersionV1Test.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/ServiceVersionV1Test.php @@ -12,7 +12,8 @@ namespace Magento\Webapi\Routing; use Magento\Framework\Api\AttributeValue; use Magento\TestFramework\Authentication\OauthHelper; use Magento\TestFramework\Helper\Bootstrap; -use Magento\TestModule1\Service\V1\Entity\ItemBuilder; +use Magento\TestModule1\Service\V1\Entity\Item; +use Magento\TestModule1\Service\V1\Entity\ItemFactory; class ServiceVersionV1Test extends \Magento\Webapi\Routing\BaseService { @@ -29,11 +30,11 @@ class ServiceVersionV1Test extends \Magento\Webapi\Routing\BaseService */ protected $_soapService = 'testModule1AllSoapAndRest'; - /** @var \Magento\Framework\Api\AttributeDataBuilder */ - protected $valueBuilder; + /** @var \Magento\Framework\Api\AttributeValueFactory */ + protected $valueFactory; - /** @var ItemBuilder */ - protected $itemBuilder; + /** @var ItemFactory */ + protected $itemFactory; protected function setUp() { @@ -41,12 +42,12 @@ class ServiceVersionV1Test extends \Magento\Webapi\Routing\BaseService $this->_soapService = 'testModule1AllSoapAndRestV1'; $this->_restResourcePath = "/{$this->_version}/testmodule1/"; - $this->valueBuilder = Bootstrap::getObjectManager()->create( - 'Magento\Framework\Api\AttributeDataBuilder' + $this->valueFactory = Bootstrap::getObjectManager()->create( + 'Magento\Framework\Api\AttributeValueFactory' ); - $this->itemBuilder = Bootstrap::getObjectManager()->create( - 'Magento\TestModule1\Service\V1\Entity\ItemBuilder' + $this->itemFactory = Bootstrap::getObjectManager()->create( + 'Magento\TestModule1\Service\V1\Entity\ItemFactory' ); } @@ -76,38 +77,34 @@ class ServiceVersionV1Test extends \Magento\Webapi\Routing\BaseService { $this->_markTestAsRestOnly('Test will fail for SOAP because attribute values get converted to strings.'); $customerAttributes = [ - ItemBuilder::CUSTOM_ATTRIBUTE_1 => [ - AttributeValue::ATTRIBUTE_CODE => ItemBuilder::CUSTOM_ATTRIBUTE_1, + Item::CUSTOM_ATTRIBUTE_1 => [ + AttributeValue::ATTRIBUTE_CODE => Item::CUSTOM_ATTRIBUTE_1, AttributeValue::VALUE => '12345', ], - ItemBuilder::CUSTOM_ATTRIBUTE_2 => [ - AttributeValue::ATTRIBUTE_CODE => ItemBuilder::CUSTOM_ATTRIBUTE_2, + Item::CUSTOM_ATTRIBUTE_2 => [ + AttributeValue::ATTRIBUTE_CODE => Item::CUSTOM_ATTRIBUTE_2, AttributeValue::VALUE => 12345, ], - ItemBuilder::CUSTOM_ATTRIBUTE_3 => [ - AttributeValue::ATTRIBUTE_CODE => ItemBuilder::CUSTOM_ATTRIBUTE_3, + Item::CUSTOM_ATTRIBUTE_3 => [ + AttributeValue::ATTRIBUTE_CODE => Item::CUSTOM_ATTRIBUTE_3, AttributeValue::VALUE => true, ], ]; - $attributeValue1 = $this->valueBuilder - ->setAttributeCode(ItemBuilder::CUSTOM_ATTRIBUTE_1) - ->setValue('12345') - ->create(); - $attributeValue2 = $this->valueBuilder - ->setAttributeCode(ItemBuilder::CUSTOM_ATTRIBUTE_2) - ->setValue(12345) - ->create(); - $attributeValue3 = $this->valueBuilder - ->setAttributeCode(ItemBuilder::CUSTOM_ATTRIBUTE_3) - ->setValue(true) - ->create(); + $attributeValue1 = $this->valueFactory->create() + ->setAttributeCode(Item::CUSTOM_ATTRIBUTE_1) + ->setValue('12345'); + $attributeValue2 = $this->valueFactory->create() + ->setAttributeCode(Item::CUSTOM_ATTRIBUTE_2) + ->setValue(12345); + $attributeValue3 = $this->valueFactory->create() + ->setAttributeCode(Item::CUSTOM_ATTRIBUTE_3) + ->setValue(true); - $item = $this->itemBuilder + $item = $this->itemFactory->create() ->setItemId(1) ->setName('testProductAnyType') - ->setCustomAttributes([$attributeValue1, $attributeValue2, $attributeValue3]) - ->create(); + ->setCustomAttributes([$attributeValue1, $attributeValue2, $attributeValue3]); $serviceInfo = [ 'rest' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php index aedba2b6b94486a63a736b240d3f5036a1a1c839..c093b3dcf0ad2e9de6510e1f165a9fbec30ceddb 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/WsdlGenerationFromDataObjectTest.php @@ -24,19 +24,38 @@ class WsdlGenerationFromDataObjectTest extends \Magento\TestFramework\TestCase\W /** @var string */ protected $_soapUrl; + /** @var bool */ + protected $isSingleService; + protected function setUp() { $this->_markTestAsSoapOnly("WSDL generation tests are intended to be executed for SOAP adapter only."); $this->_storeCode = Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface') ->getStore()->getCode(); - $this->_soapUrl = "{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV1%2CtestModule5AllSoapAndRestV2"; parent::setUp(); } public function testMultiServiceWsdl() { + $this->_soapUrl = "{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV1%2CtestModule5AllSoapAndRestV2"; $wsdlUrl = $this->_getBaseWsdlUrl() . 'testModule5AllSoapAndRestV1,testModule5AllSoapAndRestV2'; $wsdlContent = $this->_convertXmlToString($this->_getWsdlContent($wsdlUrl)); + $this->isSingleService = false; + + $this->_checkTypesDeclaration($wsdlContent); + $this->_checkPortTypeDeclaration($wsdlContent); + $this->_checkBindingDeclaration($wsdlContent); + $this->_checkServiceDeclaration($wsdlContent); + $this->_checkMessagesDeclaration($wsdlContent); + $this->_checkFaultsDeclaration($wsdlContent); + } + + public function testSingleServiceWsdl() + { + $this->_soapUrl = "{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV2"; + $wsdlUrl = $this->_getBaseWsdlUrl() . 'testModule5AllSoapAndRestV2'; + $wsdlContent = $this->_convertXmlToString($this->_getWsdlContent($wsdlUrl)); + $this->isSingleService = true; $this->_checkTypesDeclaration($wsdlContent); $this->_checkPortTypeDeclaration($wsdlContent); @@ -129,17 +148,30 @@ TYPES_SECTION_DECLARATION; */ protected function _checkElementsDeclaration($wsdlContent) { - $requestElement = <<< REQUEST_ELEMENT + if ($this->isSingleService) { + $requestElement = <<< REQUEST_ELEMENT +<xsd:element name="testModule5AllSoapAndRestV2ItemRequest" type="tns:TestModule5AllSoapAndRestV2ItemRequest"/> +REQUEST_ELEMENT; + } else { + $requestElement = <<< REQUEST_ELEMENT <xsd:element name="testModule5AllSoapAndRestV1ItemRequest" type="tns:TestModule5AllSoapAndRestV1ItemRequest"/> REQUEST_ELEMENT; + } $this->assertContains( $this->_convertXmlToString($requestElement), $wsdlContent, 'Request element declaration in types section is invalid' ); - $responseElement = <<< RESPONSE_ELEMENT + + if ($this->isSingleService) { + $responseElement = <<< RESPONSE_ELEMENT +<xsd:element name="testModule5AllSoapAndRestV2ItemResponse" type="tns:TestModule5AllSoapAndRestV2ItemResponse"/> +RESPONSE_ELEMENT; + } else { + $responseElement = <<< RESPONSE_ELEMENT <xsd:element name="testModule5AllSoapAndRestV1ItemResponse" type="tns:TestModule5AllSoapAndRestV1ItemResponse"/> RESPONSE_ELEMENT; + } $this->assertContains( $this->_convertXmlToString($responseElement), $wsdlContent, @@ -149,11 +181,37 @@ RESPONSE_ELEMENT; /** * @param string $wsdlContent + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _checkComplexTypesDeclaration($wsdlContent) { // @codingStandardsIgnoreStart - $requestType = <<< REQUEST_TYPE + if ($this->isSingleService) { + $requestType = <<< REQUEST_TYPE +<xsd:complexType name="TestModule5AllSoapAndRestV2ItemRequest"> + <xsd:annotation> + <xsd:documentation>Retrieve existing item.</xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_soapUrl}"/> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="id" minOccurs="1" maxOccurs="1" type="xsd:int"> + <xsd:annotation> + <xsd:documentation></xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_soapUrl}"> + <inf:min/> + <inf:max/> + <inf:callInfo> + <inf:callName>testModule5AllSoapAndRestV2Item</inf:callName> + <inf:requiredInput>Yes</inf:requiredInput> + </inf:callInfo> + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> +</xsd:complexType> +REQUEST_TYPE; + } else { + $requestType = <<< REQUEST_TYPE <xsd:complexType name="TestModule5AllSoapAndRestV1ItemRequest"> <xsd:annotation> <xsd:documentation>Retrieve an item.</xsd:documentation> @@ -176,14 +234,41 @@ RESPONSE_ELEMENT; </xsd:sequence> </xsd:complexType> REQUEST_TYPE; + } // @codingStandardsIgnoreEnd $this->assertContains( $this->_convertXmlToString($requestType), $wsdlContent, 'Request type declaration in types section is invalid' ); + // @codingStandardsIgnoreStart - $responseType = <<< RESPONSE_TYPE + if ($this->isSingleService) { + $responseType = <<< RESPONSE_TYPE +<xsd:complexType name="TestModule5AllSoapAndRestV2ItemResponse"> + <xsd:annotation> + <xsd:documentation> + Response container for the testModule5AllSoapAndRestV2Item call. + </xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_soapUrl}"/> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="result" minOccurs="1" maxOccurs="1" type="tns:TestModule5V2EntityAllSoapAndRest"> + <xsd:annotation> + <xsd:documentation></xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_soapUrl}"> + <inf:callInfo> + <inf:callName>testModule5AllSoapAndRestV2Item</inf:callName> + <inf:returned>Always</inf:returned> + </inf:callInfo> + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> +</xsd:complexType> +RESPONSE_TYPE; + } else { + $responseType = <<< RESPONSE_TYPE <xsd:complexType name="TestModule5AllSoapAndRestV1ItemResponse"> <xsd:annotation> <xsd:documentation> @@ -206,6 +291,7 @@ REQUEST_TYPE; </xsd:sequence> </xsd:complexType> RESPONSE_TYPE; + } // @codingStandardsIgnoreEnd $this->assertContains( $this->_convertXmlToString($responseType), @@ -224,7 +310,40 @@ RESPONSE_TYPE; protected function _checkReferencedTypeDeclaration($wsdlContent) { // @codingStandardsIgnoreStart - $referencedType = <<< RESPONSE_TYPE + if ($this->isSingleService) { + $referencedType = <<< RESPONSE_TYPE +<xsd:complexType name="TestModule5V2EntityAllSoapAndRest"> + <xsd:annotation> + <xsd:documentation></xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_soapUrl}"/> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="price" minOccurs="1" maxOccurs="1" type="xsd:int"> + <xsd:annotation> + <xsd:documentation></xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_soapUrl}"> + <inf:min/> + <inf:max/> + <inf:callInfo> + <inf:callName>testModule5AllSoapAndRestV2Item</inf:callName> + <inf:callName>testModule5AllSoapAndRestV2Create</inf:callName> + <inf:callName>testModule5AllSoapAndRestV2Update</inf:callName> + <inf:callName>testModule5AllSoapAndRestV2Delete</inf:callName> + <inf:returned>Always</inf:returned> + </inf:callInfo> + <inf:callInfo> + <inf:callName>testModule5AllSoapAndRestV2Create</inf:callName> + <inf:callName>testModule5AllSoapAndRestV2Update</inf:callName> + <inf:requiredInput>Yes</inf:requiredInput> + </inf:callInfo> + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> +</xsd:complexType> +RESPONSE_TYPE; + } else { + $referencedType = <<< RESPONSE_TYPE <xsd:complexType name="TestModule5V1EntityAllSoapAndRest"> <xsd:annotation> <xsd:documentation>Some Data Object short description. Data Object long multi line description.</xsd:documentation> @@ -340,6 +459,7 @@ RESPONSE_TYPE; </xsd:sequence> </xsd:complexType> RESPONSE_TYPE; + } // @codingStandardsIgnoreEnd $this->assertContains( $this->_convertXmlToString($referencedType), @@ -355,15 +475,23 @@ RESPONSE_TYPE; */ protected function _checkPortTypeDeclaration($wsdlContent) { - $firstPortType = <<< FIRST_PORT_TYPE + if ($this->isSingleService) { + $firstPortType = <<< FIRST_PORT_TYPE +<portType name="testModule5AllSoapAndRestV2PortType"> +FIRST_PORT_TYPE; + } else { + $firstPortType = <<< FIRST_PORT_TYPE <portType name="testModule5AllSoapAndRestV1PortType"> FIRST_PORT_TYPE; + } $this->assertContains( $this->_convertXmlToString($firstPortType), $wsdlContent, 'Port type declaration is missing or invalid' ); - $secondPortType = <<< SECOND_PORT_TYPE + + if (!$this->isSingleService) { + $secondPortType = <<< SECOND_PORT_TYPE <portType name="testModule5AllSoapAndRestV2PortType"> SECOND_PORT_TYPE; $this->assertContains( @@ -371,7 +499,10 @@ SECOND_PORT_TYPE; $wsdlContent, 'Port type declaration is missing or invalid' ); - $operationDeclaration = <<< OPERATION_DECLARATION + } + + if ($this->isSingleService) { + $operationDeclaration = <<< OPERATION_DECLARATION <operation name="testModule5AllSoapAndRestV2Item"> <input message="tns:testModule5AllSoapAndRestV2ItemRequest"/> <output message="tns:testModule5AllSoapAndRestV2ItemResponse"/> @@ -383,6 +514,20 @@ SECOND_PORT_TYPE; <fault name="GenericFault" message="tns:GenericFault"/> </operation> OPERATION_DECLARATION; + } else { + $operationDeclaration = <<< OPERATION_DECLARATION +<operation name="testModule5AllSoapAndRestV2Item"> + <input message="tns:testModule5AllSoapAndRestV2ItemRequest"/> + <output message="tns:testModule5AllSoapAndRestV2ItemResponse"/> + <fault name="GenericFault" message="tns:GenericFault"/> +</operation> +<operation name="testModule5AllSoapAndRestV2Items"> + <input message="tns:testModule5AllSoapAndRestV2ItemsRequest"/> + <output message="tns:testModule5AllSoapAndRestV2ItemsResponse"/> + <fault name="GenericFault" message="tns:GenericFault"/> +</operation> +OPERATION_DECLARATION; + } $this->assertContains( $this->_convertXmlToString($operationDeclaration), $wsdlContent, @@ -397,25 +542,60 @@ OPERATION_DECLARATION; */ protected function _checkBindingDeclaration($wsdlContent) { - $firstBinding = <<< FIRST_BINDING + if ($this->isSingleService) { + $firstBinding = <<< FIRST_BINDING +<binding name="testModule5AllSoapAndRestV2Binding" type="tns:testModule5AllSoapAndRestV2PortType"> + <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> +FIRST_BINDING; + } else { + $firstBinding = <<< FIRST_BINDING <binding name="testModule5AllSoapAndRestV1Binding" type="tns:testModule5AllSoapAndRestV1PortType"> <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> FIRST_BINDING; + } $this->assertContains( $this->_convertXmlToString($firstBinding), $wsdlContent, 'Binding declaration is missing or invalid' ); - $secondBinding = <<< SECOND_BINDING + + if (!$this->isSingleService) { + $secondBinding = <<< SECOND_BINDING <binding name="testModule5AllSoapAndRestV2Binding" type="tns:testModule5AllSoapAndRestV2PortType"> <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> SECOND_BINDING; - $this->assertContains( - $this->_convertXmlToString($secondBinding), - $wsdlContent, - 'Binding declaration is missing or invalid' - ); - $operationDeclaration = <<< OPERATION_DECLARATION + $this->assertContains( + $this->_convertXmlToString($secondBinding), + $wsdlContent, + 'Binding declaration is missing or invalid' + ); + } + + if ($this->isSingleService) { + $operationDeclaration = <<< OPERATION_DECLARATION +<operation name="testModule5AllSoapAndRestV2Item"> + <soap12:operation soapAction="testModule5AllSoapAndRestV2Item"/> + <input> + <soap12:body use="literal"/> + </input> + <output> + <soap12:body use="literal"/> + </output> + <fault name="GenericFault"/> +</operation> +<operation name="testModule5AllSoapAndRestV2Items"> + <soap12:operation soapAction="testModule5AllSoapAndRestV2Items"/> + <input> + <soap12:body use="literal"/> + </input> + <output> + <soap12:body use="literal"/> + </output> + <fault name="GenericFault"/> +</operation> +OPERATION_DECLARATION; + } else { + $operationDeclaration = <<< OPERATION_DECLARATION <operation name="testModule5AllSoapAndRestV1Item"> <soap12:operation soapAction="testModule5AllSoapAndRestV1Item"/> <input> @@ -437,6 +617,7 @@ SECOND_BINDING; <fault name="GenericFault"/> </operation> OPERATION_DECLARATION; + } $this->assertContains( $this->_convertXmlToString($operationDeclaration), $wsdlContent, @@ -452,13 +633,23 @@ OPERATION_DECLARATION; protected function _checkServiceDeclaration($wsdlContent) { // @codingStandardsIgnoreStart - $firstServiceDeclaration = <<< FIRST_SERVICE_DECLARATION + if ($this->isSingleService) { + $firstServiceDeclaration = <<< FIRST_SERVICE_DECLARATION +<service name="testModule5AllSoapAndRestV2Service"> + <port name="testModule5AllSoapAndRestV2Port" binding="tns:testModule5AllSoapAndRestV2Binding"> + <soap12:address location="{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV2"/> + </port> +</service> +FIRST_SERVICE_DECLARATION; + } else { + $firstServiceDeclaration = <<< FIRST_SERVICE_DECLARATION <service name="testModule5AllSoapAndRestV1Service"> <port name="testModule5AllSoapAndRestV1Port" binding="tns:testModule5AllSoapAndRestV1Binding"> <soap12:address location="{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV1%2CtestModule5AllSoapAndRestV2"/> </port> </service> FIRST_SERVICE_DECLARATION; + } // @codingStandardsIgnoreEnd $this->assertContains( $this->_convertXmlToString($firstServiceDeclaration), @@ -467,19 +658,21 @@ FIRST_SERVICE_DECLARATION; ); // @codingStandardsIgnoreStart - $secondServiceDeclaration = <<< SECOND_SERVICE_DECLARATION + if (!$this->isSingleService) { + $secondServiceDeclaration = <<< SECOND_SERVICE_DECLARATION <service name="testModule5AllSoapAndRestV2Service"> <port name="testModule5AllSoapAndRestV2Port" binding="tns:testModule5AllSoapAndRestV2Binding"> <soap12:address location="{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV1%2CtestModule5AllSoapAndRestV2"/> </port> </service> SECOND_SERVICE_DECLARATION; - // @codingStandardsIgnoreEnd - $this->assertContains( - $this->_convertXmlToString($secondServiceDeclaration), - $wsdlContent, - 'Second service section is invalid' - ); + // @codingStandardsIgnoreEnd + $this->assertContains( + $this->_convertXmlToString($secondServiceDeclaration), + $wsdlContent, + 'Second service section is invalid' + ); + } } /** @@ -654,7 +847,31 @@ PARAM_COMPLEX_TYPE; 'Details parameter complex types declaration is invalid.' ); - $detailsWrappedErrorType = <<< WRAPPED_ERROR_COMPLEX_TYPE + if ($this->isSingleService) { + $detailsWrappedErrorType = <<< WRAPPED_ERROR_COMPLEX_TYPE +<xsd:complexType name="WrappedError"> + <xsd:sequence> + <xsd:element name="message" minOccurs="1" maxOccurs="1" type="xsd:string"> + <xsd:annotation> + <xsd:documentation></xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV2"> + <inf:maxLength/> + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + <xsd:element name="parameters" type="tns:ArrayOfGenericFaultParameter" minOccurs="0"> + <xsd:annotation> + <xsd:documentation>Message parameters.</xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV2"> + <inf:natureOfType>array</inf:natureOfType> + </xsd:appinfo> + </xsd:annotation> + </xsd:element> + </xsd:sequence> +</xsd:complexType> +WRAPPED_ERROR_COMPLEX_TYPE; + } else { + $detailsWrappedErrorType = <<< WRAPPED_ERROR_COMPLEX_TYPE <xsd:complexType name="WrappedError"> <xsd:sequence> <xsd:element name="message" minOccurs="1" maxOccurs="1" type="xsd:string"> @@ -676,6 +893,7 @@ PARAM_COMPLEX_TYPE; </xsd:sequence> </xsd:complexType> WRAPPED_ERROR_COMPLEX_TYPE; + } $this->assertContains( $this->_convertXmlToString($detailsWrappedErrorType), $wsdlContent, @@ -705,7 +923,25 @@ PARAMETERS_COMPLEX_TYPE; 'Details parameters (array of parameters) complex types declaration is invalid.' ); - $detailsWrappedErrorsType = <<< WRAPPED_ERRORS_COMPLEX_TYPE + if ($this->isSingleService) { + $detailsWrappedErrorsType = <<< WRAPPED_ERRORS_COMPLEX_TYPE +<xsd:complexType name="ArrayOfWrappedError"> + <xsd:annotation> + <xsd:documentation>An array of WrappedError items.</xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV2"/> + </xsd:annotation> + <xsd:sequence> + <xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:WrappedError"> + <xsd:annotation> + <xsd:documentation>An item of ArrayOfWrappedError.</xsd:documentation> + <xsd:appinfo xmlns:inf="{$this->_baseUrl}/soap/{$this->_storeCode}?services=testModule5AllSoapAndRestV2"/> + </xsd:annotation> + </xsd:element> + </xsd:sequence> +</xsd:complexType> +WRAPPED_ERRORS_COMPLEX_TYPE; + } else { + $detailsWrappedErrorsType = <<< WRAPPED_ERRORS_COMPLEX_TYPE <xsd:complexType name="ArrayOfWrappedError"> <xsd:annotation> <xsd:documentation>An array of WrappedError items.</xsd:documentation> @@ -721,6 +957,8 @@ PARAMETERS_COMPLEX_TYPE; </xsd:sequence> </xsd:complexType> WRAPPED_ERRORS_COMPLEX_TYPE; + + } // @codingStandardsIgnoreEnd $this->assertContains( $this->_convertXmlToString($detailsWrappedErrorsType), diff --git a/dev/tests/functional/lib/Magento/Mtf/Fixture/DataSource.php b/dev/tests/functional/lib/Magento/Mtf/Fixture/DataSource.php new file mode 100644 index 0000000000000000000000000000000000000000..abd0c0b1627fce7353acf00d1133dcd8d1263dc6 --- /dev/null +++ b/dev/tests/functional/lib/Magento/Mtf/Fixture/DataSource.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Mtf\Fixture; + +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Parent fixture data source class. + */ +class DataSource implements FixtureInterface +{ + /** + * Data set configuration settings. + * + * @var array + */ + protected $params; + + /** + * Value data. + * + * @var array + */ + protected $data; + + /** + * Persist entity. + * + * @return void + */ + public function persist() + { + // + } + + /** + * Return prepared data set. + * + * @param string $key [optional] + * @return mixed + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getData($key = null) + { + return $this->data; + } + + /** + * Return data set configuration settings. + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } +} diff --git a/dev/tests/functional/phpunit.xml.dist b/dev/tests/functional/phpunit.xml.dist index 255d3cf4057d4fdae9965848d64225317e2ba0fc..06b2ee9b0603d8fd6e602011e34ddbf2b131c00f 100755 --- a/dev/tests/functional/phpunit.xml.dist +++ b/dev/tests/functional/phpunit.xml.dist @@ -36,7 +36,7 @@ <env name="testsuite_rule_path" value="Magento/Mtf/TestSuite/InjectableTests" /> <env name="log_directory" value="var/log" /> <env name="events_preset" value="base" /> - <env name="module_whitelist" value="Magento_Install" /> + <env name="module_whitelist" value="Magento_Install,Magento_Core" /> <env name="report_file_name" value="test-cases-report.xml"/> <env name="basedir" value="var/log" /> <env name="credentials_file_path" value="./credentials.xml.dist" /> diff --git a/dev/tests/functional/tests/app/Magento/AdminNotification/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..0e5e1e6e6137a144c8005f43b615be3521147b49 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/AdminNotification/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest1"> + <data name="menuItem" xsi:type="string">System > Notifications</data> + <data name="pageTitle" xsi:type="string">Notifications</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php index 735b24eed10dde13fb1f69e750751b562d87b1fe..bd99359490b6c79dce1bd5f0562cd409f899e22b 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Admin/Login.php @@ -10,24 +10,37 @@ use Magento\Mtf\Block\Form; use Magento\Mtf\Client\Locator; /** - * Class Login - * Login form for backend user - * + * Login form for backend user. */ class Login extends Form { /** - * 'Log in' button + * 'Log in' button. * * @var string */ protected $submit = '.action-login'; /** - * Submit login form + * Submit login form. */ public function submit() { $this->_rootElement->find($this->submit, Locator::SELECTOR_CSS)->click(); } + + /** + * Wait for Login form is not visible in the page. + * + * @return void + */ + public function waitFormNotVisible() + { + $form = $this->_rootElement; + $this->browser->waitUntil( + function () use ($form) { + return $form->isVisible() ? null : true; + } + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php index c1a645760bb36b1d9a192d9d31715b7f199dfde1..1d683f1ef9034e74cf2a979ee795bce1186b2232 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Menu.php @@ -6,15 +6,43 @@ namespace Magento\Backend\Test\Block; use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\Locator; /** - * Class Menu - * Class top menu navigation block + * Top menu navigation block. */ class Menu extends Block { /** - * Returns array of parent menu items present on dashboard menu + * Main menu selector. + * + * @var string + */ + protected $mainMenu = './/li/a[span="%s"]'; + + /** + * Submenu selector. + * + * @var string + */ + protected $subMenu = './/li[a[span="%s"]]/div[@class="submenu" and @style="display: block;"]'; + + /** + * Submenu item selector. + * + * @var string + */ + protected $subMenuItem = './/a[span="%s"]'; + + /** + * Parent menu item. + * + * @var string + */ + protected $parentMenuLevel = 'li.parent.level-0:nth-of-type(%s)'; + + /** + * Returns array of parent menu items present on dashboard menu. * * @return array */ @@ -24,9 +52,9 @@ class Menu extends Block $menuItems = []; $counter = 1; $textSelector = 'a span'; - while ($navigationMenu->find('li.parent.level-0:nth-of-type(' . $counter . ')')->isVisible()) { + while ($navigationMenu->find(sprintf($this->parentMenuLevel, $counter))->isVisible()) { $menuItems[] = strtolower( - $navigationMenu->find('li.parent.level-0:nth-of-type(' . $counter . ')') + $navigationMenu->find(sprintf($this->parentMenuLevel, $counter)) ->find($textSelector) ->getText() ); @@ -34,4 +62,39 @@ class Menu extends Block } return $menuItems; } + + /** + * Open backend page via menu. + * + * @param string $menuItem + * @return void + * @throws \Exception + */ + public function navigate($menuItem) + { + $menuChain = array_map('trim', explode('>', $menuItem)); + $mainMenu = $menuChain[0]; + $subMenu = isset($menuChain[1]) ? $menuChain[1] : null; + + // Click on element in main menu + $mainMenuElement = $this->_rootElement->find(sprintf($this->mainMenu, $mainMenu), Locator::SELECTOR_XPATH); + if (!$mainMenuElement->isVisible()) { + throw new \Exception('Main menu item "' . $mainMenu . '" is not visible.'); + } + $mainMenuElement->click(); + + // Click on element in submenu + if ($subMenu === null) { + return; + } + $subMenuSelector = sprintf($this->subMenu, $mainMenu); + $this->waitForElementVisible($subMenuSelector, Locator::SELECTOR_XPATH); + $subMenuItem = $this->_rootElement->find($subMenuSelector, Locator::SELECTOR_XPATH) + ->find(sprintf($this->subMenuItem, $subMenu), Locator::SELECTOR_XPATH); + if (!$subMenuItem->isVisible()) { + throw new \Exception('Submenu item "' . $subMenu . '" is not visible in "' . $mainMenu . '"'); + } + $subMenuItem->click(); + $this->waitForElementNotVisible($subMenuSelector, Locator::SELECTOR_XPATH); + } } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Error.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Error.php new file mode 100644 index 0000000000000000000000000000000000000000..b74ea513d578e1a1b9eb73d574c40e91c2eed809 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Error.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Backend\Test\Block\Page; + +use Magento\Mtf\Block\Block; + +/** + * 404 error backend block. + */ +class Error extends Block +{ + /** + * Get block text content. + * + * @return string + */ + public function getContent() + { + return $this->_rootElement->getText(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php index 9de2cdc43498326ae52a79eb41ebbf373ec6b4f6..3971b6e5d5b969cf768cbb0e57106a7a6ad6b655 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Page/Main.php @@ -9,7 +9,7 @@ namespace Magento\Backend\Test\Block\Page; use Magento\Mtf\Block\Block; /** - * Main block. + * Main dashboard block. */ class Main extends Block { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php index 6c3e11540c9dd82222f27e97d6a938bfb39ed05a..c8d22ae1aae76d807cfee729e2914da97e8eeaca 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Grid.php @@ -46,7 +46,7 @@ abstract class Grid extends Block * * @var string */ - protected $resetButton = '[title="Reset Filter"][class*=action]'; + protected $resetButton = '.action-reset'; /** * The first row in grid. For this moment we suggest that we should strictly define what we are going to search diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php new file mode 100644 index 0000000000000000000000000000000000000000..0a72723984994fe451b21974be51d94844873136 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Backend\Test\Constraint; + +use Magento\Backend\Test\Fixture\GlobalSearch; +use Magento\Backend\Test\Page\Adminhtml\Dashboard; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert backend page title and it's availability. + */ +class AssertBackendPageIsAvailable extends AbstractConstraint +{ + const ERROR_TEXT = '404 Error'; + + /** + * Assert that backend page has correct title and 404 Error is absent on the page. + * + * @param Dashboard $dashboard + * @param string $pageTitle + * @return void + */ + public function processAssert(Dashboard $dashboard, $pageTitle) + { + \PHPUnit_Framework_Assert::assertEquals( + $pageTitle, + $dashboard->getTitleBlock()->getTitle(), + 'Invalid page title is displayed.' + ); + \PHPUnit_Framework_Assert::assertNotContains( + self::ERROR_TEXT, + $dashboard->getErrorBlock()->getContent(), + "404 Error is displayed on '$pageTitle' page." + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Backend has correct title and 404 page content is absent.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php new file mode 100644 index 0000000000000000000000000000000000000000..754278899b0b42a8e7b1ba59858910351031a8b0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertStoreCanBeLocalized.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Backend\Test\Constraint; + +use Magento\Store\Test\Fixture\Store; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\SystemConfig; +use Magento\Cms\Test\Page\CmsIndex; + +/** + * Assert that store can be localized. + */ +class AssertStoreCanBeLocalized extends AbstractConstraint +{ + /** + * Assert that locale options can be changed and checks new text on index page. + * + * @param SystemConfig $systemConfig + * @param Store $store + * @param CmsIndex $cmsIndex + * @param string $locale + * @param string $welcomeText + * @return void + */ + public function processAssert(SystemConfig $systemConfig, Store $store, CmsIndex $cmsIndex, $locale, $welcomeText) + { + // Set locale options + $systemConfig->open(); + $systemConfig->getPageActions()->selectStore($store->getGroupId() . "/" . $store->getName()); + $configGroup = $systemConfig->getForm()->getGroup('Locale Options'); + $configGroup->open(); + $configGroup->setValue('select-groups-locale-fields-code-value', $locale); + $systemConfig->getPageActions()->save(); + $systemConfig->getMessagesBlock()->waitSuccessMessage(); + + // Check presents income text on index page + $cmsIndex->open(); + $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store->getName()); + + \PHPUnit_Framework_Assert::assertTrue( + $cmsIndex->getSearchBlock()->isPlaceholderContains($welcomeText), + "Locale not applied." + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Store locale has changed successfully.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php index c53ef25e6dc0a4a7dc930ed96849953f74d038a5..02f5655d35fa05611ada2a097718106a14bda254 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php @@ -10,40 +10,39 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * Class AdminAuthLogin - * Login page for backend + * Login page for backend. * */ class AdminAuthLogin extends Page { /** - * URL part for backend authorization + * URL part for backend authorization. */ const MCA = 'admin/auth/login'; /** - * Form for login + * Form for login. * * @var string */ protected $loginBlock = '#login-form'; /** - * Header panel of admin dashboard + * Header panel of admin dashboard. * * @var string */ protected $headerBlock = '.page-header .admin-user'; /** - * Global messages block + * Global messages block. * * @var string */ protected $messagesBlock = '#messages .messages'; /** - * Constructor + * Constructor. */ protected function _init() { @@ -51,7 +50,7 @@ class AdminAuthLogin extends Page } /** - * Get the login form block + * Get the login form block. * * @return \Magento\Backend\Test\Block\Admin\Login */ @@ -63,7 +62,7 @@ class AdminAuthLogin extends Page } /** - * Get the header panel block of admin dashboard + * Get the header panel block of admin dashboard. * * @return \Magento\Backend\Test\Block\Page\Header */ @@ -75,7 +74,7 @@ class AdminAuthLogin extends Page } /** - * Get global messages block + * Get global messages block. * * @return \Magento\Core\Test\Block\Messages */ @@ -84,6 +83,11 @@ class AdminAuthLogin extends Page return Factory::getBlockFactory()->getMagentoCoreMessages($this->_browser->find($this->messagesBlock)); } + /** + * Wait for Header block is visible in the page. + * + * @return void + */ public function waitForHeaderBlock() { $browser = $this->_browser; diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml index 77f4285338fc45ff1aebb9247c3156e9523b2688..b7f64e34db13d794af6e7c689ccb905178cf1741 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/Dashboard.xml @@ -6,11 +6,13 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="Dashboard" area="Adminhtml" mca="admin/dashboard" module="Magento_Backend"> - <block name="adminPanelHeader" class="Magento\Backend\Test\Block\Page\Header" locator=".page-header" strategy="css selector"/> - <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector"/> - <block name="mainBlock" class="Magento\Backend\Test\Block\Page\Main" locator=".dashboard-main" strategy="css selector"/> - <block name="menuBlock" class="Magento\Backend\Test\Block\Menu" locator=".admin__menu" strategy="css selector"/> - <block name="storeStatsBlock" class="Magento\Backend\Test\Block\Dashboard\StoreStats" locator=".dashboard-store-stats" strategy="css selector"/> - </page> + <page name="Dashboard" area="Adminhtml" mca="admin/dashboard" module="Magento_Backend"> + <block name="adminPanelHeader" class="Magento\Backend\Test\Block\Page\Header" locator=".page-header" strategy="css selector" /> + <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector" /> + <block name="mainBlock" class="Magento\Backend\Test\Block\Page\Main" locator=".dashboard-main" strategy="css selector" /> + <block name="menuBlock" class="Magento\Backend\Test\Block\Menu" locator=".admin__menu" strategy="css selector" /> + <block name="storeStatsBlock" class="Magento\Backend\Test\Block\Dashboard\StoreStats" locator=".dashboard-store-stats" strategy="css selector" /> + <block name="errorBlock" class="Magento\Backend\Test\Block\Page\Error" locator="[id='page:main-container']" strategy="css selector" /> + <block name="accessDeniedBlock" class="Magento\Backend\Test\Block\Denied" locator="#anchor-content" strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml index 6f486d22e4276c990f69c55abc142ebc34f39da8..be9dea93665872a526fa05dc2f139f4a29e75c84 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/SystemConfig.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="SystemConfig" area="Adminhtml" mca="admin/system_config" module="Magento_Config"> + <page name="SystemConfig" area="Adminhtml" mca="admin/system_config" module="Magento_Backend"> <block name="pageActions" class="Magento\Backend\Test\Block\System\Config\PageActions" locator=".page-main-actions" strategy="css selector"/> <block name="form" class="Magento\Backend\Test\Block\System\Config\Form" locator="#config-edit-form" strategy="css selector"/> <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5ddeae663986fb131b8da386365384173c9dc35a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Backend\Test\TestCase; + +use Magento\Mtf\TestCase\Injectable; +use Magento\Backend\Test\Page\Adminhtml\Dashboard; + +/** + * Steps: + * 1. Log in to backend. + * 2. Navigate throught menu to the page. + * 6. Perform asserts. + * + * @ZephyrId MAGETWO-34874 + */ +class NavigateMenuTest extends Injectable +{ + /* tags */ + const MVP = 'no'; + const DOMAIN = 'CS, MX, PS'; + /* end tags */ + + /** + * Run menu navigation test. + * + * @param Dashboard $dashboard + * @param string $menuItem + * @return void + */ + public function test(Dashboard $dashboard, $menuItem) + { + $dashboard->open(); + $dashboard->getMenuBlock()->navigate($menuItem); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2cc5603938057e0d3b7d7bd8363b1ccf16d7fa0c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest2"> + <data name="menuItem" xsi:type="string">Dashboard</data> + <data name="pageTitle" xsi:type="string">Dashboard</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest3"> + <data name="menuItem" xsi:type="string">Content > Schedule</data> + <data name="pageTitle" xsi:type="string">Store Design Schedule</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest4"> + <data name="menuItem" xsi:type="string">Stores > All Stores</data> + <data name="pageTitle" xsi:type="string">Stores</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest5"> + <data name="menuItem" xsi:type="string">Stores > Configuration</data> + <data name="pageTitle" xsi:type="string">Configuration</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest6"> + <data name="menuItem" xsi:type="string">System > Cache Management</data> + <data name="pageTitle" xsi:type="string">Cache Management</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba16bc1f7220b03ccf0a2efacf445d9ff9dab6bc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <type name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Backend\Test\Constraint\AssertStoreCanBeLocalized"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Backup/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Backup/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9ac9e52ca3db010cebacea976aba3530ff9e05c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backup/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest7"> + <data name="menuItem" xsi:type="string">System > Backups</data> + <data name="pageTitle" xsi:type="string">Backups</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php index d457d3fae63ea11ac4c9d94a544f5a39c9918455..0423a2e4a409107c6569bc3ec1fd8767049f0ba3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php @@ -64,6 +64,14 @@ class AttributeForm extends FormTabs $this->browser->switchToFrame(new Locator($this->iFrame)); } + /** + * @destructor + */ + public function __destruct() + { + $this->browser->switchToFrame(); + } + /** * Fill the attribute form. * @@ -112,6 +120,5 @@ class AttributeForm extends FormTabs public function saveAttributeForm() { $this->browser->find($this->saveButton)->click(); - $this->browser->selectWindow(); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php index b1091273427d381a749fb588bb47b4dd7883cac8..8a6c5bc78830d8fd334ba89304cb078305b736f3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php @@ -11,27 +11,26 @@ use Magento\Mtf\Client\Element\SimpleElement; use Magento\Mtf\Client\Element; /** - * Class AdvancedPropertiesTab - * Tab "Advanced Attribute Properties" + * Tab "Advanced Attribute Properties". */ class Advanced extends Tab { /** - * "Advanced Attribute Properties" tab-button + * "Advanced Attribute Properties" tab-button. * * @var string */ protected $propertiesTab = '[data-target="#advanced_fieldset-content"][data-toggle="collapse"]'; /** - * "Advanced Attribute Properties" tab-button active + * "Advanced Attribute Properties" content. * * @var string */ - protected $propertiesTabActive = '.title.active'; + protected $propertiesTabContent = '#advanced_fieldset-content'; /** - * Fill 'Advanced Attribute Properties' tab + * Fill 'Advanced Attribute Properties' tab. * * @param array $fields * @param SimpleElement|null $element @@ -39,10 +38,10 @@ class Advanced extends Tab */ public function fillFormTab(array $fields, SimpleElement $element = null) { - if (!$this->_rootElement->find($this->propertiesTabActive)->isVisible()) { + if (!$this->_rootElement->find($this->propertiesTabContent)->isVisible()) { $this->_rootElement->find($this->propertiesTab)->click(); } - return parent::fillFormTab($fields); + return parent::fillFormTab($fields, $element); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php index 68a4971aba92afce46910ac1a89c9d952cbbac2a..699bc721e7d1ea84b21ebb145d548ad0e8eee2aa 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php @@ -113,11 +113,6 @@ class ProductForm extends FormTabs } else { $tabs = $this->getFieldsByTabs($product); - //TODO: Remove after old product fixture will be deleted - if (null === $category && $product instanceof DataFixture) { - $categories = $product->getCategories(); - $category = reset($categories); - } if ($category) { $tabs['product-details']['category_ids']['value'] = $category->getName(); } @@ -147,7 +142,7 @@ class ProductForm extends FormTabs /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\ProductDetails $tab */ $tab = $this->openTab($tabName); $tab->addNewAttribute($tabName); - $this->fillAttributeForm($attribute); + $this->getAttributeForm()->fill($attribute); } } @@ -286,18 +281,6 @@ class ProductForm extends FormTabs return $data; } - /** - * Fill product attribute form. - * - * @param CatalogProductAttribute $productAttribute - * @return void - */ - public function fillAttributeForm(CatalogProductAttribute $productAttribute) - { - $attributeForm = $this->getAttributeForm(); - $attributeForm->fill($productAttribute); - } - /** * Click "Save" button on attribute form. * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php index b8c85e290dd14f129545de8f05f50bd98352f79d..9c9e9dd1f19e92723750b360081d474888baa44a 100755 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php @@ -11,34 +11,33 @@ use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; /** - * Class View - * Category view block on the category page + * Category view block on the category page. */ class View extends Block { /** - * Recently Viewed Products selectors + * Recently Viewed Products selectors. * * @var string */ protected $recentlyViewedProducts = './/*[contains(@class,"widget")]//strong[@class="product-item-name"]'; /** - * Description CSS selector + * Description CSS selector. * * @var string */ protected $description = '.category-description'; /** - * Locator for category content + * Locator for category content. * * @var string */ protected $content = '.category-cms'; /** - * Get description + * Get description. * * @return string */ @@ -48,17 +47,18 @@ class View extends Block } /** - * Get Category Content + * Get Category Content. * * @return string */ public function getContent() { - return $this->_rootElement->find($this->content)->getText(); + $categoryContent = $this->_rootElement->find($this->content); + return $categoryContent->isVisible() ? $categoryContent->getText() : ''; } /** - * Get products from Recently Viewed block + * Get products from Recently Viewed block. * * @return array */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php index 34b3fc49ec2a02ab967e466728256fcb1213fdb8..dd2265411c098a6e4998c25ffde26a82e069e61e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Search.php @@ -20,7 +20,7 @@ class Search extends Block * * @var string */ - protected $searchAutocomplete = './/div[@id="search_autocomplete"]//li[span[text()="%s"]]'; + protected $searchAutocomplete = './/div[@id="search_autocomplete"]//li[span[text()[normalize-space()="%s"]]]'; /** * Selector number of matches for a given row diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml index 636a0e12ebdacc88ee55e08997c68943fc8c6bc6..663a249b5da66e367bd8b0a953e622653aaa065e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml @@ -78,7 +78,7 @@ <field name="include_in_menu" group="general_information"> <default_value xsi:type="string">Yes</default_value> </field> - <field name="landing_page" group="display_setting" source="\Magento\Catalog\Test\Fixture\Category\LandingPage"/> + <field name="landing_page" group="display_setting" source="Magento\Catalog\Test\Fixture\Category\LandingPage"/> <field name="display_mode" group="display_setting"/> <field name="category_products" group="category_products" source="Magento\Catalog\Test\Fixture\Category\CategoryProducts"/> </fixture> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php index add0a7c40e1bcae69191eeeab91173c2d8e497f2..22ac44c8c5e55700a322e6a1359a6dc4dcb241b7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/LandingPage.php @@ -45,6 +45,7 @@ class LandingPage implements FixtureInterface public function __construct(FixtureFactory $fixtureFactory, array $params, $data = []) { $this->params = $params; + $this->data = $data; if (isset($data['preset'])) { /** @var CmsBlock $cmsBlock */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php index 66ae5c3e9048d4043b850092dcbde3ed7120562d..9770e6726048c6139631ba6022d8801484e1c108 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/Category/Curl.php @@ -14,13 +14,12 @@ use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Create new category via curl + * Create new category via curl. */ class Curl extends AbstractCurl implements CategoryInterface { /** - * Data use config for category + * Data use config for category. * * @var array */ @@ -56,25 +55,16 @@ class Curl extends AbstractCurl implements CategoryInterface ]; /** - * Post request for creating Subcategory + * Post request for creating Subcategory. * * @param FixtureInterface|null $fixture [optional] * @return array */ public function persist(FixtureInterface $fixture = null) { - $data['general'] = $this->replaceMappingData($fixture->getData()); - if ($fixture->hasData('landing_page')) { - $data['general']['landing_page'] = $this->getBlockId($fixture->getLandingPage()); - } + $data = $this->prepareData($fixture); - $diff = array_diff($this->dataUseConfig, array_keys($data['general'])); - if (!empty($diff)) { - $data['use_config'] = $diff; - } - $parentCategoryId = $data['general']['parent_id']; - - $url = $_ENV['app_backend_url'] . 'catalog/category/save/store/0/parent/' . $parentCategoryId . '/'; + $url = $_ENV['app_backend_url'] . 'catalog/category/save/store/0/parent/' . $data['general']['parent_id'] . '/'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); @@ -87,12 +77,34 @@ class Curl extends AbstractCurl implements CategoryInterface } /** - * Getting block id by name + * Prepare category data for curl. + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareData(FixtureInterface $fixture) + { + $data['general'] = $this->replaceMappingData($fixture->getData()); + $data['is_anchor'] = isset($data['is_anchor']) ? $data['is_anchor'] : 0; + if ($fixture->hasData('landing_page')) { + $data['general']['landing_page'] = $this->getBlockId($fixture->getLandingPage()); + } + + $diff = array_diff($this->dataUseConfig, array_keys($data['general'])); + if (!empty($diff)) { + $data['use_config'] = $diff; + } + + return $data; + } + + /** + * Getting block id by name. * * @param string $landingName * @return int|null */ - public function getBlockId($landingName) + protected function getBlockId($landingName) { $url = $_ENV['app_backend_url'] . 'catalog/category'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml index 5872271e30c50db4a9f20d1051ae479ed9574afe..df6bf92efaf4d81667d63552871f5b21a4611a72 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Adminhtml/CatalogProductIndex.xml @@ -6,10 +6,9 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CatalogProductIndex" area="Adminhtml" mca="catalog/product/index" module="Magento_Catalog"> - <block name="productGrid" class="Magento\Catalog\Test\Block\Adminhtml\Product\Grid" locator="#productGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> - <block name="gridPageActionBlock" class="Magento\Catalog\Test\Block\Adminhtml\Product\GridPageAction" locator="#add_new_product" strategy="css selector"/> - <block name="accessDeniedBlock" class="Magento\Backend\Test\Block\Denied" locator="[id='page:main-container']" strategy="css selector"/> - </page> + <page name="CatalogProductIndex" area="Adminhtml" mca="catalog/product/index" module="Magento_Catalog"> + <block name="productGrid" class="Magento\Catalog\Test\Block\Adminhtml\Product\Grid" locator="#productGrid" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + <block name="gridPageActionBlock" class="Magento\Catalog\Test\Block\Adminhtml\Product\GridPageAction" locator="#add_new_product" strategy="css selector"/> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index b7060994fbd5073da14ad9663b246769eea86f48..4998c9d9604744c84511a07a10c321a6cc29bd02 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -277,7 +277,7 @@ </field> <field name="weight" xsi:type="string">100</field> <field name="website_ids" xsi:type="array"> - <item name="0" xsi:type="string">Main W"e</item> + <item name="0" xsi:type="string">Main Website</item> </field> <field name="url_key" xsi:type="string">simple-product-%isolation%</field> <field name="category_ids" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml index 395dc632a4049d8006c6e3432fbe19e39335ca1c..590204f0d4d3b5ba1a99653f4642524428cbb5b7 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml @@ -18,7 +18,6 @@ <data name="category/data/meta_title" xsi:type="string">-</data> <data name="category/data/include_in_menu" xsi:type="string">-</data> <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">-</data> <data name="category/data/available_product_listing_config" xsi:type="string">No</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> @@ -44,7 +43,6 @@ <data name="category/data/meta_title" xsi:type="string">RootCategory Page Title</data> <data name="category/data/include_in_menu" xsi:type="string">Yes</data> <data name="category/data/display_mode" xsi:type="string">Static block and products</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">Yes</data> <data name="category/data/available_product_listing_config" xsi:type="string">No</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> @@ -70,7 +68,6 @@ <data name="category/data/meta_title" xsi:type="string">-</data> <data name="category/data/include_in_menu" xsi:type="string">-</data> <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">-</data> <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> @@ -97,7 +94,6 @@ <data name="category/data/meta_title" xsi:type="string">-</data> <data name="category/data/include_in_menu" xsi:type="string">Yes</data> <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">No</data> <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> @@ -125,7 +121,7 @@ <data name="category/data/meta_title" xsi:type="string">Subcategory Page Title</data> <data name="category/data/include_in_menu" xsi:type="string">Yes</data> <data name="category/data/display_mode" xsi:type="string">Static block and products</data> - <data name="category/data/landing_page" xsi:type="string">default</data> + <data name="category/data/landing_page/preset" xsi:type="string">default</data> <data name="category/data/is_anchor" xsi:type="string">Yes</data> <data name="category/data/available_product_listing_config" xsi:type="string">No</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">Position</data> @@ -153,7 +149,6 @@ <data name="category/data/meta_title" xsi:type="string">-</data> <data name="category/data/include_in_menu" xsi:type="string">Yes</data> <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">-</data> <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> @@ -179,7 +174,6 @@ <data name="category/data/meta_title" xsi:type="string">-</data> <data name="category/data/include_in_menu" xsi:type="string">No</data> <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">-</data> <data name="category/data/available_product_listing_config" xsi:type="string">-</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> @@ -205,7 +199,6 @@ <data name="category/data/meta_title" xsi:type="string">-</data> <data name="category/data/include_in_menu" xsi:type="string">Yes</data> <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">-</data> <data name="category/data/available_product_listing_config" xsi:type="string">-</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> @@ -233,7 +226,6 @@ <data name="category/data/meta_title" xsi:type="string">-</data> <data name="category/data/include_in_menu" xsi:type="string">Yes</data> <data name="category/data/display_mode" xsi:type="string">-</data> - <data name="category/data/landing_page" xsi:type="string">-</data> <data name="category/data/is_anchor" xsi:type="string">-</data> <data name="category/data/available_product_listing_config" xsi:type="string">-</data> <data name="category/data/available_sort_by/sort_0" xsi:type="string">-</data> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..a42733b3587f1f71c694a7dd569a96a387d5b0e5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest9"> + <data name="menuItem" xsi:type="string">Products > Catalog</data> + <data name="pageTitle" xsi:type="string">Inventory</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest10"> + <data name="menuItem" xsi:type="string">Products > Categories</data> + <data name="pageTitle" xsi:type="string">Categories</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest11"> + <data name="menuItem" xsi:type="string">Stores > Product</data> + <data name="pageTitle" xsi:type="string">Product Attributes</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest12"> + <data name="menuItem" xsi:type="string">Stores > Product Template</data> + <data name="pageTitle" xsi:type="string">Product Templates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml index dcbe8113bdd361d397c7a9f820fd3c28584564ba..364854e6870bbf6a8b9aa15989b7ccececcb7cbc 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml @@ -6,856 +6,457 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\Product\CreateSimpleProductEntityTest"> - <variation name="CreateSimpleProductEntityTestVariation1" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with custom options(fixed price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10000</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">50</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">657</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with custom options(percent price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10001</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">51</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">658</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with special price and custom options(fixed price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10002</data> - <data name="product/data/special_price" xsi:type="string">90</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">52</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">659</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23029</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with special price and custom options(percent price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10003</data> - <data name="product/data/special_price" xsi:type="string">90</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">53</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">660</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with group price and custom options(percent price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10004</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">54</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">661</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with group price and custom options(fixed price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10005</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">55</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">662</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23029</data> - <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation7" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with tier price and custom options(percent price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10006</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">56</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">663</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation8" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with tier price and custom options(fixed price)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10007</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">57</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">664</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">MAGETWO-23029</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation9" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product without custom options</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10008</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">58</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">665</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation10" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product that is in stock</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10009</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">59</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation11" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product that is out stock</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10010</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">60</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">0</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation12" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product that visible only in search</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10011</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">61</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">138</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">Search</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation13" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create simple product and check search by sku</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10012</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">62</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">139</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInStock" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" next="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation14" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create simple product and check visibility in category</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10013</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">63</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">140</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInStock" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" next="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation15" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with tax class and group price</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/price/value" xsi:type="string">10014</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">64</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">141</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">default</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInStock" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" next="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation16" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with tax class and check absent special price</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/price/value" xsi:type="string">10015</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">65</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">142</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInStock" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" next="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation17" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product without tax class and tier price</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> - <data name="product/data/price/value" xsi:type="string">10016</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">66</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">143</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">default</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInStock" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" next="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation18" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product wit suite of custom options</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10017</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">67</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">144</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">options-suite</data> - <data name="product/data/checkout_data/preset" xsi:type="string">options-suite</data> - <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInStock" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" next="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation19" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with cross-sell products</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10018</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">59</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">catalogProductSimple::default, configurableProduct::default</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductCrossSells" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCrossSells" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation20" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with up-sell products</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10019</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">59</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">catalogProductSimple::default, configurableProduct::default</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductUpSells" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductUpSells" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation21" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with related products</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10020</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> - <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">59</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">catalogProductSimple::default, configurableProduct::default</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductForm" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" next="Magento\Catalog\Test\Constraint\AssertProductRelatedProducts" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductRelatedProducts" prev="Magento\Catalog\Test\Constraint\AssertProductForm"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation22" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12423: Can't Add Out of Stock Products to Shopping Cart</data> - <data name="configData" xsi:type="string">display_out_of_stock</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10021</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">68</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">0</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertAddToCartButtonAbsent"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddToCartButtonAbsent" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation23" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-13345: Create Simple Product with Creating New Category (Required Fields Only)</data> - <data name="product/data/category_ids/new_category" xsi:type="string">yes</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/url_key" xsi:type="string">simple%isolation%</data> - <data name="product/data/name" xsi:type="string">simple%isolation%</data> - <data name="product/data/sku" xsi:type="string">simple%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation24" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12514: Create Simple Product and Assigning It to Category</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">1</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">1000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation25" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12703: Create Simple Product with Custom Options and Assign it to the Category</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">1</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">1000</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/qty" xsi:type="string">-</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\Catalog\Test\Constraint\AssertProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" next="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="CreateSimpleProductEntityTestVariation26" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12914: Create Simple Product with Advanced Inventory and Assign It to the Category</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> - <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> - <data name="product/data/tax_class_id/dataSet" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> - <data name="product/data/stock_data/qty" xsi:type="string">1</data> - <data name="product/data/visibility" xsi:type="string">-</data> - <data name="product/data/custom_options/preset" xsi:type="string">-</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/custom_options/import_products" xsi:type="string">-</data> - <data name="product/data/price/preset" xsi:type="string">-</data> - <data name="product/data/group_price/preset" xsi:type="string">-</data> - <data name="product/data/tier_price/preset" xsi:type="string">-</data> - <data name="product/data/cross_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/up_sell_products/presets" xsi:type="string">-</data> - <data name="product/data/related_products/presets" xsi:type="string">-</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\Product\CreateSimpleProductEntityTest"> + <variation name="CreateSimpleProductEntityTestVariation1"> + <data name="description" xsi:type="string">Create product with custom options(fixed price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10000</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">50</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">657</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/price/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation2"> + <data name="description" xsi:type="string">Create product with custom options(percent price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10001</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">51</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">658</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/price/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation3"> + <data name="description" xsi:type="string">Create product with special price and custom options(fixed price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10002</data> + <data name="product/data/special_price" xsi:type="string">90</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">52</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">659</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23029</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation4"> + <data name="description" xsi:type="string">Create product with special price and custom options(percent price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10003</data> + <data name="product/data/special_price" xsi:type="string">90</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">53</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">660</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation5"> + <data name="description" xsi:type="string">Create product with group price and custom options(percent price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10004</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">54</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">661</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation6"> + <data name="description" xsi:type="string">Create product with group price and custom options(fixed price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10005</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">55</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">662</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23029</data> + <data name="product/data/group_price/preset" xsi:type="string">MAGETWO-23055</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation7"> + <data name="description" xsi:type="string">Create product with tier price and custom options(percent price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10006</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">56</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">663</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_percent_price</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23030</data> + <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation8"> + <data name="description" xsi:type="string">Create product with tier price and custom options(fixed price)</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10007</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">57</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">664</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/checkout_data/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="product/data/price/preset" xsi:type="string">MAGETWO-23029</data> + <data name="product/data/tier_price/preset" xsi:type="string">MAGETWO-23002</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCart" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation9"> + <data name="description" xsi:type="string">Create product without custom options</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10008</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">58</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">665</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation10"> + <data name="description" xsi:type="string">Create product that is in stock</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10009</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">59</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation11"> + <data name="description" xsi:type="string">Create product that is out stock</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10010</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">60</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">0</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation12"> + <data name="description" xsi:type="string">Create product that visible only in search</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10011</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">61</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">138</data> + <data name="product/data/visibility" xsi:type="string">Search</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation13"> + <data name="description" xsi:type="string">Create simple product and check search by sku</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10012</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">62</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">139</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation14"> + <data name="description" xsi:type="string">Create simple product and check visibility in category</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10013</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">63</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">140</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation15"> + <data name="description" xsi:type="string">Create product with tax class and group price</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/price/value" xsi:type="string">10014</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">64</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">141</data> + <data name="product/data/group_price/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation16"> + <data name="description" xsi:type="string">Create product with tax class and check absent special price</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/price/value" xsi:type="string">10015</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">65</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">142</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation17"> + <data name="description" xsi:type="string">Create product without tax class and tier price</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">None</data> + <data name="product/data/price/value" xsi:type="string">10016</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">66</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">143</data> + <data name="product/data/tier_price/preset" xsi:type="string">default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation18"> + <data name="description" xsi:type="string">Create product wit suite of custom options</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10017</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">67</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">144</data> + <data name="product/data/custom_options/preset" xsi:type="string">options-suite</data> + <data name="product/data/checkout_data/preset" xsi:type="string">options-suite</data> + <data name="product/data/custom_options/import_products" xsi:type="string">catalogProductSimple::with_two_custom_option,catalogProductSimple::with_all_custom_option</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation19"> + <data name="description" xsi:type="string">Create product with cross-sell products</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10018</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">59</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/cross_sell_products/presets" xsi:type="string">catalogProductSimple::default, configurableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCrossSells" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation20"> + <data name="description" xsi:type="string">Create product with up-sell products</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10019</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">59</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/up_sell_products/presets" xsi:type="string">catalogProductSimple::default, configurableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductUpSells" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation21"> + <data name="description" xsi:type="string">Create product with related products</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10020</data> + <data name="product/data/short_description" xsi:type="string">Simple Product short_description %isolation%</data> + <data name="product/data/description" xsi:type="string">Simple Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">59</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">75</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/related_products/presets" xsi:type="string">catalogProductSimple::default, configurableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductRelatedProducts" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation22"> + <data name="description" xsi:type="string">MAGETWO-12423: Can't Add Out of Stock Products to Shopping Cart</data> + <data name="configData" xsi:type="string">display_out_of_stock</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10021</data> + <data name="product/data/weight" xsi:type="string">68</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">0</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddToCartButtonAbsent" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation23"> + <data name="description" xsi:type="string">MAGETWO-13345: Create Simple Product with Creating New Category (Required Fields Only)</data> + <data name="product/data/category_ids/new_category" xsi:type="string">yes</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/url_key" xsi:type="string">simple%isolation%</data> + <data name="product/data/name" xsi:type="string">simple%isolation%</data> + <data name="product/data/sku" xsi:type="string">simple%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation24"> + <data name="description" xsi:type="string">MAGETWO-12514: Create Simple Product and Assigning It to Category</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/weight" xsi:type="string">1</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">1000</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation25"> + <data name="description" xsi:type="string">MAGETWO-12703: Create Simple Product with Custom Options and Assign it to the Category</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/tax_class_id/dataSet" xsi:type="string">taxable_goods</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/weight" xsi:type="string">1</data> + <data name="product/data/quantity_and_stock_status/qty" xsi:type="string">1000</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/custom_options/preset" xsi:type="string">drop_down_with_one_option_fixed_price</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> + </variation> + <variation name="CreateSimpleProductEntityTestVariation26"> + <data name="description" xsi:type="string">MAGETWO-12914: Create Simple Product with Advanced Inventory and Assign It to the Category</data> + <data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data> + <data name="product/data/name" xsi:type="string">Simple Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/stock_data/manage_stock" xsi:type="string">Yes</data> + <data name="product/data/stock_data/qty" xsi:type="string">1</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d9e73e456e61868ca16699ab0d4f2d15de01c324 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Test\TestCase\Product; + +use Magento\Catalog\Test\Fixture\Category; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Precondition: + * 1. Product is created. + * + * Steps: + * 1. Login to backend. + * 2. Navigate to PRODUCTS > Catalog. + * 3. Click Product from grid. + * 4. Click "Save & Duplicate". + * 5. Perform asserts. + * + * @group Products_(MX) + * @ZephyrId MAGETWO-23294 + */ +class DuplicateProductEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'MX'; + /* end tags */ + + /** + * Category fixture. + * + * @var Category + */ + protected $category; + + /** + * Product page with a grid. + * + * @var CatalogProductIndex + */ + protected $productGrid; + + /** + * Page to update a product. + * + * @var CatalogProductEdit + */ + protected $editProductPage; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Prepare data. + * + * @param Category $category + * @param CatalogProductIndex $productGrid + * @param CatalogProductEdit $editProductPage + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __prepare( + Category $category, + CatalogProductIndex $productGrid, + CatalogProductEdit $editProductPage, + FixtureFactory $fixtureFactory + ) { + $this->category = $category; + $this->category->persist(); + $this->productGrid = $productGrid; + $this->editProductPage = $editProductPage; + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Run test duplicate product entity. + * + * @param string $productType + * @return array + */ + public function test($productType) + { + // Precondition + $product = $this->createProduct($productType); + + // Steps + $filter = ['sku' => $product->getSku()]; + $this->productGrid->open(); + $this->productGrid->getProductGrid()->searchAndOpen($filter); + $this->editProductPage->getFormPageActions()->saveAndDuplicate(); + + return ['product' => $product]; + } + + /** + * Creating a product according to the type of. + * + * @param string $productType + * @return array + */ + protected function createProduct($productType) + { + list($fixture, $dataSet) = explode('::', $productType); + $product = $this->fixtureFactory->createByCode( + $fixture, + [ + 'dataSet' => $dataSet, + 'data' => [ + 'category_ids' => [ + 'category' => $this->category, + ], + ] + ] + ); + $product->persist(); + + return $product; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..3f2950f6efc1b2360dc1f0d091ff27e47565822a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/DuplicateProductEntityTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Catalog\Test\TestCase\Product\DuplicateProductEntityTest"> + <variation name="DuplicateProductEntityTestVariation1"> + <data name="productType" xsi:type="string">catalogProductSimple::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml index 34bbab86b588337d2aa3f3a9aeaa8d8591ce5070..d0bd1c40c54cbaa745d4f50caaed7c5f86542b6b 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnCreationTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Catalog\Test\TestCase\Product\ProductTypeSwitchingOnCreationTest"> <variation name="ProductTypeSwitchingOnCreationTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> <data name="createProduct" xsi:type="string">simple</data> <data name="product" xsi:type="string">configurableProduct::default</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> @@ -44,6 +45,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> </variation> <variation name="ProductTypeSwitchingOnCreationTestVariation6"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> <data name="createProduct" xsi:type="string">virtual</data> <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> @@ -71,6 +73,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> </variation> <variation name="ProductTypeSwitchingOnCreationTestVariation9"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> <data name="createProduct" xsi:type="string">downloadable</data> <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml index d82f009bac2d5df148d3f4aae04c40e3b1f93fe6..b862b94987c5d39d5a27a2ae6d0a609c6eb0c38c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ProductTypeSwitchingOnUpdateTest.xml @@ -6,106 +6,107 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\Product\ProductTypeSwitchingOnUpdateTest"> - <variation name="ProductTypeSwitchingOnUpdateTestVariation1"> - <data name="productOrigin" xsi:type="string">catalogProductSimple::default</data> - <data name="product" xsi:type="string">configurableProduct::default</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation2"> - <data name="productOrigin" xsi:type="string">catalogProductSimple::default</data> - <data name="product" xsi:type="string">catalogProductVirtual::default</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="productOrigin" xsi:type="string">configurableProduct::default</data> - <data name="product" xsi:type="string">catalogProductSimple::default</data> - <data name="actionName" xsi:type="string">deleteAttributes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="productOrigin" xsi:type="string">configurableProduct::default</data> - <data name="product" xsi:type="string">catalogProductVirtual::default</data> - <data name="actionName" xsi:type="string">deleteAttributes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation5"> - <data name="productOrigin" xsi:type="string">catalogProductVirtual::default</data> - <data name="product" xsi:type="string">catalogProductSimple::default</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation6"> - <data name="productOrigin" xsi:type="string">catalogProductVirtual::default</data> - <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation7"> - <data name="productOrigin" xsi:type="string">catalogProductVirtual::default</data> - <data name="product" xsi:type="string">downloadableProduct::default</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation8" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="productOrigin" xsi:type="string">downloadableProduct::default</data> - <data name="product" xsi:type="string">catalogProductSimple::default</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation9" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="productOrigin" xsi:type="string">downloadableProduct::default</data> - <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation10" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="productOrigin" xsi:type="string">downloadableProduct::default</data> - <data name="product" xsi:type="string">catalogProductVirtual::default</data> - <data name="actionName" xsi:type="string">clearDownloadableData</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - </variation> - <variation name="ProductTypeSwitchingOnUpdateTestVariation11"> - <data name="productOrigin" xsi:type="string">catalogProductSimple::default</data> - <data name="product" xsi:type="string">downloadableProduct::default</data> - <data name="actionName" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\Product\ProductTypeSwitchingOnUpdateTest"> + <variation name="ProductTypeSwitchingOnUpdateTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34630</data> + <data name="productOrigin" xsi:type="string">catalogProductSimple::default</data> + <data name="product" xsi:type="string">configurableProduct::default</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation2"> + <data name="productOrigin" xsi:type="string">catalogProductSimple::default</data> + <data name="product" xsi:type="string">catalogProductVirtual::default</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation3"> + <data name="productOrigin" xsi:type="string">configurableProduct::default</data> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <data name="actionName" xsi:type="string">deleteAttributes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation4"> + <data name="productOrigin" xsi:type="string">configurableProduct::default</data> + <data name="product" xsi:type="string">catalogProductVirtual::default</data> + <data name="actionName" xsi:type="string">deleteAttributes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation5"> + <data name="productOrigin" xsi:type="string">catalogProductVirtual::default</data> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation6"> + <data name="productOrigin" xsi:type="string">catalogProductVirtual::default</data> + <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation7"> + <data name="productOrigin" xsi:type="string">catalogProductVirtual::default</data> + <data name="product" xsi:type="string">downloadableProduct::default</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation8"> + <data name="productOrigin" xsi:type="string">downloadableProduct::default</data> + <data name="product" xsi:type="string">catalogProductSimple::default</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation9"> + <data name="productOrigin" xsi:type="string">downloadableProduct::default</data> + <data name="product" xsi:type="string">configurableProduct::not_virtual_for_type_switching</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation10"> + <data name="productOrigin" xsi:type="string">downloadableProduct::default</data> + <data name="product" xsi:type="string">catalogProductVirtual::default</data> + <data name="actionName" xsi:type="string">clearDownloadableData</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + </variation> + <variation name="ProductTypeSwitchingOnUpdateTestVariation11"> + <data name="productOrigin" xsi:type="string">catalogProductSimple::default</data> + <data name="product" xsi:type="string">downloadableProduct::default</data> + <data name="actionName" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableLinksData" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php index 897c4eb57180a2f3b541ef65941b190daec4411f..d17441b09b1fce6815ac4fa4f70771fa8918b335 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.php @@ -54,7 +54,6 @@ class CreateProductAttributeEntityFromProductPageTest extends Scenario */ public function __prepare(FixtureFactory $fixtureFactory) { - $this->markTestIncomplete('Bug: MTA-1616'); $product = $fixtureFactory->createByCode( 'catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor'] diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml index f88391d8938b591dd39a54c9ade2683bbd54f07c..2a0d3215e00f39556df7101785673ee781987133 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml @@ -6,109 +6,67 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\CreateProductAttributeEntityFromProductPageTest"> - <variation name="CreateProductAttributeEntityFromProductPageTestVariation1"> - <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> - <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> - <data name="attribute/data/options/preset" xsi:type="string">-</data> - <data name="attribute/data/is_required" xsi:type="string">No</data> - <data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data> - <data name="attribute/data/is_global" xsi:type="string">Global</data> - <data name="attribute/data/default_value_text" xsi:type="string"><b><i>default_value_text%isolation%</i></b></data> - <data name="attribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="attribute/data/is_unique" xsi:type="string">Yes</data> - <data name="attribute/data/manage_frontend_label" xsi:type="string">-</data> - <data name="attribute/data/is_searchable" xsi:type="string">Yes</data> - <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> - <data name="attribute/data/is_comparable" xsi:type="string">Yes</data> - <data name="attribute/data/is_filterable" xsi:type="string">-</data> - <data name="attribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="attribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="attribute/data/is_html_allowed_on_front" xsi:type="string">Yes</data> - <data name="attribute/data/is_visible_on_front" xsi:type="string">Yes</data> - <data name="attribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="attribute/data/used_for_sort_by" xsi:type="string">Yes</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsGlobal"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnFrontend"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsHtmlAllowed"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend"/> - </variation> - <variation name="CreateProductAttributeEntityFromProductPageTestVariation2"> - <data name="attribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data> - <data name="attribute/data/frontend_input" xsi:type="string">Dropdown</data> - <data name="attribute/data/options/preset" xsi:type="string">two_options</data> - <data name="attribute/data/is_required" xsi:type="string">No</data> - <data name="attribute/data/attribute_code" xsi:type="string">attr_dropdown_%isolation%</data> - <data name="attribute/data/is_global" xsi:type="string">Global</data> - <data name="attribute/data/default_value_text" xsi:type="string">-</data> - <data name="attribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="attribute/data/is_unique" xsi:type="string">-</data> - <data name="attribute/data/manage_frontend_label" xsi:type="string">-</data> - <data name="attribute/data/is_searchable" xsi:type="string">-</data> - <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">-</data> - <data name="attribute/data/is_comparable" xsi:type="string">-</data> - <data name="attribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> - <data name="attribute/data/is_filterable_in_search" xsi:type="string">Yes</data> - <data name="attribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="attribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="attribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="attribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="attribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductAttributeIsConfigurable"/> - </variation> - <variation name="CreateProductAttributeEntityFromProductPageTestVariation3"> - <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> - <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> - <data name="attribute/data/options/preset" xsi:type="string">-</data> - <data name="attribute/data/is_required" xsi:type="string">Yes</data> - <data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data> - <data name="attribute/data/is_global" xsi:type="string">-</data> - <data name="attribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> - <data name="attribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="attribute/data/is_unique" xsi:type="string">-</data> - <data name="attribute/data/manage_frontend_label" xsi:type="string">-</data> - <data name="attribute/data/is_searchable" xsi:type="string">-</data> - <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">-</data> - <data name="attribute/data/is_comparable" xsi:type="string">-</data> - <data name="attribute/data/is_filterable" xsi:type="string">-</data> - <data name="attribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="attribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="attribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="attribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="attribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="attribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired"/> - </variation> - <variation name="CreateProductAttributeEntityFromProductPageTestVariation4"> - <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> - <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> - <data name="attribute/data/options/preset" xsi:type="string">-</data> - <data name="attribute/data/is_required" xsi:type="string">No</data> - <data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data> - <data name="attribute/data/is_global" xsi:type="string">-</data> - <data name="attribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> - <data name="attribute/data/default_value_textarea" xsi:type="string">-</data> - <data name="attribute/data/is_unique" xsi:type="string">Yes</data> - <data name="attribute/data/manage_frontend_label" xsi:type="string">-</data> - <data name="attribute/data/is_searchable" xsi:type="string">-</data> - <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">-</data> - <data name="attribute/data/is_comparable" xsi:type="string">-</data> - <data name="attribute/data/is_filterable" xsi:type="string">-</data> - <data name="attribute/data/is_filterable_in_search" xsi:type="string">-</data> - <data name="attribute/data/is_used_for_promo_rules" xsi:type="string">-</data> - <data name="attribute/data/is_html_allowed_on_front" xsi:type="string">-</data> - <data name="attribute/data/is_visible_on_front" xsi:type="string">-</data> - <data name="attribute/data/used_in_product_listing" xsi:type="string">-</data> - <data name="attribute/data/used_for_sort_by" xsi:type="string">-</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUnique"/> - </variation> - </testCase> + <testCase name="Magento\Catalog\Test\TestCase\ProductAttribute\CreateProductAttributeEntityFromProductPageTest"> + <variation name="CreateProductAttributeEntityFromProductPageTestVariation1"> + <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> + <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> + <data name="attribute/data/is_required" xsi:type="string">No</data> + <data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data> + <data name="attribute/data/is_global" xsi:type="string">Global</data> + <data name="attribute/data/default_value_text" xsi:type="string"><b><i>default_value_text%isolation%</i></b></data> + <data name="attribute/data/default_value_textarea" xsi:type="string">-</data> + <data name="attribute/data/is_unique" xsi:type="string">Yes</data> + <data name="attribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="attribute/data/is_comparable" xsi:type="string">Yes</data> + <data name="attribute/data/is_filterable_in_search" xsi:type="string">-</data> + <data name="attribute/data/is_html_allowed_on_front" xsi:type="string">Yes</data> + <data name="attribute/data/is_visible_on_front" xsi:type="string">Yes</data> + <data name="attribute/data/used_for_sort_by" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsGlobal"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnFrontend"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeDisplayingOnSearchForm"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsHtmlAllowed"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend"/> + </variation> + <variation name="CreateProductAttributeEntityFromProductPageTestVariation2"> + <data name="attribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data> + <data name="attribute/data/frontend_input" xsi:type="string">Dropdown</data> + <data name="attribute/data/options/preset" xsi:type="string">two_options</data> + <data name="attribute/data/is_required" xsi:type="string">No</data> + <data name="attribute/data/attribute_code" xsi:type="string">attr_dropdown_%isolation%</data> + <data name="attribute/data/is_global" xsi:type="string">Global</data> + <data name="attribute/data/is_unique" xsi:type="string">-</data> + <data name="attribute/data/is_filterable" xsi:type="string">Filterable (with results)</data> + <data name="attribute/data/is_filterable_in_search" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertProductAttributeIsConfigurable"/> + </variation> + <variation name="CreateProductAttributeEntityFromProductPageTestVariation3"> + <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> + <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> + <data name="attribute/data/is_required" xsi:type="string">Yes</data> + <data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data> + <data name="attribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> + <data name="attribute/data/default_value_textarea" xsi:type="string">-</data> + <data name="attribute/data/manage_frontend_label" xsi:type="string">-</data> + <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">-</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired"/> + </variation> + <variation name="CreateProductAttributeEntityFromProductPageTestVariation4"> + <data name="attribute/data/frontend_label" xsi:type="string">Text_Field_Admin_%isolation%</data> + <data name="attribute/data/frontend_input" xsi:type="string">Text Field</data> + <data name="attribute/data/is_required" xsi:type="string">No</data> + <data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data> + <data name="attribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data> + <data name="attribute/data/is_unique" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUnique"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php index 2d867c8aaa5d114d958081f59ec7e5808dd7ad73..620475dbb388249cb8167120aeacdf279aeafeea 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/FillAttributeFormOnProductPageStep.php @@ -47,7 +47,7 @@ class FillAttributeFormOnProductPageStep implements TestStepInterface */ public function run() { - $this->catalogProductEdit->getProductForm()->fillAttributeForm($this->attribute); + $this->catalogProductEdit->getProductForm()->getAttributeForm()->fill($this->attribute); return ['attribute' => $this->attribute]; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php index f982dafef13783f8f7ab440e0c5bff091be6cbed..1eab3289e6597aa4939e1168848babfcdef38e6c 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedCatalogPage.php @@ -6,49 +6,60 @@ namespace Magento\CatalogRule\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Catalog\Test\Page\Category\CatalogCategoryView; use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; /** - * Class AssertCatalogPriceRuleAppliedCatalogPage + * Assert that Catalog Price Rule is applied for product(s) in Catalog. */ class AssertCatalogPriceRuleAppliedCatalogPage extends AbstractConstraint { /** * Assert that Catalog Price Rule is applied for product(s) in Catalog - * according to Priority(Priority/Stop Further Rules Processing) + * according to Priority(Priority/Stop Further Rules Processing). * - * @param CatalogProductSimple $product - * @param CmsIndex $cmsIndex - * @param CatalogCategoryView $catalogCategoryView - * @param array $price + * @param CmsIndex $cmsIndexPage + * @param CatalogCategoryView $catalogCategoryViewPage + * @param array $products + * @param array $productPrice + * @param Customer $customer * @return void */ public function processAssert( - CatalogProductSimple $product, - CmsIndex $cmsIndex, - CatalogCategoryView $catalogCategoryView, - array $price + CmsIndex $cmsIndexPage, + CatalogCategoryView $catalogCategoryViewPage, + array $products, + array $productPrice, + Customer $customer = null ) { - $cmsIndex->open(); - $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); - $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $productPriceBlock = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($productName); - $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); - $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); - $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; - $diff = $this->verifyData($actualPrice, $price); - \PHPUnit_Framework_Assert::assertTrue( - empty($diff), - implode(' ', $diff) - ); + if ($customer !== null) { + $this->objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + } + $cmsIndexPage->open(); + foreach ($products as $key => $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $productPriceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductPriceBlock($productName); + $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); + $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); + $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + $diff = $this->verifyData($actualPrice, $productPrice[$key]); + \PHPUnit_Framework_Assert::assertTrue( + empty($diff), + implode(' ', $diff) + ); + } } /** - * Check if arrays have equal values + * Check if arrays have equal values. * * @param array $formData * @param array $fixtureData @@ -59,16 +70,16 @@ class AssertCatalogPriceRuleAppliedCatalogPage extends AbstractConstraint $errorMessage = []; foreach ($formData as $key => $value) { if ($value != $fixtureData[$key]) { - $errorMessage[] = "Data not equal." + $errorMessage[] = "Value " . $key . " is not equal." . "\nExpected: " . $fixtureData[$key] - . "\nActual: " . $value; + . "\nActual: " . $value . "\n"; } } return $errorMessage; } /** - * Text of catalog price rule visibility on catalog page (frontend) + * Text of catalog price rule visibility on catalog page (frontend). * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php new file mode 100644 index 0000000000000000000000000000000000000000..a68f7719e18624b36103955d1c3a78ed22cc6c63 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedOnepageCheckout.php @@ -0,0 +1,82 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogRule\Test\Constraint; + +use Magento\Checkout\Test\Page\CheckoutOnepage; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that Catalog Price Rule is applied on OnePage Checkout page. + */ +class AssertCatalogPriceRuleAppliedOnepageCheckout extends AbstractConstraint +{ + /* tags */ + const SEVERITY = 'high'; + /* end tags */ + + /** + * Assert that Catalog Price Rule is applied & it impacts on product's discount price on OnePage Checkout page. + * + * @param CheckoutOnepage $checkoutOnepage + * @param Customer $customer + * @param array $products + * @param array $cartPrice + * @param array $shipping + * @param array $payment + * @return void + */ + public function processAssert( + CheckoutOnepage $checkoutOnepage, + Customer $customer, + array $products, + array $cartPrice, + array $shipping, + array $payment + ) { + $this->objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep', + ['products' => $products] + )->run(); + $this->objectManager->create('\Magento\Checkout\Test\TestStep\ProceedToCheckoutStep')->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\FillBillingInformationStep', + ['customer' => $customer, 'checkoutMethod' => 'register'] + )->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\FillShippingMethodStep', + ['shipping' => $shipping] + )->run(); + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\SelectPaymentMethodStep', + ['payment' => $payment] + )->run(); + $actualPrices['grand_total'] = $checkoutOnepage->getReviewBlock()->getGrandTotal(); + $actualPrices['sub_total'] = $checkoutOnepage->getReviewBlock()->getSubtotal(); + $expectedPrices['grand_total'] = $cartPrice['grand_total'] + $cartPrice['shipping_price']; + $expectedPrices['sub_total'] = $cartPrice['sub_total']; + \PHPUnit_Framework_Assert::assertEquals( + $expectedPrices, + $actualPrices, + 'Wrong total cart prices are displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Displayed catalog price rule data on OnePage Checkout equals to passed from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php index 3dc3d40203234831a391b7a1cc8dec93647408bf..821f48e27730094befa699fd13199996e866defb 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedProductPage.php @@ -6,52 +6,62 @@ namespace Magento\CatalogRule\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Catalog\Test\Page\Category\CatalogCategoryView; -use Magento\Catalog\Test\Page\Product\CatalogProductView; use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; /** - * Class AssertCatalogPriceRuleAppliedProductPage + * Assert that Catalog Price Rule is applied on Product page. */ class AssertCatalogPriceRuleAppliedProductPage extends AbstractConstraint { /** - * Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page + * Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page. * - * @param CatalogProductSimple $product - * @param CatalogProductView $pageCatalogProductView - * @param CmsIndex $cmsIndex - * @param CatalogCategoryView $catalogCategoryView - * @param array $price + * @param CatalogProductView $catalogProductViewPage + * @param CmsIndex $cmsIndexPage + * @param CatalogCategoryView $catalogCategoryViewPage + * @param array $products + * @param array $productPrice + * @param Customer $customer * @return void */ public function processAssert( - CatalogProductSimple $product, - CatalogProductView $pageCatalogProductView, - CmsIndex $cmsIndex, - CatalogCategoryView $catalogCategoryView, - array $price + CatalogProductView $catalogProductViewPage, + CmsIndex $cmsIndexPage, + CatalogCategoryView $catalogCategoryViewPage, + array $products, + array $productPrice, + Customer $customer = null ) { - $cmsIndex->open(); - $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); - $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $catalogCategoryView->getListProductBlock()->openProductViewPage($productName); - $productPriceBlock = $pageCatalogProductView->getViewBlock()->getPriceBlock(); - $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); - $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); - $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; - $diff = $this->verifyData($actualPrice, $price); - \PHPUnit_Framework_Assert::assertTrue( - empty($diff), - implode(' ', $diff) - ); + if ($customer !== null) { + $this->objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + } + $cmsIndexPage->open(); + foreach ($products as $key => $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $catalogCategoryViewPage->getListProductBlock()->openProductViewPage($productName); + $productPriceBlock = $catalogProductViewPage->getViewBlock()->getPriceBlock(); + $actualPrice['regular'] = $productPriceBlock->getRegularPrice(); + $actualPrice['special'] = $productPriceBlock->getSpecialPrice(); + $actualPrice['discount_amount'] = $actualPrice['regular'] - $actualPrice['special']; + $diff = $this->verifyData($actualPrice, $productPrice[$key]); + \PHPUnit_Framework_Assert::assertTrue( + empty($diff), + implode(' ', $diff) + ); + } } /** - * Check if arrays have equal values + * Check if arrays have equal values. * * @param array $formData * @param array $fixtureData @@ -71,7 +81,7 @@ class AssertCatalogPriceRuleAppliedProductPage extends AbstractConstraint } /** - * Text of catalog price rule visibility on product page (frontend) + * Text of catalog price rule visibility on product page (frontend). * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php index 783eba7bfa8fdbea306cba538bffbe9e0e22aa5d..e3b15f78366b04ad70e2e0d10c46518d0ae46a50 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php @@ -6,56 +6,68 @@ namespace Magento\CatalogRule\Test\Constraint; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; -use Magento\Catalog\Test\Page\Category\CatalogCategoryView; -use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Customer\Test\Fixture\Customer; use Magento\Checkout\Test\Page\CheckoutCart; -use Magento\Cms\Test\Page\CmsIndex; use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; /** - * Class AssertCatalogPriceRuleAppliedShoppingCart + * Assert that Catalog Price Rule is applied in Shopping Cart. */ class AssertCatalogPriceRuleAppliedShoppingCart extends AbstractConstraint { /** * Assert that Catalog Price Rule is applied for product(s) in Shopping Cart - * according to Priority(Priority/Stop Further Rules Processing) + * according to Priority(Priority/Stop Further Rules Processing). * - * @param CatalogProductSimple $product - * @param CatalogProductView $pageCatalogProductView - * @param CmsIndex $cmsIndex - * @param CatalogCategoryView $catalogCategoryView - * @param CheckoutCart $pageCheckoutCart - * @param array $price + * @param CheckoutCart $checkoutCartPage + * @param array $products + * @param array $cartPrice + * @param array $productPrice + * @param Customer $customer * @return void */ public function processAssert( - CatalogProductSimple $product, - CatalogProductView $pageCatalogProductView, - CmsIndex $cmsIndex, - CatalogCategoryView $catalogCategoryView, - CheckoutCart $pageCheckoutCart, - array $price + CheckoutCart $checkoutCartPage, + array $products, + array $cartPrice, + array $productPrice, + Customer $customer = null ) { - $cmsIndex->open(); - $categoryName = $product->getCategoryIds()[0]; - $productName = $product->getName(); - $cmsIndex->getTopmenu()->selectCategoryByName($categoryName); - $catalogCategoryView->getListProductBlock()->openProductViewPage($productName); - $pageCatalogProductView->getViewBlock()->clickAddToCartButton(); - $actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getPrice(); + if ($customer !== null) { + $this->objectManager->create( + '\Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep', + ['customer' => $customer] + )->run(); + } + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep', + ['products' => $products] + )->run(); + $checkoutCartPage->open(); + foreach ($products as $key => $product) { + $actualPrice = $checkoutCartPage->getCartBlock()->getCartItem($product)->getSubtotalPrice(); + \PHPUnit_Framework_Assert::assertEquals( + $productPrice[$key]['sub_total'], + $actualPrice, + 'Wrong product price is displayed.' + . "\nExpected: " . $productPrice[$key]['sub_total'] + . "\nActual: " . $actualPrice . "\n" + ); + } + $actualPrices['sub_total'] = $checkoutCartPage->getTotalsBlock()->getSubtotal(); + $actualPrices['grand_total'] = $checkoutCartPage->getTotalsBlock()->getGrandTotal(); + $expectedPrices['sub_total'] = $cartPrice['sub_total']; + $expectedPrices['grand_total'] = $cartPrice['grand_total']; \PHPUnit_Framework_Assert::assertEquals( - $price['grand_total'], - $actualGrandTotal, - 'Wrong grand total price is displayed.' - . "\nExpected: " . $price['grand_total'] - . "\nActual: " . $actualGrandTotal + $expectedPrices, + $actualPrices, + 'Wrong total cart prices are displayed.' ); } /** - * Text of catalog price rule visibility in Shopping Cart (frontend) + * Text of catalog price rule visibility in Shopping Cart (frontend). * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php new file mode 100644 index 0000000000000000000000000000000000000000..4b6b244d48f3dffae669ea84dc296f1066f110be --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedCatalogPage.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogRule\Test\Constraint; + +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; + +/** + * Assert that Catalog Price Rule is not applied for product(s) in Catalog. + */ +class AssertCatalogPriceRuleNotAppliedCatalogPage extends AbstractConstraint +{ + /** + * Assert that Catalog Price Rule is not applied for product(s) in Catalog. + * + * @param CmsIndex $cmsIndexPage + * @param CatalogCategoryView $catalogCategoryViewPage + * @param array $products + * @return void + */ + public function processAssert( + CmsIndex $cmsIndexPage, + CatalogCategoryView $catalogCategoryViewPage, + array $products + ) { + $cmsIndexPage->open(); + foreach ($products as $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $productPriceBlock = $catalogCategoryViewPage->getListProductBlock()->getProductPriceBlock($productName); + \PHPUnit_Framework_Assert::assertFalse( + $productPriceBlock->isSpecialPriceVisible(), + "Catalog price rule is applied!\n" + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Catalog price rule was not applied to products on catalog page.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php new file mode 100644 index 0000000000000000000000000000000000000000..8b5dc40eb97bf34e92138a7a8d98ddce649d3e7e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedProductPage.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogRule\Test\Constraint; + +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Catalog\Test\Page\Product\CatalogProductView; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; + +/** + * Assert that Catalog Price Rule is not applied on Product page. + */ +class AssertCatalogPriceRuleNotAppliedProductPage extends AbstractConstraint +{ + /** + * Assert that Catalog Price Rule is not applied on Product page. + * + * @param CatalogProductView $catalogProductViewPage + * @param CmsIndex $cmsIndexPage + * @param CatalogCategoryView $catalogCategoryViewPage + * @param array $products + * @return void + */ + public function processAssert( + CatalogProductView $catalogProductViewPage, + CmsIndex $cmsIndexPage, + CatalogCategoryView $catalogCategoryViewPage, + array $products + ) { + $cmsIndexPage->open(); + foreach ($products as $product) { + $categoryName = $product->getCategoryIds()[0]; + $productName = $product->getName(); + $cmsIndexPage->getTopmenu()->selectCategoryByName($categoryName); + $catalogCategoryViewPage->getListProductBlock()->openProductViewPage($productName); + $productPriceBlock = $catalogProductViewPage->getViewBlock()->getPriceBlock(); + \PHPUnit_Framework_Assert::assertFalse( + $productPriceBlock->isSpecialPriceVisible(), + "Catalog price rule is applied!\n" + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Catalog price rule was not applied to products on product page.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedShoppingCart.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedShoppingCart.php new file mode 100644 index 0000000000000000000000000000000000000000..bea638692dc20b74acc96ca4734a3bbef47791ed --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleNotAppliedShoppingCart.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogRule\Test\Constraint; + +use Magento\Checkout\Test\Page\CheckoutCart; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that Catalog Price Rule is not applied in Shopping Cart. + */ +class AssertCatalogPriceRuleNotAppliedShoppingCart extends AbstractConstraint +{ + /** + * Assert that Catalog Price Rule is not applied for product(s) in Shopping Cart. + * + * @param CheckoutCart $checkoutCartPage + * @param array $products + * @param array $productPrice + * @return void + */ + public function processAssert( + CheckoutCart $checkoutCartPage, + array $products, + array $productPrice + ) { + $this->objectManager->create( + '\Magento\Checkout\Test\TestStep\AddProductsToTheCartStep', + ['products' => $products] + )->run(); + $checkoutCartPage->open(); + foreach ($products as $key => $product) { + $actualPrice = $checkoutCartPage->getCartBlock()->getCartItem($product)->getSubtotalPrice(); + \PHPUnit_Framework_Assert::assertEquals( + $productPrice[$key]['regular'], + $actualPrice, + 'Wrong product price is displayed.' + . "\nExpected: " . $productPrice[$key]['regular'] + . "\nActual: " . $actualPrice . "\n" + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Displayed catalog price rule data in shopping cart(frontend) equals to passed from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogPriceRule.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogPriceRule.php deleted file mode 100644 index ff33ac103f3b04906254cafb8c32cc7ba888897d..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogPriceRule.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\CatalogRule\Test\Fixture; - -use Magento\CatalogRule\Test\Repository\CatalogPriceRule as Repository; -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\Fixture\DataFixture; - -/** - * Class CatalogPriceRule - * - */ -class CatalogPriceRule extends DataFixture -{ - /** - * {@inheritdoc} - */ - protected function _initData() - { - $this->_repository = Factory::getRepositoryFactory() - ->getMagentoCatalogRuleCatalogPriceRule($this->_dataConfig, $this->_data); - - //Default data set - $this->switchData(Repository::CATALOG_PRICE_RULE); - } - - /** - * Get the rule name value - */ - public function getRuleName() - { - return $this->getData('fields/name/value'); - } - - /** - * Get the discount amount value - */ - public function getDiscountAmount() - { - return $this->getData('fields/discount_amount/value'); - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogRule/Conditions.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogRule/Conditions.php deleted file mode 100644 index 548477e346f9a2c75ac305ce9a912ef7c8409cd5..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/CatalogRule/Conditions.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\CatalogRule\Test\Fixture\CatalogRule; - -use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Mtf\Fixture\FixtureInterface; - -/** - * Class Conditions - * - * Data keys: - * - dataSet - */ -class Conditions implements FixtureInterface -{ - /** - * @var array - */ - protected $data = []; - - /** - * @var \Magento\Mtf\Fixture\FixtureFactory - */ - protected $fixtureFactory; - - /** - * @var array - */ - protected $params; - - /** - * Constructor for preparing conditions data from repository - * - * @param FixtureFactory $fixtureFactory - * @param array $params - * @param string $data - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function __construct(FixtureFactory $fixtureFactory, array $params, $data) - { - preg_match('/\[(.*)\]/', $data, $matches); - $conditionsArray = explode(",", $matches[1]); - $value = array_shift($conditionsArray); - $parts = explode('|', $value); - - foreach ($parts as $key => $value) { - $parts[$key] = trim($value); - } - - if ($parts[0] == 'Category') { - $this->data['conditions']['1--1']['attribute'] = 'category_ids'; - } elseif ($parts[1] == 'AttributeSet') { - $this->data['conditions']['1--1']['attribute'] = 'attribute_set_id'; - } - - if ($parts[1] == 'is') { - $this->data['conditions']['1--1']['operator'] = '=='; - } else { - $this->data['conditions']['1--1']['operator'] = '!='; - } - - $this->data['conditions']['1--1']['type'] = 'Magento\CatalogRule\Model\Rule\Condition\Product'; - - if (!empty($parts[2])) { - $this->data['conditions']['1--1']['value'] = $parts[2]; - } - } - - /** - * Persist custom selections conditions - * - * @return void - */ - public function persist() - { - // - } - - /** - * Return prepared data set - * - * @param string|null $key - * @return array|mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/Product/Category.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/Product/Category.php deleted file mode 100644 index ed8f775509728edac53ffaf3b3fd68fbea7a0c01..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Fixture/Product/Category.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\CatalogRule\Test\Fixture\Product; - -use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Mtf\Fixture\FixtureInterface; - -/** - * Class Category - * - * Data keys: - * - preset (Product options preset name) - */ -class Category implements FixtureInterface -{ - /** - * @var \Magento\Mtf\Fixture\FixtureFactory - */ - protected $fixtureFactory; - - /** - * @param FixtureFactory $fixtureFactory - * @param mixed $data - * @param array $params - * @param bool $persist - */ - public function __construct( - FixtureFactory $fixtureFactory, - $data, - array $params = [], - $persist = false - ) { - $this->fixtureFactory = $fixtureFactory; - - $this->data = $data; - - if (isset($this->data['products'])) { - $products = explode(',', $this->data['products']); - $this->data['products'] = []; - foreach ($products as $key => $product) { - list($fixture, $dataSet) = explode('::', $product); - $this->data['products'][$key] = $this->fixtureFactory - ->createByCode($fixture, ['dataSet' => $dataSet]); - } - } - - $this->data['preset'] = $this->getPreset($this->data['preset']); - - $this->params = $params; - if ($persist) { - $this->persist(); - } - } - - /** - * Persist bundle selections products - * - * @return void - */ - public function persist() - { - if (isset($this->data['products'])) { - foreach ($this->data['products'] as $product) { - /** @var $product FixtureInterface */ - $product->persist(); - } - } - } - - /** - * Return prepared data set - * - * @param $key [optional] - * @return mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } - - /** - * @param $name - * @return mixed - * @throws \InvalidArgumentException - */ - protected function getPreset($name) - { - $presets = [ - 'simple_category' => [ - 'name' => 'Simple With Category', - ], - ]; - if (!isset($presets[$name])) { - return null; - } - return $presets[$name]; - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogPriceRule.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogPriceRule.php deleted file mode 100755 index 1a9b4268b9ffb8271c56725944d648ff7894a5c6..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Repository/CatalogPriceRule.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\CatalogRule\Test\Repository; - -use Magento\Mtf\Repository\AbstractRepository; - -/** - * Class CatalogPriceRule Repository - * - */ -class CatalogPriceRule extends AbstractRepository -{ - const CATALOG_PRICE_RULE = 'catalog_price_rule'; - - const CATALOG_PRICE_RULE_ALL_GROUPS = 'catalog_price_rule_all_groups'; - - const CUSTOMER_GROUP_GENERAL_RULE = 'customer_group_general_rule'; - - const GROUP_RULE_INFORMATION = 'rule_information'; - - const GROUP_CONDITIONS = 'conditions'; - - const GROUP_ACTIONS = 'actions'; - - public function __construct(array $defaultConfig = [], array $defaultData = []) - { - $this->_data['default'] = ['config' => $defaultConfig, 'data' => $defaultData]; - $this->_data[self::CATALOG_PRICE_RULE] = $this->_getCatalogPriceRule(); - $this->_data[self::CATALOG_PRICE_RULE_ALL_GROUPS] = array_replace_recursive( - $this->_getCatalogPriceRule(), - $this->_getCatalogPriceRuleAllGroups() - ); - } - - protected function _getCatalogPriceRule() - { - return [ - 'data' => [ - 'fields' => [ - 'name' => ['value' => 'Rule %isolation%', 'group' => static::GROUP_RULE_INFORMATION], - 'is_active' => [ - 'value' => 'Active', - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'select', - ], - 'website_ids' => [ - 'value' => ['Main Website'], - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'multiselect', - 'input_value' => ['1'], - ], - 'customer_group_ids' => [ - 'value' => ['%group_value%'], - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'multiselect', - 'input_value' => ['%group_id%'], - ], - 'simple_action' => [ - 'value' => 'By Percentage of the Original Price', - 'group' => static::GROUP_ACTIONS, - 'input' => 'select', - ], - 'discount_amount' => ['value' => '50.0000', 'group' => static::GROUP_ACTIONS], - 'conditions' => [ - 'value' => '[Category|is|%category_id%]', - 'group' => static::GROUP_CONDITIONS, - 'input' => 'conditions', - 'input_value' => 'Magento\CatalogRule\Model\Rule\Condition\Product|category_ids', - ], - ], - ] - ]; - } - - protected function _getCatalogPriceRuleAllGroups() - { - return [ - 'data' => [ - 'fields' => [ - 'customer_group_ids' => [ - 'value' => ['NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'], - 'group' => static::GROUP_RULE_INFORMATION, - 'input' => 'multiselect', - 'input_value' => ['0', '1', '2', '3'], - ], - ], - ] - ]; - } -} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php index c9e412c975af762365d454996adadaab76908b22..84f9cd923b6ef87fa44b77d82c0874529f0362fa 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.php @@ -58,12 +58,14 @@ class ApplySeveralCatalogPriceRuleEntityTest extends AbstractCatalogRuleEntityTe $this->catalogRuleNew->getFormPageActions()->saveAndApply(); } // Create product - $productSimple = $this->fixtureFactory->createByCode( - 'catalogProductSimple', - ['dataSet' => 'simple_for_salesrule_1'] - ); - $productSimple->persist(); + $products = $this->objectManager->create( + '\Magento\Catalog\Test\TestStep\CreateProductsStep', + ['products' => 'catalogProductSimple::simple_for_salesrule_1'] + )->run(); - return ['product' => $productSimple]; + return [ + 'products' => $products['products'], + 'category' => $products['products'][0]->getDataFieldConfig('category_ids')['source']->getCategories()[0], + ]; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml index 59418b9161ce48d8b265fd49b56f5380fa6e5092..6f335c06d63aff7113f1b349726ca4cc597fbb30 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/ApplySeveralCatalogPriceRuleEntityTest.xml @@ -11,11 +11,12 @@ <data name="catalogRulesOriginal/priority_0" xsi:type="string">catalog_price_rule_priority_0</data> <data name="catalogRulesOriginal/priority_1" xsi:type="string">-</data> <data name="catalogRulesOriginal/priority_2" xsi:type="string">catalog_price_rule_priority_2</data> - <data name="price/sub_total" xsi:type="string">100</data> - <data name="price/grand_total" xsi:type="string">40</data> - <data name="price/discount_amount" xsi:type="string">60</data> - <data name="price/special" xsi:type="string">40</data> - <data name="price/regular" xsi:type="string">100</data> + <data name="cartPrice/sub_total" xsi:type="string">40</data> + <data name="cartPrice/grand_total" xsi:type="string">40</data> + <data name="productPrice/0/discount_amount" xsi:type="string">60</data> + <data name="productPrice/0/special" xsi:type="string">40</data> + <data name="productPrice/0/sub_total" xsi:type="string">40</data> + <data name="productPrice/0/regular" xsi:type="string">100</data> <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedCatalogPage"/> <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedProductPage"/> <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedShoppingCart"/> @@ -24,11 +25,12 @@ <data name="catalogRulesOriginal/priority_0" xsi:type="string">catalog_price_rule_priority_0</data> <data name="catalogRulesOriginal/priority_1" xsi:type="string">catalog_price_rule_priority_1_stop_further_rules</data> <data name="catalogRulesOriginal/priority_2" xsi:type="string">catalog_price_rule_priority_2</data> - <data name="price/sub_total" xsi:type="string">100</data> - <data name="price/grand_total" xsi:type="string">45</data> - <data name="price/discount_amount" xsi:type="string">55</data> - <data name="price/special" xsi:type="string">45</data> - <data name="price/regular" xsi:type="string">100</data> + <data name="cartPrice/sub_total" xsi:type="string">45</data> + <data name="cartPrice/grand_total" xsi:type="string">45</data> + <data name="productPrice/0/discount_amount" xsi:type="string">55</data> + <data name="productPrice/0/special" xsi:type="string">45</data> + <data name="productPrice/0/sub_total" xsi:type="string">45</data> + <data name="productPrice/0/regular" xsi:type="string">100</data> <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedCatalogPage"/> <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedProductPage"/> <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedShoppingCart"/> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php index b16659bb3aa2d8243e52552d72e8d61f7b086193..cff1f6ac7037a57dbf52be7545d425491f292b37 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.php @@ -6,8 +6,10 @@ namespace Magento\CatalogRule\Test\TestCase; -use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Customer\Test\Fixture\Customer; use Magento\CatalogRule\Test\Fixture\CatalogRule; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Customer\Test\Fixture\CustomerGroupInjectable; /** * Test Coverage for Create Catalog Rule @@ -28,20 +30,28 @@ use Magento\CatalogRule\Test\Fixture\CatalogRule; class CreateCatalogRuleTest extends AbstractCatalogRuleEntityTest { /* tags */ + const TEST_TYPE = 'acceptance_test'; const MVP = 'yes'; const DOMAIN = 'MX'; + const STABLE = 'no'; /* end tags */ /** * Create Catalog Price Rule * * @param CatalogRule $catalogPriceRule + * @param Customer $customer + * @param string $product * @return array */ - public function testCreate(CatalogRule $catalogPriceRule) - { - $productSimple = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'MAGETWO-23036']); + public function testCreate( + CatalogRule $catalogPriceRule, + $product, + Customer $customer = null + ) { + $productSimple = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => $product]); // Prepare data + $catalogPriceRule = $this->applyCustomerGroup($catalogPriceRule, $customer); $replace = [ 'conditions' => [ 'conditions' => [ @@ -60,6 +70,9 @@ class CreateCatalogRuleTest extends AbstractCatalogRuleEntityTest $this->catalogRuleNew->getEditForm()->fill($catalogPriceRule, null, $replace); $this->catalogRuleNew->getFormPageActions()->save(); + // Prepare data for tear down + $this->catalogRules[] = $catalogPriceRule; + // Apply Catalog Price Rule $this->catalogRuleIndex->getGridPageActions()->applyRules(); @@ -71,9 +84,36 @@ class CreateCatalogRuleTest extends AbstractCatalogRuleEntityTest $this->adminCache->getActionsBlock()->flushMagentoCache(); $this->adminCache->getMessagesBlock()->waitSuccessMessage(); - // Prepare data for tear down - $this->catalogRules[] = $catalogPriceRule; + return [ + 'products' => [$productSimple], + 'category' => $productSimple->getDataFieldConfig('category_ids')['source']->getCategories()[0], + ]; + } + + /** + * Create customer with customer group and apply customer group to catalog price rule. + * + * @param CatalogRule $catalogPriceRule + * @param Customer|null $customer + * @return CustomerGroupInjectable + */ + public function applyCustomerGroup(CatalogRule $catalogPriceRule, Customer $customer = null) + { + if ($customer !== null) { + $customer->persist(); + /** @var \Magento\Customer\Test\Fixture\CustomerGroupInjectable $customerGroup */ + $customerGroup = $customer->getDataFieldConfig('group_id')['source']->getCustomerGroup(); + $catalogPriceRule = $this->fixtureFactory->createByCode( + 'catalogRule', + [ + 'data' => array_merge( + $catalogPriceRule->getData(), + ['customer_group_ids' => $customerGroup->getCustomerGroupCode()] + ) + ] + ); + } - return ['product' => $productSimple]; + return $catalogPriceRule; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml index 676f80d505035e93ccc3a0da4c24de03015c2023..91556d40fba7f2d537452532882bb22c75ca265a 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/CreateCatalogRuleTest.xml @@ -6,24 +6,51 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\CatalogRule\Test\TestCase\CreateCatalogRuleTest"> - <variation name="CreateCatalogRuleTestVariation1"> - <data name="catalogPriceRule/data/name" xsi:type="string">rule_name%isolation%</data> - <data name="catalogPriceRule/data/is_active" xsi:type="string">Active</data> - <data name="catalogPriceRule/data/website_ids" xsi:type="string">Main Website</data> - <data name="catalogPriceRule/data/customer_group_ids" xsi:type="string">NOT LOGGED IN</data> - <data name="catalogPriceRule/data/conditions" xsi:type="string">[Category|is|%category_1%]</data> - <data name="catalogPriceRule/data/simple_action" xsi:type="string">To Percentage of the Original Price</data> - <data name="catalogPriceRule/data/discount_amount" xsi:type="string">90</data> - <data name="price/sub_total" xsi:type="string">100</data> - <data name="price/grand_total" xsi:type="string">90</data> - <data name="price/discount_amount" xsi:type="string">10</data> - <data name="price/special" xsi:type="string">90</data> - <data name="price/regular" xsi:type="string">100</data> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleInGrid"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedCatalogPage"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedProductPage"/> - <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedShoppingCart"/> - </variation> - </testCase> + <testCase name="Magento\CatalogRule\Test\TestCase\CreateCatalogRuleTest"> + <variation name="CreateCatalogRuleTestVariation1"> + <data name="product" xsi:type="string">MAGETWO-23036</data> + <data name="catalogPriceRule/data/name" xsi:type="string">rule_name%isolation%</data> + <data name="catalogPriceRule/data/is_active" xsi:type="string">Active</data> + <data name="catalogPriceRule/data/website_ids" xsi:type="string">Main Website</data> + <data name="catalogPriceRule/data/customer_group_ids" xsi:type="string">NOT LOGGED IN</data> + <data name="catalogPriceRule/data/conditions" xsi:type="string">[Category|is|%category_1%]</data> + <data name="catalogPriceRule/data/simple_action" xsi:type="string">To Percentage of the Original Price</data> + <data name="catalogPriceRule/data/discount_amount" xsi:type="string">90</data> + <data name="cartPrice/sub_total" xsi:type="string">90</data> + <data name="cartPrice/grand_total" xsi:type="string">90</data> + <data name="productPrice/0/discount_amount" xsi:type="string">10</data> + <data name="productPrice/0/special" xsi:type="string">90</data> + <data name="productPrice/0/sub_total" xsi:type="string">90</data> + <data name="productPrice/0/regular" xsi:type="string">100</data> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleInGrid"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedCatalogPage"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedProductPage"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedShoppingCart"/> + </variation> + <variation name="CreateCatalogRuleTestVariation2"> + <data name="description" xsi:type="string">MAGETWO-12908: Apply Catalog Price Rules to Specific Customer Group.</data> + <data name="customer/dataSet" xsi:type="string">customer_with_new_customer_group</data> + <data name="product" xsi:type="string">simple_10_dollar</data> + <data name="catalogPriceRule/data/name" xsi:type="string">rule_name%isolation%</data> + <data name="catalogPriceRule/data/is_active" xsi:type="string">Active</data> + <data name="catalogPriceRule/data/website_ids" xsi:type="string">Main Website</data> + <data name="catalogPriceRule/data/conditions" xsi:type="string">[Category|is|%category_1%]</data> + <data name="catalogPriceRule/data/simple_action" xsi:type="string">By Percentage of the Original Price</data> + <data name="catalogPriceRule/data/discount_amount" xsi:type="string">50</data> + <data name="cartPrice/sub_total" xsi:type="string">5</data> + <data name="cartPrice/grand_total" xsi:type="string">5</data> + <data name="productPrice/0/discount_amount" xsi:type="string">5</data> + <data name="productPrice/0/special" xsi:type="string">5</data> + <data name="productPrice/0/sub_total" xsi:type="string">5</data> + <data name="productPrice/0/regular" xsi:type="string">10</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleInGrid"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleNotAppliedCatalogPage"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleNotAppliedProductPage"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleNotAppliedShoppingCart"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedCatalogPage"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedProductPage"/> + <constraint name="Magento\CatalogRule\Test\Constraint\AssertCatalogPriceRuleAppliedShoppingCart"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..b3ba80fd8108654f103cdcad5f7d57353754acf3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest14"> + <data name="menuItem" xsi:type="string">Marketing > Catalog Price Rules</data> + <data name="pageTitle" xsi:type="string">Catalog Price Rules</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php index 189ebcaaca3f02d532258f236cbe7c0a34fe7fe4..8178bd9dbbf3870367a3d7cc742ca6055ae8a31e 100755 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestCase/UpdateCatalogPriceRuleEntityTest.php @@ -80,12 +80,12 @@ class UpdateCatalogPriceRuleEntityTest extends AbstractCatalogRuleEntityTest $this->catalogRuleNew->getEditForm()->fill($catalogPriceRule, null, $replace); $this->catalogRuleNew->getFormPageActions()->$saveAction(); - // Create simple product with category - $productSimple->persist(); - // Prepare data for tear down $this->catalogRules[] = $catalogPriceRule; - return ['product' => $productSimple]; + // Create simple product with category + $productSimple->persist(); + + return ['products' => [$productSimple]]; } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php index 106070b62ec4e474126a1966f8461f0cd96a80b0..aa4f63f5cd9776905ca7c21b28a39f5dc5525eb3 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.php @@ -12,20 +12,16 @@ use Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for CreateSearchTermEntity - * - * Test Flow: - * * Preconditions: - * 1. Product is created + * 1. Product is created. * * Steps: - * 1. Go to backend as admin user - * 4. Navigate to Marketing->SEO&Search->Search Terms - * 5. Click "Add New Search Term" button - * 6. Fill out all data according to dataset - * 7. Save the Search Term - * 8. Perform all assertions + * 1. Go to backend as admin user. + * 4. Navigate to Marketing > SEO&Search > Search Terms. + * 5. Click "Add New Search Term" button. + * 6. Fill out all data according to dataset. + * 7. Save the Search Term. + * 8. Perform all assertions. * * @group Search_Terms_(MX) * @ZephyrId MAGETWO-26165 @@ -38,21 +34,21 @@ class CreateSearchTermEntityTest extends Injectable /* end tags */ /** - * Search term page + * Search term page. * * @var CatalogSearchIndex */ protected $indexPage; /** - * Search term edit page + * Search term edit page. * * @var CatalogSearchEdit */ protected $editPage; /** - * Inject pages + * Inject pages. * * @param CatalogSearchIndex $indexPage * @param CatalogSearchEdit $editPage @@ -65,7 +61,7 @@ class CreateSearchTermEntityTest extends Injectable } /** - * Run create search term test + * Run create search term test. * * @param CatalogSearchQuery $searchTerm * @return void diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml index cc92653c73f77698153ec84deadb1da0b3e4742a..02a7b1b0d410e9b80f4d1a97e1a816836390ddb4 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/CreateSearchTermEntityTest.xml @@ -6,18 +6,18 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\CatalogSearch\Test\TestCase\CreateSearchTermEntityTest"> - <variation name="CreateSearchTermEntityTestVariation1"> - <data name="searchTerm/data/query_text/value" xsi:type="string">catalogProductSimple::getSku</data> - <data name="searchTerm/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> - <data name="searchTerm/data/synonym_for" xsi:type="string">Search Term Synonym %isolation%</data> - <data name="searchTerm/data/redirect" xsi:type="string">http://example.com/</data> - <data name="searchTerm/data/display_in_terms" xsi:type="string">No</data> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermSuccessSaveMessage"/> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermInGrid"/> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermForm"/> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermOnFrontend"/> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermSynonymOnFrontend"/> - </variation> - </testCase> + <testCase name="Magento\CatalogSearch\Test\TestCase\CreateSearchTermEntityTest"> + <variation name="CreateSearchTermEntityTestVariation1"> + <data name="searchTerm/data/query_text/value" xsi:type="string">catalogProductSimple::sku</data> + <data name="searchTerm/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="searchTerm/data/synonym_for" xsi:type="string">Search Term Synonym %isolation%</data> + <data name="searchTerm/data/redirect" xsi:type="string">http://example.com/</data> + <data name="searchTerm/data/display_in_terms" xsi:type="string">No</data> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermSuccessSaveMessage" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermInGrid" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermForm" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermOnFrontend" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermSynonymOnFrontend" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.xml deleted file mode 100644 index 113e7c222fcbc013f92f863b97acd13acbfb30e5..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\CatalogSearch\Test\TestCase\EditSearchTermEntityTest"> - <variation name="EditSearchTermEntityTestVariation1"> - <data name="searchTerm/data/query_text/value" xsi:type="string">catalogProductSimple::getSku</data> - <data name="searchTerm/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> - <data name="searchTerm/data/num_results" xsi:type="string">1</data> - <data name="searchTerm/data/popularity" xsi:type="string">20</data> - <data name="searchTerm/data/synonym_for" xsi:type="string">simple%isolation%</data> - <data name="searchTerm/data/redirect" xsi:type="string">http://example.com/</data> - <data name="searchTerm/data/display_in_terms" xsi:type="string">No</data> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermSuccessSaveMessage"/> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermForm"/> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermInGrid"/> - <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermOnFrontend"/> - </variation> - </testCase> -</config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..51a39239a23c7ec23f757377156c78993be86a62 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest15"> + <data name="menuItem" xsi:type="string">Marketing > Search Terms</data> + <data name="pageTitle" xsi:type="string">Search Terms</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest16"> + <data name="menuItem" xsi:type="string">Reports > Search Terms</data> + <data name="pageTitle" xsi:type="string">Search Terms Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php index d4ce912e61386c4a79a50b99f4c6c64b24510f45..146f33e1212fb847eca8302e8b0d7d6467046d46 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/SuggestSearchingResultEntityTest.php @@ -11,10 +11,6 @@ use Magento\Cms\Test\Page\CmsIndex; use Magento\Mtf\TestCase\Injectable; /** - * Cover Suggest Searching Result (SearchEntity) - * - * Test Flow: - * * Preconditions: * 1. Two "default" test simple products is created. * 2. Navigate to frontend. @@ -36,7 +32,7 @@ class SuggestSearchingResultEntityTest extends Injectable /* end tags */ /** - * Run suggest searching result test + * Run suggest searching result test. * * @param CmsIndex $cmsIndex * @param CatalogSearchQuery $catalogSearch diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php similarity index 77% rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php index a2b143d4786f03bd5e0b64f381c0c01231d5ae3b..e81e138f19279e4c4ebcbe4b79b87aeb55eac7ba 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.php @@ -13,27 +13,23 @@ use Magento\Cms\Test\Page\CmsIndex; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for EditSearchTermEntity - * - * Test Flow: - * * Preconditions: - * 1. Product is created + * 1. Product is created. * * Steps: - * 1. Go to frontend - * 2. Test word into the Search field at the top of the page and click Go - * 3. Go to backend as admin user - * 4. Navigate to Marketing->SEO&Search->Search Terms - * 5. Click "Edit" link of just added test word search term - * 6. Fill out all data according to dataset - * 7. Save the Search Term - * 8. Perform all assertions + * 1. Go to frontend. + * 2. Test word into the Search field at the top of the page and click Go. + * 3. Go to backend as admin user. + * 4. Navigate to Marketing > SEO&Search > Search Terms. + * 5. Click "Edit" link of just added test word search term. + * 6. Fill out all data according to dataset. + * 7. Save the Search Term. + * 8. Perform all assertions. * * @group Search_Terms_(MX) * @ZephyrId MAGETWO-26100 */ -class EditSearchTermEntityTest extends Injectable +class UpdateSearchTermEntityTest extends Injectable { /* tags */ const MVP = 'yes'; @@ -41,28 +37,28 @@ class EditSearchTermEntityTest extends Injectable /* end tags */ /** - * CMS index page + * CMS index page. * * @var CmsIndex */ protected $cmsIndex; /** - * Search term page + * Search term page. * * @var CatalogSearchIndex */ protected $indexPage; /** - * Search term edit page + * Search term edit page. * * @var CatalogSearchEdit */ protected $editPage; /** - * Inject pages + * Inject pages. * * @param CmsIndex $cmsIndex * @param CatalogSearchIndex $indexPage @@ -80,7 +76,7 @@ class EditSearchTermEntityTest extends Injectable } /** - * Run edit search term test + * Run update search term test. * * @param CatalogSearchQuery $searchTerm * @return void diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..af1eb669e1f62f9a4036f0f3eba43701526a96d1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/UpdateSearchTermEntityTest.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\CatalogSearch\Test\TestCase\UpdateSearchTermEntityTest"> + <variation name="UpdateSearchTermEntityTestVariation1"> + <data name="searchTerm/data/query_text/value" xsi:type="string">catalogProductSimple::sku</data> + <data name="searchTerm/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="searchTerm/data/num_results" xsi:type="string">1</data> + <data name="searchTerm/data/popularity" xsi:type="string">20</data> + <data name="searchTerm/data/synonym_for" xsi:type="string">simple%isolation%</data> + <data name="searchTerm/data/redirect" xsi:type="string">http://example.com/</data> + <data name="searchTerm/data/display_in_terms" xsi:type="string">No</data> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermSuccessSaveMessage" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermForm" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermInGrid" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertSearchTermOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php index 2802929c1069c518f00fbb12bee0d8715daa0a96..5d12b4575d9adc26f53cb67398eb84941db42375 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php @@ -48,7 +48,7 @@ class Cart extends Block * * @var string */ - protected $updateShoppingCart = '[name="update_cart_action"]'; + protected $updateShoppingCart = '.update[name="update_cart_action"]'; /** * Cart empty block selector @@ -57,6 +57,13 @@ class Cart extends Block */ protected $cartEmpty = '.cart-empty'; + /** + * Cart container selector + * + * @var string + */ + protected $cartContainer = '.cart-container'; + /** * Get cart item block * @@ -170,4 +177,12 @@ class Cart extends Block { return $this->_rootElement->find($this->cartEmpty, Locator::SELECTOR_CSS)->isVisible(); } + + /** + * Wait while cart container is loaded + */ + public function waitCartContainerLoading() + { + $this->waitForElementVisible($this->cartContainer); + } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml index ebe516f24fa44cb7ecf4dee001a7d7151b93371b..165315f753cb3809ccb097bb3dccbd8b69631312 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/DeleteProductFromMiniShoppingCartTest.xml @@ -19,6 +19,6 @@ <data name="products" xsi:type="string">catalogProductSimple::default</data> <data name="deletedProductIndex" xsi:type="string">0</data> <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> - </variation> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php index f5d30d2f9bdc2f376563ee8964537b6758553fb2..b99ac46a7261d7d25c83f283e7aabbe389f06b4d 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateProductFromMiniShoppingCartEntityTest.php @@ -85,6 +85,7 @@ class UpdateProductFromMiniShoppingCartEntityTest extends Injectable */ public function test($originalProduct, $checkoutData) { + $this->markTestIncomplete('Bug: MAGETWO-34259'); // Preconditions: $product = $this->createProduct($originalProduct); $this->addToCart($product); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php index bd3f7381fb4ad87b90eb55fec967c9dccef684ee..f30e937e0ace3a196c18a27a556aaf5888e8a1f4 100755 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.php @@ -15,9 +15,6 @@ use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for Update ShoppingCart - * - * Test Flow: * Precondition: * 1. Simple product is created * 2. Clear shopping cart @@ -113,6 +110,7 @@ class UpdateShoppingCartTest extends Injectable $productView->fillOptions($product); $productView->setQty(1); $productView->clickAddToCart(); + $this->catalogProductView->getMessagesBlock()->waitSuccessMessage(); $qty = $product->getCheckoutData()['qty']; $this->checkoutCart->open(); diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php index 9813b554032d126da7ec78f111d92c6c6fca7918..d49dd6cec919433d45319097da2f5884fa1c5ec3 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/EstimateShippingAndTaxStep.php @@ -106,6 +106,7 @@ class EstimateShippingAndTaxStep implements TestStepInterface public function run() { $this->checkoutCart->open(); + $this->checkoutCart->getCartBlock()->waitCartContainerLoading(); /** @var \Magento\Checkout\Test\Fixture\Cart $cart */ if ($this->cart !== null) { $cart = $this->fixtureFactory->createByCode( @@ -113,6 +114,7 @@ class EstimateShippingAndTaxStep implements TestStepInterface ['data' => array_merge($this->cart->getData(), ['items' => ['products' => $this->products]])] ); $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($this->address); + $this->checkoutCart->getCartBlock()->waitCartContainerLoading(); if (!empty($this->shipping)) { $this->checkoutCart->getShippingBlock()->selectShippingMethod($this->shipping); } diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php index 9bcca39ddd4b577fc37dce6e3df5d24270e98a69..f14298e28858eef9b5c5818b1f116ba3619f9fe6 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Constraint/AssertTermAbsentOnCheckout.php @@ -16,7 +16,6 @@ use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\ObjectManager; /** - * Class AssertTermAbsentOnCheckout * Check that Checkout Agreement is absent in the Place order tab. */ class AssertTermAbsentOnCheckout extends AbstractConstraint @@ -60,6 +59,8 @@ class AssertTermAbsentOnCheckout extends AbstractConstraint $browser->open($_ENV['app_frontend_url'] . $product['products'][0]->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickAddToCartButton(); + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); + $checkoutCart->open(); $checkoutCart->getCartBlock()->getOnepageLinkBlock()->proceedToCheckout(); $checkoutOnepage->getLoginBlock()->guestCheckout(); $checkoutOnepage->getLoginBlock()->clickContinue(); diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml index e6462a16bf8d73148e74ac21a1a906bde8dbf7d7..4a9a438e8460ae93d277273787204e0d78bfd333 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Fixture/CheckoutAgreement.xml @@ -6,44 +6,48 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="checkoutAgreement" module="Magento_CheckoutAgreements" type="flat" entity_type="checkout_agreement" collection="Magento\CheckoutAgreements\Model\Resource\Agreement\Collection" repository_class="Magento\CheckoutAgreements\Test\Repository\CheckoutAgreement" handler_interface="Magento\CheckoutAgreements\Test\Handler\CheckoutAgreement\CheckoutAgreementInterface" class="Magento\CheckoutAgreements\Test\Fixture\CheckoutAgreement"> - <dataset name="default"> - <field name="name" xsi:type="string">DefaultName%isolation%</field> - <field name="is_active" xsi:type="string">Enabled</field> - <field name="is_html" xsi:type="string">Text</field> - <field name="stores" xsi:type="array"> - <item name="dataSet" xsi:type="string">default</item> - </field> - <field name="checkbox_text" xsi:type="string">test_checkbox%isolation%</field> - <field name="content" xsi:type="string">TestMessage%isolation%</field> - </dataset> - <field name="agreement_id" is_required="1"> - <default_value xsi:type="null"/> - </field> - <field name="name" is_required=""> - <default_value xsi:type="string">DefaultName%isolation%</default_value> - </field> - <field name="content" is_required=""> - <default_value xsi:type="string">TestMessage%isolation%</default_value> - </field> - <field name="content_height" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="checkbox_text" is_required=""> - <default_value xsi:type="string">test_checkbox%isolation%</default_value> - </field> - <field name="is_active" is_required=""> - <default_value xsi:type="string">Enabled</default_value> - </field> - <field name="is_html" is_required=""> - <default_value xsi:type="string">Text</default_value> - </field> - <field name="store_ids" source="Magento\CheckoutAgreements\Test\Fixture\CheckoutAgreement\Stores"> - <default_value xsi:type="array"> + <fixture name="checkoutAgreement" module="Magento_CheckoutAgreements" + type="flat" entity_type="checkout_agreement" collection="Magento\CheckoutAgreements\Model\Resource\Agreement\Collection" + repository_class="Magento\CheckoutAgreements\Test\Repository\CheckoutAgreement" + handler_interface="Magento\CheckoutAgreements\Test\Handler\CheckoutAgreement\CheckoutAgreementInterface" + class="Magento\CheckoutAgreements\Test\Fixture\CheckoutAgreement"> + <dataset name="default"> + <field name="name" xsi:type="string">DefaultName%isolation%</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="is_html" xsi:type="string">Text</field> + <field name="stores" xsi:type="array"> + <item name="dataSet" xsi:type="string">default</item> + </field> + <field name="checkbox_text" xsi:type="string">test_checkbox%isolation%</field> + <field name="content" xsi:type="string">TestMessage%isolation%</field> + </dataset> + <field name="agreement_id" is_required="1"> + <default_value xsi:type="null" /> + </field> + <field name="name" is_required=""> + <default_value xsi:type="string">DefaultName%isolation%</default_value> + </field> + <field name="content" is_required=""> + <default_value xsi:type="string">TestMessage%isolation%</default_value> + </field> + <field name="content_height" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="checkbox_text" is_required=""> + <default_value xsi:type="string">test_checkbox%isolation%</default_value> + </field> + <field name="is_active" is_required=""> + <default_value xsi:type="string">Enabled</default_value> + </field> + <field name="is_html" is_required=""> + <default_value xsi:type="string">Text</default_value> + </field> + <field name="stores" source="Magento\CheckoutAgreements\Test\Fixture\CheckoutAgreement\Stores"> + <default_value xsi:type="array"> <item name="dataSet" xsi:type="array"> <item name="0" xsi:type="string">default</item> </item> </default_value> - </field> - </fixture> + </field> + </fixture> </config> diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php index 54db2bc5d210582beb5800c2e8dc3d916a1b88da..ca9dbfda8de6e1691095841d3bdacccff1a0b7b7 100644 --- a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/DeleteTermEntityTest.php @@ -13,19 +13,15 @@ use Magento\Mtf\ObjectManager; use Magento\Mtf\TestCase\Injectable; /** - * Test creation for DeleteTermEntityTest. - * - * Test Flow: - * * Preconditions: - * 1. Enable "Terms and Conditions": Stores > Configuration > Sales > Checkout > Checkout Options - * 2. Create term according to dataSet + * 1. Enable "Terms and Conditions": Stores > Configuration > Sales > Checkout > Checkout Options. + * 2. Create term according to dataSet. * * Steps: - * 1. Open Backend Stores > Terms and Conditions - * 2. Open created Term from preconditions - * 3. Click on 'Delete' button - * 4. Perform all assertions + * 1. Open Backend Stores > Terms and Conditions. + * 2. Open created Term from preconditions. + * 3. Click on 'Delete' button. + * 4. Perform all assertions. * * @group Terms_and_Conditions_(CS) * @ZephyrId MAGETWO-29687 @@ -96,7 +92,7 @@ class DeleteTermEntityTest extends Injectable */ public function tearDown() { - ObjectManager::getInstance()->create( + $this->objectManager->create( 'Magento\Core\Test\TestStep\SetupConfigurationStep', ['configData' => 'checkout_term_condition', 'rollback' => true] )->run(); diff --git a/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..0c231f25d3f3fb674d3a1524cf354b5fa87a4a65 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest17"> + <data name="menuItem" xsi:type="string">Stores > Terms and Conditions</data> + <data name="pageTitle" xsi:type="string">Terms and Conditions</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/CmsGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/CmsGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..df52dfb3a70cb31a819d4cb0aa9f95248b82536e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/CmsGrid.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Block; + +use Magento\Backend\Test\Block\Widget\Grid; + +/** + * Adminhtml Cms Block management grid. + */ +class CmsGrid extends Grid +{ + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'title' => [ + 'selector' => '#title', + ], + 'identifier' => [ + 'selector' => '#identifier', + ], + 'is_active' => [ + 'selector' => '#is_active', + 'input' => 'select', + ], + 'creation_time_from' => [ + 'selector' => '(//span[.="Created"]/following::input[contains(@placeholder,"From")])[1]', + 'strategy' => 'xpath', + ], + 'update_time_from' => [ + 'selector' => '(//span[.="Created"]/following::input[contains(@placeholder,"From")])[2]', + 'strategy' => 'xpath', + ], + 'store_id' => [ + 'selector' => 'label[for="store_id"] + div > select', + 'input' => 'selectstore' + ], + ]; + + /** + * Locator value for 'Search' button. + * + * @var string + */ + protected $searchButton = '.action-apply'; + + /** + * Locator value for 'Reset' button. + * + * @var string + */ + protected $resetButton = '.action-reset'; + + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'td[data-part="body.row.cell"]'; +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/BlockForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/BlockForm.php new file mode 100644 index 0000000000000000000000000000000000000000..4a09e7545f775a262511d50e4ec82bb908264bce --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/BlockForm.php @@ -0,0 +1,85 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Block\Edit; + +use Magento\Mtf\Block\Form; +use Magento\Mtf\Client\Locator; +use Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config; + +/** + * Block adminhtml form. + */ +class BlockForm extends Form +{ + /** + * Content Editor toggle button id. + * + * @var string + */ + protected $toggleButton = "#toggleblock_content"; + + /** + * Content Editor form. + * + * @var string + */ + protected $contentForm = "#page_content"; + + /** + * Custom Variable block selector. + * + * @var string + */ + protected $customVariableBlock = "./ancestor::body//div[div[@id='variables-chooser']]"; + + /** + * Insert Variable button selector. + * + * @var string + */ + protected $addVariableButton = ".add-variable"; + + /** + * Clicking in content tab 'Insert Variable' button. + * + * @return void + */ + public function clickInsertVariable() + { + $addVariableButton = $this->_rootElement->find($this->addVariableButton); + if ($addVariableButton->isVisible()) { + $addVariableButton->click(); + } + } + + /** + * Get for wysiwyg config block. + * + * @return Config + */ + public function getWysiwygConfig() + { + return $this->blockFactory->create( + 'Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config', + ['element' => $this->_rootElement->find($this->customVariableBlock, Locator::SELECTOR_XPATH)] + ); + } + + /** + * Page Content Show/Hide Editor toggle button. + * + * @return void + */ + public function toggleEditor() + { + $content = $this->_rootElement->find($this->contentForm, Locator::SELECTOR_CSS); + $toggleButton = $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS); + if (!$content->isVisible() && $toggleButton->isVisible()) { + $toggleButton->click(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.php new file mode 100644 index 0000000000000000000000000000000000000000..2f8d8f341a9b518d5ccb654849ae8769dbbbfc45 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Block\Edit; + +use Magento\Mtf\Block\Form; +use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Form for Cms Block creation. + */ +class CmsForm extends Form +{ + /** + * Content Editor toggle button id. + * + * @var string + */ + protected $toggleButton = "#toggleblock_content"; + + /** + * CMS Block Content area. + * + * @var string + */ + protected $contentForm = '[name="content"]'; + + /** + * Fill the page form. + * + * @param FixtureInterface $fixture + * @param SimpleElement $element + * @return $this + */ + public function fill(FixtureInterface $fixture, SimpleElement $element = null) + { + $this->hideEditor(); + return parent::fill($fixture, $element); + } + + /** + * Hide WYSIWYG editor. + * + * @return void + */ + protected function hideEditor() + { + $content = $this->_rootElement->find($this->contentForm); + $toggleButton = $this->_rootElement->find($this->toggleButton); + if (!$content->isVisible() && $toggleButton->isVisible()) { + $toggleButton->click(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.xml new file mode 100644 index 0000000000000000000000000000000000000000..8fc957726181e63e455fe61ab2583d8335f2743d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Block/Edit/CmsForm.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <fields> + <stores> + <selector>[name="stores[]"]</selector> + <input>multiselectgrouplist</input> + </stores> + <is_active> + <input>select</input> + </is_active> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.php new file mode 100644 index 0000000000000000000000000000000000000000..5338aaaead06883ad68c7b8855d962ceff004772 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Page\Edit; + +use Magento\Backend\Test\Block\Widget\FormTabs; +use Magento\Mtf\Client\Locator; + +/** + * Backend Cms Page edit page. + */ +class PageForm extends FormTabs +{ + /** + * Content Editor toggle button id. + * + * @var string + */ + protected $toggleButton = "#togglepage_content"; + + /** + * Content Editor form. + * + * @var string + */ + protected $contentForm = "#page_content"; + + /** + * Page Content Show/Hide Editor toggle button. + * + * @return void + */ + protected function toggleEditor() + { + $content = $this->_rootElement->find($this->contentForm, Locator::SELECTOR_CSS); + $toggleButton = $this->_rootElement->find($this->toggleButton, Locator::SELECTOR_CSS); + if (!$content->isVisible() && $toggleButton->isVisible()) { + $toggleButton->click(); + } + } + + /** + * Returns array with System Variables. + * + * @return array + */ + public function getSystemVariables() + { + $this->openTab('content'); + /** @var \Magento\Cms\Test\Block\Adminhtml\Page\Edit\Tab\Content $contentTab */ + $contentTab = $this->getTabElement('content'); + /** @var \Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config $config */ + $contentTab->clickInsertVariable(); + $config = $contentTab->getWysiwygConfig(); + + return $config->getAllVariables(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml new file mode 100644 index 0000000000000000000000000000000000000000..454cd9e0f50c670138b2b32e5dfcc1a2b7478723 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/PageForm.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tabs> + <page_information> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#page_tabs_main_section</selector> + <strategy>css selector</strategy> + <fields> + <title /> + <identifier /> + <store_id> + <selector>[name='stores[]']</selector> + <input>multiselectgrouplist</input> + </store_id> + <is_active> + <input>select</input> + </is_active> + </fields> + </page_information> + <content> + <class>\Magento\Cms\Test\Block\Adminhtml\Page\Edit\Tab\Content</class> + <selector>#page_tabs_content_section</selector> + <strategy>css selector</strategy> + <fields> + <content_heading /> + <content /> + </fields> + </content> + <design> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#page_tabs_design_section</selector> + <strategy>css selector</strategy> + <fields> + <page_layout> + <input>select</input> + </page_layout> + <layout_update_xml> + <selector>#page_layout_update_xml</selector> + <input>textarea</input> + </layout_update_xml> + <custom_theme_from /> + <custom_theme_to /> + <custom_theme> + <input>select</input> + </custom_theme> + <custom_page_layout> + <input>select</input> + </custom_page_layout> + <custom_layout_update_xml> + <selector>#page_custom_layout_update_xml</selector> + <input>textarea</input> + </custom_layout_update_xml> + </fields> + </design> + <meta_data> + <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <selector>#page_tabs_meta_section</selector> + <strategy>css selector</strategy> + <fields> + <meta_keywords> + <selector>#page_meta_keywords</selector> + <input>textarea</input> + </meta_keywords> + <meta_description> + <selector>#page_meta_description</selector> + <input>textarea</input> + </meta_description> + </fields> + </meta_data> +</tabs> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php new file mode 100644 index 0000000000000000000000000000000000000000..5ac929cb9377036ea3900924081e2b996d95f44f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Page\Edit\Tab; + +use Magento\Mtf\Client\Locator; +use Magento\Backend\Test\Block\Widget\Tab; +use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Widget\Test\Block\Adminhtml\WidgetForm; +use Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config; + +/** + * Backend cms page content tab. + */ +class Content extends Tab +{ + /** + * System Variable block selector. + * + * @var string + */ + protected $systemVariableBlock = "./ancestor::body//div[div[@id='variables-chooser']]"; + + /** + * Widget block selector. + * + * @var string + */ + protected $widgetBlock = "./ancestor::body/div[div/div/*[@id='widget_options_form']]"; + + /** + * Insert Variable button selector. + * + * @var string + */ + protected $addVariableButton = ".add-variable"; + + /** + * Insert Widget button selector. + * + * @var string + */ + protected $addWidgetButton = '.action-add-widget'; + + /** + * Content input locator. + * + * @var string + */ + protected $content = '#page_content'; + + /** + * Content Heading input locator. + * + * @var string + */ + protected $contentHeading = '#page_content_heading'; + + /** + * Clicking in content tab 'Insert Variable' button. + * + * @return void + */ + public function clickInsertVariable() + { + $addVariableButton = $this->_rootElement->find($this->addVariableButton); + if ($addVariableButton->isVisible()) { + $addVariableButton->click(); + } + } + + /** + * Clicking in content tab 'Insert Widget' button. + * + * @return void + */ + public function clickInsertWidget() + { + $addWidgetButton = $this->_rootElement->find($this->addWidgetButton); + if ($addWidgetButton->isVisible()) { + $addWidgetButton->click(); + } + } + + /** + * Get for wysiwyg config block. + * + * @return Config + */ + public function getWysiwygConfig() + { + return $this->blockFactory->create( + 'Magento\Cms\Test\Block\Adminhtml\Wysiwyg\Config', + ['element' => $this->_rootElement->find($this->systemVariableBlock, Locator::SELECTOR_XPATH)] + ); + } + + /** + * Get widget block. + * + * @return WidgetForm + */ + public function getWidgetBlock() + { + return $this->blockFactory->create( + 'Magento\Widget\Test\Block\Adminhtml\WidgetForm', + ['element' => $this->_rootElement->find($this->widgetBlock, Locator::SELECTOR_XPATH)] + ); + } + + /** + * Fill data to content fields on content tab. + * + * @param array $fields + * @param SimpleElement|null $element + * @return $this + */ + public function fillFormTab(array $fields, SimpleElement $element = null) + { + $element->find($this->content)->setValue($fields['content']['value']['content']); + if (isset($fields['content_heading']['value'])) { + $element->find($this->contentHeading)->setValue($fields['content_heading']['value']); + } + if (isset($fields['content']['value']['widget']['preset'])) { + foreach ($fields['content']['value']['widget']['preset'] as $widget) { + $this->clickInsertWidget(); + $this->getWidgetBlock()->addWidget($widget); + } + } + if (isset($fields['content']['value']['variable'])) { + $this->clickInsertVariable(); + $config = $this->getWysiwygConfig(); + $config->selectVariableByName($fields['content']['value']['variable']); + } + + return $this; + } + + /** + * Get data of content tab. + * + * @param array|null $fields + * @param SimpleElement|null $element + * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getDataFormTab($fields = null, SimpleElement $element = null) + { + return [ + 'content' => [], + 'content_heading' => '' + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php new file mode 100644 index 0000000000000000000000000000000000000000..b58dfde4c16cb99902cfcb46a600a58cb00436b3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Grid.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Page; + +use Magento\Backend\Test\Block\Widget\Grid as ParentGrid; +use Magento\Mtf\Client\Locator; + +/** + * Backend Cms Page grid. + */ +class Grid extends ParentGrid +{ + /** + * Locator value for 'Search' button. + * + * @var string + */ + protected $searchButton = '.action.primary.action-apply'; + + /** + * Locator value for 'Reset' button. + * + * @var string + */ + protected $resetButton = '.action.secondary.action-reset'; + + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'td[data-part="body.row.cell"]'; + + /** + * 'Preview' cms page link. + * + * @var string + */ + protected $previewCmsPage = "//a[contains(text(),'Preview')]"; + + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'title' => [ + 'selector' => '#title', + ], + ]; + + /** + * Search item and open it on front. + * + * @param array $filter + * @throws \Exception + * @return void + */ + public function searchAndPreview(array $filter) + { + $this->search($filter); + $rowItem = $this->_rootElement->find($this->rowItem); + if ($rowItem->isVisible()) { + $rowItem->find($this->previewCmsPage, Locator::SELECTOR_XPATH)->click(); + $this->waitForElement(); + } else { + throw new \Exception('Searched item was not found.'); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Widget/Chooser.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Widget/Chooser.php new file mode 100644 index 0000000000000000000000000000000000000000..a71f9e953f8572ab4656a9933b02645c8d94a046 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Widget/Chooser.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Page\Widget; + +use Magento\Backend\Test\Block\Widget\Grid; + +/** + * Backend select page, block grid. + */ +class Chooser extends Grid +{ + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'chooser_identifier' => [ + 'selector' => 'input[name="chooser_identifier"]', + ], + ]; + + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'tbody tr .col-chooser_title'; +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Wysiwyg/Config.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Wysiwyg/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..8b73955af229821883991699a89f06402d75c51c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Wysiwyg/Config.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Block\Adminhtml\Wysiwyg; + +use Magento\Mtf\Block\Block; +use Magento\Mtf\Client\Locator; + +/** + * System variable management block. + */ +class Config extends Block +{ + /** + * Selector for getting all variables in list. + * + * @var string + */ + protected $variablesSelector = '.insert-variable > li > a'; + + /** + * Variable link selector. + * + * @var string + */ + protected $variableSelector = '//*[@class="insert-variable"]//a[contains(text(),"%s")]'; + + /** + * Returns array with all variables. + * + * @return array + */ + public function getAllVariables() + { + $values = []; + + $variableElements = $this->_rootElement->getElements($this->variablesSelector); + foreach ($variableElements as $variableElement) { + if ($variableElement->isVisible()) { + $values[] = $variableElement->getText(); + } + } + + return $values; + } + + /** + * Select variable by name. + * + * @param string $variableName + * @return void + */ + public function selectVariableByName($variableName) + { + $this->_rootElement->find(sprintf($this->variableSelector, $variableName), Locator::SELECTOR_XPATH)->click(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php index 7589ec398662e55982db8ce5be48bcccf0bf4d00..69b0d9aa409c6dc333e8a919980f37aefa86831c 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Page.php @@ -14,6 +14,13 @@ use Magento\Mtf\Client\Locator; */ class Page extends Block { + /** + * Selector for uninitialized page. + * + * @var string + */ + protected $uninitialized = '//body[(@data-mage-init) or (@aria-busy="true")]'; + /** * Cms page content class. * @@ -107,4 +114,21 @@ class Page extends Block throw new \Exception('Determine how to find the widget on the page.'); } } + + /** + * Waiting page initialization. + * + * @return void + */ + public function waitPageInit() + { + $browser = $this->browser; + $uninitialized = $this->uninitialized; + + $this->_rootElement->waitUntil( + function () use ($browser, $uninitialized) { + return $browser->find($uninitialized, Locator::SELECTOR_XPATH)->isVisible() == false ? true : null; + } + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockDeleteMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..36d25d1c49f55d3c81f424354a9fd9ea31804cfe --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockDeleteMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that after delete CMS block successful message appears. + */ +class AssertCmsBlockDeleteMessage extends AbstractConstraint +{ + const SUCCESS_DELETE_MESSAGE = 'The block has been deleted.'; + + /** + * Assert that after delete CMS block successful message appears. + * + * @param CmsBlockIndex $cmsBlockIndex + * @return void + */ + public function processAssert(CmsBlockIndex $cmsBlockIndex) + { + $actualMessage = $cmsBlockIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_DELETE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_DELETE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block success delete message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockInGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..539882b47a497c8e633534324b0cc4c646d6e366 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockInGrid.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS block can be found in grid. + */ +class AssertCmsBlockInGrid extends AbstractConstraint +{ + /** + * Assert that created CMS block can be found in grid via: + * title, identifier, store view, status, created and modified date. + * + * @param CmsBlock $cmsBlock + * @param CmsBlockIndex $cmsBlockIndex + * @return void + * + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function processAssert(CmsBlock $cmsBlock, CmsBlockIndex $cmsBlockIndex) + { + $cmsBlockIndex->open(); + $data = $cmsBlock->getData(); + $filter = [ + 'title' => $data['title'], + 'identifier' => $data['identifier'], + 'is_active' => $data['is_active'], + ]; + + if (isset($data['stores'])) { + $filter['store_id'] = is_array($data['stores']) ? reset($data['stores']) : $data['stores']; + } + // add creation_time & update_time to filter if there are ones + if (isset($data['creation_time'])) { + $filter['creation_time_from'] = date("M j, Y", strtotime($cmsBlock->getCreationTime())); + } + if (isset($data['update_time'])) { + $filter['update_time_from'] = date("M j, Y", strtotime($cmsBlock->getUpdateTime())); + } + + $cmsBlockIndex->getCmsBlockGrid()->search($filter); + + if (isset($filter['store_id'])) { + $pieces = explode('/', $filter['store_id']); + $filter['store_id'] = end($pieces); + } + \PHPUnit_Framework_Assert::assertTrue( + $cmsBlockIndex->getCmsBlockGrid()->isRowVisible($filter, false, false), + 'CMS Block with ' + . 'title \'' . $filter['title'] . '\', ' + . 'identifier \'' . $filter['identifier'] . '\', ' + . 'store view \'' . $filter['store_id'] . '\', ' + . 'status \'' . $filter['is_active'] . '\', ' + . (isset($filter['creation_time_from']) + ? ('creation_time \'' . $filter['creation_time_from'] . '\', ') + : '') + . (isset($filter['update_time_from']) ? ('update_time \'' . $filter['update_time_from'] . '\'') : '') + . 'is absent in CMS Block grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block is present in grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotInGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..ad3ce5daef521523e6e439da296394955d995c81 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotInGrid.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS block can't be found in grid. + */ +class AssertCmsBlockNotInGrid extends AbstractConstraint +{ + /** + * Assert that created CMS block can't be found in grid via: + * title, identifier, store view, status, created and modified date + * + * @param CmsBlock $cmsBlock + * @param CmsBlockIndex $cmsBlockIndex + * @return void + * + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function processAssert(CmsBlock $cmsBlock, CmsBlockIndex $cmsBlockIndex) + { + $cmsBlockIndex->open(); + $data = $cmsBlock->getData(); + if (isset($data['stores'])) { + $storeId = is_array($data['stores']) ? reset($data['stores']) : $data['stores']; + $parts = explode("/", $storeId); + } + + $filter = [ + 'title' => $data['title'], + 'identifier' => $data['identifier'], + 'is_active' => $data['is_active'], + 'store_id' => end($parts), + ]; + + // add creation_time & update_time to filter if there are ones + if (isset($data['creation_time'])) { + $filter['creation_time_from'] = date("M j, Y", strtotime($cmsBlock->getCreationTime())); + } + if (isset($data['update_time'])) { + $filter['update_time_from'] = date("M j, Y", strtotime($cmsBlock->getUpdateTime())); + } + + \PHPUnit_Framework_Assert::assertFalse( + $cmsBlockIndex->getCmsBlockGrid()->isRowVisible($filter, true, false), + 'CMS Block with ' + . 'title \'' . $filter['title'] . '\', ' + . 'identifier \'' . $filter['identifier'] . '\', ' + . 'store view \'' . $filter['store_id'] . '\', ' + . 'status \'' . $filter['is_active'] . '\', ' + . (isset($filter['creation_time_from']) + ? ('creation_time \'' . $filter['creation_time_from'] . '\', ') + : '') + . (isset($filter['update_time_from']) ? ('update_time \'' . $filter['update_time_from'] . '\'') : '') + . 'exists in CMS Block grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block is not present in grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotOnCategoryPage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotOnCategoryPage.php new file mode 100644 index 0000000000000000000000000000000000000000..96eeb2aa0d04f542ba991d9161180911681b7cd6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockNotOnCategoryPage.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\FixtureFactory; + +/** + * Assert that created CMS block non visible on frontend category page. + */ +class AssertCmsBlockNotOnCategoryPage extends AbstractConstraint +{ + /** + * Assert that created CMS block non visible on frontend category page + * (in order to assign block to category: go to category page> Display settings> CMS Block) + * + * @param CmsIndex $cmsIndex + * @param CmsBlock $cmsBlock + * @param CatalogCategoryView $catalogCategoryView + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CmsBlock $cmsBlock, + CatalogCategoryView $catalogCategoryView, + FixtureFactory $fixtureFactory + ) { + $category = $fixtureFactory->createByCode( + 'category', + [ + 'dataSet' => 'default_subcategory', + 'data' => [ + 'display_mode' => 'Static block and products', + 'landing_page' => $cmsBlock->getTitle(), + ] + ] + ); + $category->persist(); + + $cmsIndex->open(); + $cmsIndex->getTopmenu()->selectCategoryByName($category->getName()); + $categoryViewContent = $catalogCategoryView->getViewBlock()->getContent(); + + \PHPUnit_Framework_Assert::assertNotEquals( + $cmsBlock->getContent(), + $categoryViewContent, + 'Wrong block content on category is displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS block description is absent on Category page (frontend).'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockOnCategoryPage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockOnCategoryPage.php new file mode 100644 index 0000000000000000000000000000000000000000..2cc8650a1f924523c0c5c22dd4966f2bad642ccc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockOnCategoryPage.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Mtf\Fixture\FixtureFactory; + +/** + * Assert that created CMS block displayed on frontend category page. + */ +class AssertCmsBlockOnCategoryPage extends AbstractConstraint +{ + /** + * Assert that created CMS block displayed on frontend category page (in order to assign block to category: + * go to category page> Display settings> CMS Block). + * + * @param CmsIndex $cmsIndex + * @param CmsBlock $cmsBlock + * @param CatalogCategoryView $catalogCategoryView + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + CmsBlock $cmsBlock, + CatalogCategoryView $catalogCategoryView, + FixtureFactory $fixtureFactory + ) { + $category = $fixtureFactory->createByCode( + 'category', + [ + 'dataSet' => 'default_subcategory', + 'data' => [ + 'display_mode' => 'Static block and products', + 'landing_page' => $cmsBlock->getTitle(), + ] + ] + ); + $category->persist(); + + $cmsIndex->open(); + $cmsIndex->getTopmenu()->selectCategoryByName($category->getName()); + $categoryViewContent = $catalogCategoryView->getViewBlock()->getContent(); + + \PHPUnit_Framework_Assert::assertEquals( + $cmsBlock->getContent(), + $categoryViewContent, + 'Wrong block content on category is displayed.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS block description is present on Category page (frontend).'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockSuccessSaveMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..615c4b06fb44ada65c869600fe41a1136dac543a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsBlockSuccessSaveMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that after save block successful message appears. + */ +class AssertCmsBlockSuccessSaveMessage extends AbstractConstraint +{ + const SUCCESS_SAVE_MESSAGE = 'The block has been saved.'; + + /** + * Assert that after save block successful message appears. + * + * @param CmsBlockIndex $cmsBlockIndex + * @return void + */ + public function processAssert(CmsBlockIndex $cmsBlockIndex) + { + $actualMessage = $cmsBlockIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_SAVE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_SAVE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Block success create message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDeleteMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDeleteMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..ff01fa41f99e1990308af033ed5ba5b4c94d5ae9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDeleteMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert success delete message. + */ +class AssertCmsPageDeleteMessage extends AbstractConstraint +{ + const SUCCESS_DELETE_MESSAGE = 'The page has been deleted.'; + + /** + * Assert that success message is displayed after Cms page delete. + * + * @param CmsPageIndex $cmsIndex + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex) + { + $actualMessage = $cmsIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_DELETE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_DELETE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cms page success delete message is present.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDisabledOnFrontend.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDisabledOnFrontend.php new file mode 100644 index 0000000000000000000000000000000000000000..98d8fbaecd074c6f2d05e82556dcc9185d97b16f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDisabledOnFrontend.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\CmsIndex as FrontCmsIndex; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS page with 'Status' - Disabled displays with '404 Not Found' message on Frontend. + */ +class AssertCmsPageDisabledOnFrontend extends AbstractConstraint +{ + const NOT_FOUND_MESSAGE = 'Whoops, our bad...'; + + /** + * Assert that created CMS page with 'Status' - Disabled displays with '404 Not Found' message on Frontend. + * + * @param CmsPage $cms + * @param FrontCmsIndex $frontCmsIndex + * @param CmsPageIndex $cmsIndex + * @param BrowserInterface $browser + * @return void + */ + public function processAssert( + CmsPage $cms, + FrontCmsIndex $frontCmsIndex, + CmsPageIndex $cmsIndex, + BrowserInterface $browser + ) { + $cmsIndex->open(); + $filter = ['title' => $cms->getTitle()]; + $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); + $browser->selectWindow(); + \PHPUnit_Framework_Assert::assertEquals( + self::NOT_FOUND_MESSAGE, + $frontCmsIndex->getTitleBlock()->getTitle(), + 'Wrong page is displayed.' + ); + } + + /** + * Not found page is display. + * + * @return string + */ + public function toString() + { + return 'Not found page is display.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDuplicateErrorMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDuplicateErrorMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..97e5247f658a8ce1d47dd5fdd62aaffb5b14ad9c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageDuplicateErrorMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Verify that page has not been created. + */ +class AssertCmsPageDuplicateErrorMessage extends AbstractConstraint +{ + const ERROR_SAVE_MESSAGE = 'A page URL key for specified store already exists.'; + + /** + * Verify that page has not been created. + * + * @param CmsPageIndex $cmsIndex + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex) + { + $message = $cmsIndex->getMessagesBlock()->getErrorMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::ERROR_SAVE_MESSAGE, + $message, + 'Wrong error message is displayed.' + . "\nExpected: " . self::ERROR_SAVE_MESSAGE + . "\nActual: " . $message + ); + } + + /** + * Page with duplicated identifier has not been created. + * + * @return string + */ + public function toString() + { + return 'Assert that page with duplicated identifier has not been created.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageForm.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageForm.php new file mode 100644 index 0000000000000000000000000000000000000000..7edf213e1d2081acfa7511f8ad3cce5ceebff006 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageForm.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\Constraint\AbstractAssertForm; + +/** + * Assert that displayed CMS page data on edit page equals passed from fixture. + */ +class AssertCmsPageForm extends AbstractAssertForm +{ + /** + * Skipped fields for verify data. + * + * @var array + */ + protected $skippedFields = [ + 'page_id', + 'content', + 'content_heading', + 'custom_theme_from', + 'custom_theme_to', + ]; + + /** + * Assert that displayed CMS page data on edit page equals passed from fixture. + * + * @param CmsPage $cms + * @param CmsPageIndex $cmsIndex + * @param CmsPageNew $cmsPageNew + * @return void + */ + public function processAssert( + CmsPage $cms, + CmsPageIndex $cmsIndex, + CmsPageNew $cmsPageNew + ) { + $cmsIndex->open(); + $filter = ['title' => $cms->getTitle()]; + $cmsIndex->getCmsPageGridBlock()->searchAndOpen($filter); + + $cmsFormData = $cmsPageNew->getPageForm()->getData($cms); + $cmsFormData['store_id'] = implode('/', $cmsFormData['store_id']); + $errors = $this->verifyData($cms->getData(), $cmsFormData); + \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); + } + + /** + * CMS page data on edit page equals data from fixture. + * + * @return string + */ + public function toString() + { + return 'CMS page data on edit page equals data from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageInGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..650151b1db998f61fb49134db73d85aca69668d0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageInGrid.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that CMS page present in grid and can be found by title. + */ +class AssertCmsPageInGrid extends AbstractConstraint +{ + /** + * Assert that cms page is present in pages grid. + * + * @param CmsPageIndex $cmsIndex + * @param CmsPage $cms + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cms) + { + $filter = [ + 'title' => $cms->getTitle(), + ]; + $cmsIndex->open(); + \PHPUnit_Framework_Assert::assertTrue( + $cmsIndex->getCmsPageGridBlock()->isRowVisible($filter, true, false), + 'Cms page \'' . $cms->getTitle() . '\' is not present in pages grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cms page is present in pages grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageNotInGrid.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageNotInGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..f781faec06d96c468e064ad12fa0326850093565 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageNotInGrid.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert Cms page is absent in grid. + */ +class AssertCmsPageNotInGrid extends AbstractConstraint +{ + /** + * Assert that Cms page is not present in pages grid. + * + * @param CmsPageIndex $cmsIndex + * @param CmsPage $cmsPage + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex, CmsPage $cmsPage) + { + $filter = [ + 'title' => $cmsPage->getTitle(), + ]; + \PHPUnit_Framework_Assert::assertFalse( + $cmsIndex->getCmsPageGridBlock()->isRowVisible($filter), + 'Cms page \'' . $cmsPage->getTitle() . '\' is present in pages grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cms page is not present in pages grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPagePreview.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPagePreview.php new file mode 100644 index 0000000000000000000000000000000000000000..2f8203b640e6c883490f3391b79593e4d5dfcfe6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPagePreview.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\CmsIndex as FrontCmsIndex; +use Magento\Cms\Test\Page\CmsPage as FrontCmsPage; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that content of created cms page displayed in section 'maincontent' and equals passed from fixture. + */ +class AssertCmsPagePreview extends AbstractConstraint +{ + /* tags */ + const SEVERITY = 'low'; + /* end tags */ + + /** + * Assert that content of created cms page displayed in section 'maincontent' and equals passed from fixture. + * + * @param CmsPageIndex $cmsIndex + * @param FrontCmsIndex $frontCmsIndex + * @param FrontCmsPage $frontCmsPage + * @param CmsPage $cms + * @param BrowserInterface $browser + * @return void + */ + public function processAssert( + CmsPageIndex $cmsIndex, + FrontCmsIndex $frontCmsIndex, + FrontCmsPage $frontCmsPage, + CmsPage $cms, + BrowserInterface $browser + ) { + $cmsIndex->open(); + $filter = ['title' => $cms->getTitle()]; + $cmsIndex->getCmsPageGridBlock()->searchAndPreview($filter); + $browser->selectWindow(); + + $fixtureContent = $cms->getContent(); + \PHPUnit_Framework_Assert::assertContains( + $fixtureContent['content'], + $frontCmsPage->getCmsPageBlock()->getPageContent(), + 'Wrong content is displayed.' + ); + if (isset($fixtureContent['widget'])) { + foreach ($fixtureContent['widget']['preset'] as $widget) { + \PHPUnit_Framework_Assert::assertTrue( + $frontCmsPage->getCmsPageBlock()->isWidgetVisible($widget['widget_type'], $widget['anchor_text']), + 'Widget \'' . $widget['widget_type'] . '\' is not displayed.' + ); + } + } + if ($cms->getContentHeading()) { + \PHPUnit_Framework_Assert::assertEquals( + $cms->getContentHeading(), + $frontCmsIndex->getTitleBlock()->getTitle(), + 'Wrong title is displayed.' + ); + } + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'CMS Page content equals to data from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageSuccessSaveMessage.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageSuccessSaveMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..e047e5de15ac053c5bf948526f1ac2b317c7e729 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertCmsPageSuccessSaveMessage.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that after save a CMS page "The page has been saved." successful message appears. + */ +class AssertCmsPageSuccessSaveMessage extends AbstractConstraint +{ + const SUCCESS_SAVE_MESSAGE = 'The page has been saved.'; + + /** + * Assert that after save a CMS page "The page has been saved." successful message appears. + * + * @param CmsPageIndex $cmsIndex + * @return void + */ + public function processAssert(CmsPageIndex $cmsIndex) + { + $actualMessage = $cmsIndex->getMessagesBlock()->getSuccessMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::SUCCESS_SAVE_MESSAGE, + $actualMessage, + 'Wrong success message is displayed.' + . "\nExpected: " . self::SUCCESS_SAVE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Success message is displayed. + * + * @return string + */ + public function toString() + { + return 'Success message is displayed.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php new file mode 100644 index 0000000000000000000000000000000000000000..b237391de42379212caacd1d1a051be9faa0541f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Constraint/AssertUrlRewriteCmsPageRedirect.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Constraint; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\Core\Test\Page\Adminhtml\SystemVariableNew; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that created CMS Page URL Rewrite lead to appropriate page in frontend. + */ +class AssertUrlRewriteCmsPageRedirect extends AbstractConstraint +{ + /** + * Assert that created CMS Page URL Rewrite lead to appropriate page in frontend. + * + * @param UrlRewrite $urlRewrite + * @param CmsPage $cmsPage + * @param SystemVariableNew $systemVariableNew + * @param BrowserInterface $browser + * @return void + */ + public function processAssert( + UrlRewrite $urlRewrite, + CmsPage $cmsPage, + SystemVariableNew $systemVariableNew, + BrowserInterface $browser + ) { + $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath()); + if ($urlRewrite->hasData('store_id')) { + $store = explode('/', $urlRewrite->getStoreId()); + $systemVariableNew->getFormPageActions()->selectStoreView($store[2]); + } + $url = $urlRewrite->getRedirectType() == 'No' + ? $urlRewrite->getRequestPath() + : $cmsPage->getTitle(); + + \PHPUnit_Framework_Assert::assertEquals( + $_ENV['app_frontend_url'] . $url, + $browser->getUrl(), + 'URL rewrite CMS Page redirect false.' + ); + } + + /** + * URL Rewrite lead to appropriate page in frontend. + * + * @return string + */ + public function toString() + { + return 'URL Rewrite lead to appropriate page in frontend.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock.xml new file mode 100644 index 0000000000000000000000000000000000000000..36bb9cf39af0421b3a0bc9e6e25115cb312ad55e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="cmsBlock" module="Magento_Cms" type="flat" entity_type="cms_block" collection="Magento\Cms\Model\Resource\Block\Grid\Collection" identifier="identifier" + handler_interface="Magento\Cms\Test\Handler\CmsBlock\CmsBlockInterface" class="Magento\Cms\Test\Fixture\CmsBlock"> + <dataset name="default"> + <field name="title" xsi:type="string">block_%isolation%</field> + <field name="identifier" xsi:type="string">identifier_%isolation%</field> + <field name="stores" xsi:type="array"> + <item name="dataSet" xsi:type="string">All Store Views</item> + </field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="string">description_%isolation%</field> + </dataset> + <field name="block_id" is_required="1"> + <default_value xsi:type="null" /> + </field> + <field name="title" is_required=""> + <default_value xsi:type="string">block_%isolation%</default_value> + </field> + <field name="identifier" is_required=""> + <default_value xsi:type="string">identifier_%isolation%</default_value> + </field> + <field name="content" is_required=""> + <default_value xsi:type="string">description_%isolation%</default_value> + </field> + <field name="creation_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="update_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="is_active" is_required=""> + <default_value xsi:type="string">Enabled</default_value> + </field> + <field name="stores" is_required="1" source="Magento\Cms\Test\Fixture\CmsBlock\Stores"> + <default_value xsi:type="array"> + <item name="dataSet" xsi:type="array"> + <item name="0" xsi:type="string">All Store Views</item> + </item> + </default_value> + </field> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock/Stores.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock/Stores.php new file mode 100644 index 0000000000000000000000000000000000000000..4622537127e7ff531f67dbe09b1a06a5f4a59669 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsBlock/Stores.php @@ -0,0 +1,110 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Fixture\CmsBlock; + +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Data source for 'stores' field. + * + * Data keys: + * - dataSet + */ +class Stores implements FixtureInterface +{ + /** + * Array with store names. + * + * @var array + */ + protected $data = []; + + /** + * Array with store fixtures. + * + * @var array + */ + protected $stores; + + /** + * Data set configuration settings. + * + * @var array + */ + protected $params; + + /** + * Create custom Store if we have block with custom store view. + * + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $params + * @param array $data [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->params = $params; + if (isset($data['dataSet'])) { + $dataSets = is_array($data['dataSet']) ? $data['dataSet'] : [$data['dataSet']]; + foreach ($dataSets as $dataSet) { + /** @var \Magento\Store\Test\Fixture\Store $store */ + $store = $fixtureFactory->createByCode('store', ['dataSet' => $dataSet]); + if (!$store->hasData('store_id')) { + $store->persist(); + } + $this->stores[] = $store; + $this->data[] = $store->getName() == 'All Store Views' + ? $store->getName() + : $store->getGroupId() . '/' . $store->getName(); + } + } + } + + /** + * Persist custom selections store view. + * + * @return void + */ + public function persist() + { + // + } + + /** + * Return prepared data set. + * + * @param string|null $key [optional] + * @return array + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getData($key = null) + { + return $this->data; + } + + /** + * Return stores. + * + * @return array + */ + public function getStores() + { + return $this->stores; + } + + /** + * Return data set configuration settings. + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage.xml new file mode 100644 index 0000000000000000000000000000000000000000..149bef091c83163e09710dbaa2cd7f4bc6930058 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="cmsPage" module="Magento_Cms" type="flat" entity_type="cms_page" collection="Magento\Cms\Model\Resource\Page\Grid\Collection" identifier="identifier" + repository_class="Magento\Cms\Test\Repository\CmsPage" handler_interface="Magento\Cms\Test\Handler\CmsPage\CmsPageInterface" class="Magento\Cms\Test\Fixture\CmsPage"> + <dataset name="default"> + <field name="title" xsi:type="string">CMS Page%isolation%</field> + <field name="identifier" xsi:type="string">identifier%isolation%</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_actice" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">description_%isolation%</item> + </field> + </dataset> + <field name="page_id" is_required="1"> + <default_value xsi:type="null" /> + </field> + <field name="title" is_required="" group="page_information"> + <default_value xsi:type="null" /> + </field> + <field name="is_active" is_required="" group="page_information"> + <default_value xsi:type="string">Enabled</default_value> + </field> + <field name="page_layout" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="meta_keywords" is_required="" group="meta_data"> + <default_value xsi:type="null" /> + </field> + <field name="meta_description" is_required="" group="meta_data"> + <default_value xsi:type="null" /> + </field> + <field name="identifier" group="page_information" is_required=""> + <default_value xsi:type="string">identifier%isolation%</default_value> + </field> + <field name="content_heading" is_required="" group="content"> + <default_value xsi:type="null" /> + </field> + <field name="content" is_required="" group="content" source="Magento\Cms\Test\Fixture\CmsPage\Content"> + <default_value xsi:type="array"> + <item name="content" xsi:type="string">Text %isolation%</item> + </default_value> + </field> + <field name="creation_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="update_time" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="sort_order" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="layout_update_xml" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_theme" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_page_layout" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_layout_update_xml" is_required=""> + <default_value xsi:type="null" /> + </field> + <field name="custom_theme_from" source="Magento\Backend\Test\Fixture\Source\Date" /> + <field name="custom_theme_to" source="Magento\Backend\Test\Fixture\Source\Date" /> + <field name="website_root" is_required=""> + <default_value xsi:type="string">1</default_value> + </field> + <field name="store_id" is_required="1" group="page_information"> + <default_value xsi:type="string">All Store Views</default_value> + </field> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php new file mode 100644 index 0000000000000000000000000000000000000000..fc3d5f72bf9c2dfe34c7b78f9524223d8eb59698 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php @@ -0,0 +1,250 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\Fixture\CmsPage; + +use Magento\Catalog\Test\Fixture\Category; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\FixtureInterface; + +/** + * Prepare content for cms page. + */ +class Content implements FixtureInterface +{ + /** + * Content data. + * + * @var array + */ + protected $data = []; + + /** + * Fixture params. + * + * @var array + */ + protected $params; + + /** + * Fixture factory. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * @constructor + * @param array $params + * @param array $data + * @param FixtureFactory $fixtureFactory + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->fixtureFactory = $fixtureFactory; + $this->params = $params; + $this->data = $data; + if (isset($data['widget']['preset'])) { + $this->data['widget']['preset'] = $this->getPreset($data['widget']['preset']); + foreach ($this->data['widget']['preset'] as $key => $widget) { + if (isset($widget['chosen_option']['category_path']) + && !isset($widget['chosen_option']['filter_sku']) + ) { + $category = $this->createCategory($widget); + $categoryName = $category->getData('name'); + $this->data['widget']['preset'][$key]['chosen_option']['category_path'] = $categoryName; + } + if (isset($widget['chosen_option']['category_path']) && isset($widget['chosen_option']['filter_sku'])) { + $product = $this->createProduct($widget); + $categoryName = $product->getCategoryIds()[0]['name']; + $productSku = $product->getData('sku'); + $this->data['widget']['preset'][$key]['chosen_option']['category_path'] = $categoryName; + $this->data['widget']['preset'][$key]['chosen_option']['filter_sku'] = $productSku; + } + if ($widget['widget_type'] == 'Catalog New Products List') { + $this->createProduct(); + } + if ($widget['widget_type'] == 'CMS Static Block') { + $block = $this->createBlock($widget); + $blockIdentifier = $block->getIdentifier(); + $this->data['widget']['preset'][$key]['chosen_option']['filter_identifier'] = $blockIdentifier; + } + } + } + } + + /** + * Create category. + * + * @param array $widget + * @return Category + */ + protected function createCategory($widget) + { + /** @var Category $category */ + $category = $this->fixtureFactory->createByCode( + 'category', + ['dataSet' => $widget['chosen_option']['category_path']] + ); + if (!$category->hasData('id')) { + $category->persist(); + } + + return $category; + } + + /** + * Create product. + * + * @param array|null $widget [optional] + * @return CatalogProductSimple + */ + protected function createProduct($widget = null) + { + $dataSet = $widget === null ? 'default' : $widget['chosen_option']['category_path']; + /** @var CatalogProductSimple $product */ + $product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => $dataSet]); + if (!$product->hasData('id')) { + $product->persist(); + } + + return $product; + } + + /** + * Create block. + * + * @param array $widget + * @return CmsBlock + */ + protected function createBlock($widget) + { + /** @var CmsBlock $block */ + $block = $this->fixtureFactory->createByCode($widget['chosen_option']['filter_identifier']); + if (!$block->hasData('block_id')) { + $block->persist(); + } + + return $block; + } + + /** + * Persist attribute options. + * + * @return void + */ + public function persist() + { + // + } + + /** + * Return prepared data set. + * + * @param string|null $key + * @return mixed + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getData($key = null) + { + return $this->data; + } + + /** + * Return data set configuration settings. + * + * @return array + */ + public function getDataConfig() + { + return $this->params; + } + + /** + * Preset for Widgets. + * + * @param string $name + * @return array|null + */ + protected function getPreset($name) + { + $presets = [ + 'default' => [ + 'widget_1' => [ + 'widget_type' => 'CMS Page Link', + 'anchor_text' => 'CMS Page Link anchor_text_%isolation%', + 'title' => 'CMS Page Link anchor_title_%isolation%', + 'template' => 'CMS Page Link Block Template', + 'chosen_option' => [ + 'filter_url_key' => 'home', + ], + ], + ], + 'all_widgets' => [ + 'widget_1' => [ + 'widget_type' => 'CMS Page Link', + 'anchor_text' => 'CMS Page Link anchor_text_%isolation%', + 'title' => 'CMS Page Link anchor_title_%isolation%', + 'template' => 'CMS Page Link Block Template', + 'chosen_option' => [ + 'filter_url_key' => 'home', + ], + ], + 'widget_2' => [ + 'widget_type' => 'CMS Static Block', + 'template' => 'CMS Static Block Default Template', + 'chosen_option' => [ + 'filter_identifier' => 'cmsBlock', + ], + ], + 'widget_3' => [ + 'widget_type' => 'Catalog Category Link', + 'anchor_text' => 'Catalog Category Link anchor_text_%isolation%', + 'title' => 'Catalog Category Link anchor_title_%isolation%', + 'template' => 'Category Link Block Template', + 'chosen_option' => [ + 'category_path' => 'default_subcategory', + ], + ], + 'widget_4' => [ + 'widget_type' => 'Catalog New Products List', + 'display_type' => 'All products', + 'show_pager' => 'Yes', + 'products_count' => 10, + 'template' => 'New Products Grid Template', + 'cache_lifetime' => 86400, + ], + 'widget_5' => [ + 'widget_type' => 'Catalog Product Link', + 'anchor_text' => 'Catalog Product Link anchor_text_%isolation%', + 'title' => 'Catalog Product Link anchor_title_%isolation%', + 'template' => 'Product Link Block Template', + 'chosen_option' => [ + 'category_path' => 'product_with_category', + 'filter_sku' => 'product_with_category', + ], + ], + 'widget_6' => [ + 'widget_type' => 'Recently Compared Products', + 'page_size' => 10, + 'template' => 'Compared Products Grid Template', + ], + 'widget_7' => [ + 'widget_type' => 'Recently Viewed Products', + 'page_size' => 10, + 'template' => 'Viewed Products Grid Template', + ], + ], + ]; + if (!isset($presets[$name])) { + return null; + } + return $presets[$name]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php index 7e76b450a61a2bca890ce5efad101e2478f3f4b0..c3aefd941fc29abf6f5b823497131213d235f6ed 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsBlock/Curl.php @@ -14,20 +14,19 @@ use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Curl handler for creating CMS Block + * Curl handler for creating CMS Block. */ class Curl extends AbstractCurl implements CmsBlockInterface { /** - * Url for saving data + * Url for saving data. * * @var string */ protected $saveUrl = 'cms/block/save/back/edit'; /** - * Mapping values for data + * Mapping values for data. * * @var array */ @@ -39,7 +38,7 @@ class Curl extends AbstractCurl implements CmsBlockInterface ]; /** - * Mapping values for Stores + * Mapping values for Stores. * * @var array */ @@ -48,7 +47,7 @@ class Curl extends AbstractCurl implements CmsBlockInterface ]; /** - * POST request for creating CMS Block + * POST request for creating CMS Block. * * @param FixtureInterface|null $fixture [optional] * @return array @@ -73,7 +72,7 @@ class Curl extends AbstractCurl implements CmsBlockInterface } /** - * Prepare data from text to values + * Prepare data from text to values. * * @param FixtureInterface $fixture * @return array diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php index 6e1f9504703022c968d3736dd421841f90881c3f..4187350d28d7aead4044c949f745be6968cf1a17 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Handler/CmsPage/Curl.php @@ -14,8 +14,7 @@ use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Curl handler for creating Cms page + * Curl handler for creating Cms page. */ class Curl extends Conditions implements CmsPageInterface { @@ -26,7 +25,7 @@ class Curl extends Conditions implements CmsPageInterface */ protected $mappingData = [ 'is_active' => [ - 'Published' => 1, + 'Enabled' => 1, 'Disabled' => 0, ], 'store_id' => [ @@ -37,22 +36,35 @@ class Curl extends Conditions implements CmsPageInterface '2 columns with left bar' => '2columns-left', '2 columns with right bar' => '2columns-right', '3 columns' => '3columns', - ], - 'under_version_control' => [ - 'Yes' => 1, - 'No' => 0, - ], + ] ]; /** - * Url for save cms page + * Url for save cms page. * * @var string */ - protected $url = 'admin/cms_page/save/back/edit/active_tab/main_section/'; + protected $url = 'cms/page/save/back/edit/active_tab/main_section/'; + + /** + * Mapping values for data. + * + * @var array + */ + protected $additionalMappingData = []; + + /** + * @constructor + * @param Config $configuration + */ + public function __construct(Config $configuration) + { + $this->mappingData = array_merge($this->mappingData, $this->additionalMappingData); + parent::__construct($configuration); + } /** - * Post request for creating a cms page + * Post request for creating a cms page. * * @param FixtureInterface $fixture * @return array @@ -77,7 +89,7 @@ class Curl extends Conditions implements CmsPageInterface } /** - * Prepare data + * Prepare data. * * @param array $data * @return array diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockEdit.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockEdit.xml new file mode 100644 index 0000000000000000000000000000000000000000..2aa384eef89c8f62dc734f7c2f3702a0561994ed --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockEdit.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsBlockEdit" area="Adminhtml" mca="cms/block/edit" module="Magento_Cms"> + <block name="blockForm" class="Magento\Cms\Test\Block\Adminhtml\Block\Edit\BlockForm" locator="[id='page:main-container']" strategy="css selector" /> + <block name="pageMainActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml new file mode 100644 index 0000000000000000000000000000000000000000..f9b2d8c51e95c647f45a1c9b18557e7632ad4c1b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockIndex.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsBlockIndex" area="Adminhtml" mca="cms/block" module="Magento_Cms"> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector" /> + <block name="gridPageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="cmsBlockGrid" class="Magento\Cms\Test\Block\Adminhtml\Block\CmsGrid" locator=".grid" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml new file mode 100644 index 0000000000000000000000000000000000000000..65693e9a94246600741fc5658bd4cd09413d72b6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsBlockNew.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsBlockNew" area="Adminhtml" mca="cms/block/new" module="Magento_Cms"> + <block name="formPageActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="cmsForm" class="Magento\Cms\Test\Block\Adminhtml\Block\Edit\CmsForm" locator="[id='page:main-container']" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml new file mode 100644 index 0000000000000000000000000000000000000000..d622c917217dc1b6609fd65efddd157cda24da84 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageIndex.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsPageIndex" area="Adminhtml" mca="cms/page/index" module="Magento_Cms"> + <block name="pageActionsBlock" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector" /> + <block name="cmsPageGridBlock" class="Magento\Cms\Test\Block\Adminhtml\Page\Grid" locator=".grid" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator=".messages .message" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageNew.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageNew.xml new file mode 100644 index 0000000000000000000000000000000000000000..252dc039121b9ae55c6b30b063170fee9114c9a6 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/Adminhtml/CmsPageNew.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> + <page name="CmsPageNew" area="Adminhtml" mca="cms/page/new" module="Magento_Cms"> + <block name="pageForm" class="Magento\Cms\Test\Block\Adminhtml\Page\Edit\PageForm" locator="[id='page:main-container']" strategy="css selector" /> + <block name="pageMainActions" class="Magento\Backend\Test\Block\FormPageActions" locator=".page-main-actions" strategy="css selector" /> + </page> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml index 661f784c0a33d2d427b3d1760a0752b9cc8be624..066779eb08b95a54465eacda89d3be298cd40e5d 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml @@ -6,17 +6,17 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CmsIndex" mca="cms/index/index" module="Magento_Cms"> - <block name="searchBlock" class="Magento\Catalog\Test\Block\Search" locator="#search_mini_form" strategy="css selector"/> - <block name="topmenu" class="Magento\Theme\Test\Block\Html\Topmenu" locator="[role='navigation']" strategy="css selector"/> - <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector"/> - <block name="footerBlock" class="Magento\Theme\Test\Block\Html\Footer" locator="footer.page-footer" strategy="css selector"/> - <block name="linksBlock" class="Magento\Theme\Test\Block\Links" locator=".header .links" strategy="css selector"/> - <block name="storeSwitcherBlock" class="Magento\Store\Test\Block\Switcher" locator="[data-ui-id='language-switcher']" strategy="css selector"/> - <block name="cartSidebarBlock" class="Magento\Checkout\Test\Block\Cart\Sidebar" locator="[data-block='minicart']" strategy="css selector"/> - <block name="compareProductsBlock" class="Magento\Catalog\Test\Block\Product\Compare\Sidebar" locator=".sidebar.sidebar-additional" strategy="css selector"/> - <block name="currencyBlock" class="Magento\Directory\Test\Block\Currency\Switcher" locator=".switcher.currency" strategy="css selector"/> - <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector"/> - <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector"/> - </page> + <page name="CmsIndex" mca="cms/index/index" module="Magento_Cms"> + <block name="searchBlock" class="Magento\Catalog\Test\Block\Search" locator="#search_mini_form" strategy="css selector" /> + <block name="topmenu" class="Magento\Theme\Test\Block\Html\Topmenu" locator="[role='navigation']" strategy="css selector" /> + <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector" /> + <block name="footerBlock" class="Magento\Theme\Test\Block\Html\Footer" locator="footer.page-footer" strategy="css selector" /> + <block name="linksBlock" class="Magento\Theme\Test\Block\Links" locator=".header .links" strategy="css selector" /> + <block name="storeSwitcherBlock" class="Magento\Store\Test\Block\Switcher" locator="[data-ui-id='language-switcher']" strategy="css selector" /> + <block name="cartSidebarBlock" class="Magento\Checkout\Test\Block\Cart\Sidebar" locator="[data-block='minicart']" strategy="css selector" /> + <block name="compareProductsBlock" class="Magento\Catalog\Test\Block\Product\Compare\Sidebar" locator=".sidebar.sidebar-additional" strategy="css selector" /> + <block name="currencyBlock" class="Magento\Directory\Test\Block\Currency\Switcher" locator=".switcher.currency" strategy="css selector" /> + <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector" /> + <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml index 1bbb59d71184e0a86d7956e9ef570b93dbc1ba42..f251d89bdbbfd3a6d0dc0761000bbac929d30468 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml @@ -6,7 +6,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CmsPage" mca="cms/page" module="Magento_Cms"> - <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector"/> - </page> + <page name="CmsPage" mca="cms/page" module="Magento_Cms"> + <block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml new file mode 100644 index 0000000000000000000000000000000000000000..81f9f676fe986eabfdcf044a7eabfe490f176142 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsBlock.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Cms\Test\Repository\CmsBlock"> + <dataset name="default"> + <field name="title" xsi:type="string">block_%isolation%</field> + <field name="identifier" xsi:type="string">identifier_%isolation%</field> + <field name="stores" xsi:type="array"> + <item name="dataSet" xsi:type="array"> + <item name="0" xsi:type="string">All Store Views</item> + </item> + </field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="string">description_%isolation%</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsPage.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsPage.xml new file mode 100644 index 0000000000000000000000000000000000000000..46f5e119b6e77145e2c580b3d6da0cff673249a3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/CmsPage.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\Cms\Test\Repository\CmsPage"> + <dataset name="default"> + <field name="title" xsi:type="string">page-%isolation%</field> + <field name="identifier" xsi:type="string">page-%isolation%</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">Test Content</item> + </field> + <field name="content_heading" xsi:type="string">Heading-%isolation%</field> + <field name="page_layout" xsi:type="string">1 column</field> + </dataset> + + <dataset name="cms-page-duplicated"> + <field name="title" xsi:type="string">404 Not Found 1 Test%isolation%</field> + <field name="identifier" xsi:type="string">home</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">Test Content</item> + </field> + <field name="meta_keywords" xsi:type="string">Page keywords</field> + <field name="meta_description" xsi:type="string">Page description</field> + </dataset> + + <dataset name="3_column_template"> + <field name="title" xsi:type="string">page-compare-%isolation%</field> + <field name="identifier" xsi:type="string">page-compare-%isolation%</field> + <field name="store_id" xsi:type="string">All Store Views</field> + <field name="is_active" xsi:type="string">Enabled</field> + <field name="content" xsi:type="array"> + <item name="content" xsi:type="string">Test Content</item> + </field> + <field name="page_layout" xsi:type="string">3 columns</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/UrlRewrite.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/UrlRewrite.xml new file mode 100644 index 0000000000000000000000000000000000000000..5c562348e4fa2b621ebd6d9d942ff9a9ca4bd824 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Repository/UrlRewrite.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> + <repository class="Magento\UrlRewrite\Test\Repository\UrlRewrite"> + <dataset name="cms_default_no_redirect"> + <field name="request_path" xsi:type="string">test_request%isolation%</field> + <field name="target_path" xsi:type="array"> + <item name="entity" xsi:type="string">cms_page/%cmsPage::default%</item> + </field> + <field name="description" xsi:type="string">test description</field> + <field name="redirect_type" xsi:type="string">No</field> + <field name="store_id" xsi:type="string">Default Store View</field> + </dataset> + + <dataset name="cms_default_temporary_redirect"> + <field name="request_path" xsi:type="string">test_request%isolation%</field> + <field name="redirect_type" xsi:type="string">Temporary (302)</field> + <field name="store_id" xsi:type="string">Default Store View</field> + <field name="target_path" xsi:type="array"> + <item name="entity" xsi:type="string">cms_page/%cmsPage::default%</item> + </field> + <field name="description" xsi:type="string">test description</field> + </dataset> + + <dataset name="cms_default_permanent_redirect"> + <field name="request_path" xsi:type="string">test_request%isolation%</field> + <field name="redirect_type" xsi:type="string">Permanent (301)</field> + <field name="store_id" xsi:type="string">Default Store View</field> + <field name="target_path" xsi:type="array"> + <item name="entity" xsi:type="string">cms_page/%cmsPage::default%</item> + </field> + <field name="description" xsi:type="string">test description</field> + </dataset> + </repository> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/AbstractCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/AbstractCmsBlockEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4d0aa70db985a4cf4efce25ff4a2c1a9a208a02d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/AbstractCmsBlockEntityTest.php @@ -0,0 +1,117 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Backend\Test\Page\Adminhtml\StoreDelete; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\StoreNew; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Parent class for CMS Block tests. + */ +abstract class AbstractCmsBlockEntityTest extends Injectable +{ + /** + * Page CmsBlockIndex. + * + * @var CmsBlockIndex + */ + protected $cmsBlockIndex; + + /** + * Page CmsBlockNew. + * + * @var CmsBlockNew + */ + protected $cmsBlockNew; + + /** + * Page StoreIndex. + * + * @var StoreIndex + */ + protected $storeIndex; + + /** + * Page StoreNew. + * + * @var StoreNew + */ + protected $storeNew; + + /** + * Page StoreDelete. + * + * @var StoreDelete + */ + protected $storeDelete; + + /** + * Store Name. + * + * @var array + */ + protected $storeName; + + /** + * Skipped stores for tearDown. + * + * @var array + */ + protected $skippedStores = [ + 'All Store Views', + 'Main Website/Main Website Store/Default Store View', + ]; + + /** + * Injection data. + * + * @param CmsBlockIndex $cmsBlockIndex + * @param CmsBlockNew $cmsBlockNew + * @param StoreIndex $storeIndex + * @param StoreNew $storeNew + * @param StoreDelete $storeDelete + * @return void + */ + public function __inject( + CmsBlockIndex $cmsBlockIndex, + CmsBlockNew $cmsBlockNew, + StoreIndex $storeIndex, + StoreNew $storeNew, + StoreDelete $storeDelete + ) { + $this->cmsBlockIndex = $cmsBlockIndex; + $this->cmsBlockNew = $cmsBlockNew; + $this->storeIndex = $storeIndex; + $this->storeNew = $storeNew; + $this->storeDelete = $storeDelete; + } + + /** + * Delete Store after test. + * + * @return void + */ + public function tearDown() + { + foreach ($this->storeName as $store) { + if (in_array($store, $this->skippedStores)) { + continue; + } + $tmp = explode("/", $store); + $filter['store_title'] = end($tmp); + $this->storeIndex->open(); + $this->storeIndex->getStoreGrid()->searchAndOpen($filter); + $this->storeNew->getFormPageActions()->delete(); + $this->storeDelete->getStoreForm()->fillForm(['create_backup' => 'No']); + $this->storeDelete->getFormPageActions()->delete(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..bc0c24a28b5d0d24c7464dd668676353d5a3e7ca --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsBlock; + +/** + * Preconditions: + * 1. Create store view. + * + * Steps: + * 1. Open Backend. + * 2. Go to Content > Blocks. + * 3. Click "Add New Block" button. + * 4. Fill data according to dataset. + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25578 + */ +class CreateCmsBlockEntityTest extends AbstractCmsBlockEntityTest +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Create CMS Block. + * + * @param CmsBlock $cmsBlock + * @return void + */ + public function test(CmsBlock $cmsBlock) + { + // Prepare data for tearDown + $this->storeName = $cmsBlock->getStores(); + + // Steps + $this->cmsBlockIndex->open(); + $this->cmsBlockIndex->getGridPageActions()->addNew(); + $this->cmsBlockNew->getCmsForm()->fill($cmsBlock); + $this->cmsBlockNew->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..05164514a1335b65b11c83edf68d391b646fcebf --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsBlockEntityTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\CreateCmsBlockEntityTest"> + <variation name="CreateCmsBlockEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">All Store Views</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Enabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage" /> + </variation> + <variation name="CreateCmsBlockEntityTestVariation2"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">default</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Disabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..35580f33bd3e58b8fb6a6ab68d0a911b7ccfd2fd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsPage as CmsPageFixture; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Steps: + * 1. Log in to Backend. + * 2. Navigate to Content > Elements > Pages. + * 3. Start to create new CMS Page. + * 4. Fill out fields data according to data set. + * 5. Save CMS Page. + * 6. Verify created CMS Page. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25580 + */ +class CreateCmsPageEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + const TEST_TYPE = 'acceptance_test'; + const STABLE = 'no'; + /* end tags */ + + /** + * CmsIndex page. + * + * @var CmsPageIndex + */ + protected $cmsIndex; + + /** + * CmsPageNew page. + * + * @var CmsPageNew + */ + protected $cmsPageNew; + + /** + * Inject pages. + * + * @param CmsPageIndex $cmsIndex + * @param CmsPageNew $cmsPageNew + * @return void + */ + public function __inject(CmsPageIndex $cmsIndex, CmsPageNew $cmsPageNew) + { + $this->cmsIndex = $cmsIndex; + $this->cmsPageNew = $cmsPageNew; + } + + /** + * Creating Cms page. + * + * @param CmsPageFixture $cms + * @return void + */ + public function test(CmsPageFixture $cms) + { + // Steps + $this->cmsIndex->open(); + $this->cmsIndex->getPageActionsBlock()->addNew(); + $this->cmsPageNew->getPageForm()->fill($cms); + $this->cmsPageNew->getPageMainActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..21c9773ef8a4518f1ebdd6c466585dd4d2749fd2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageEntityTest.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\CreateCmsPageEntityTest"> + <variation name="CreateCmsPageEntityTestVariation1"> + <data name="description" xsi:type="string">MAGETWO-12399: Create CMS Content Page</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/identifier" xsi:type="string">identifier-%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">All Store Views</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> + </variation> + <variation name="CreateCmsPageEntityTestVariation2"> + <data name="description" xsi:type="string">Create page for default store view</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + </variation> + <variation name="CreateCmsPageEntityTestVariation3"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34858</data> + <data name="description" xsi:type="string">Create page with widget and system variable</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <data name="cms/data/content/widget/preset" xsi:type="string">default</data> + <data name="cms/data/content/variable" xsi:type="string">General Contact Name</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> + </variation> + <variation name="CreateCmsPageEntityTestVariation4"> + <data name="description" xsi:type="string">Create disabled page</data> + <data name="cms/data/title" xsi:type="string">NewCmsPage%isolation%</data> + <data name="cms/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="cms/data/is_active" xsi:type="string">Disabled</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5023d9a37f2449be13b0c1153842e92014fa779c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteEdit; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions + * 1. Create CMS Page. + * + * Steps + * 1. Login to backend as Admin. + * 2. Go to the Marketing > SEO & Search > URL Rewrites. + * 3. Click "Add Url Rewrite" button. + * 4. Select "For CMS Page" in Create URL Rewrite dropdown. + * 5. Select CMS page from preconditions in grid. + * 6. Fill data according to data set. + * 7. Save Rewrite. + * 8. Perform all assertions. + * + * @group URL_Rewrites_(PS) + * @ZephyrId MAGETWO-24847 + */ +class CreateCmsPageRewriteEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Url rewrite index page. + * + * @var UrlRewriteIndex + */ + protected $urlRewriteIndex; + + /** + * Url rewrite edit page. + * + * @var UrlRewriteEdit + */ + protected $urlRewriteEdit; + + /** + * Inject pages. + * + * @param UrlRewriteIndex $urlRewriteIndex + * @param UrlRewriteEdit $urlRewriteEdit + * @return void + */ + public function __inject( + UrlRewriteIndex $urlRewriteIndex, + UrlRewriteEdit $urlRewriteEdit + ) { + $this->urlRewriteIndex = $urlRewriteIndex; + $this->urlRewriteEdit = $urlRewriteEdit; + } + + /** + * Create CMS page rewrites. + * + * @param UrlRewrite $urlRewrite + * @return array + */ + public function test(UrlRewrite $urlRewrite) + { + //Steps + $this->urlRewriteIndex->open(); + $this->urlRewriteIndex->getPageActionsBlock()->addNew(); + $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite); + $cmsPage = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity(); + $filter = ['title' => $cmsPage->getTitle()]; + $this->urlRewriteEdit->getCmsGridBlock()->searchAndOpen($filter); + $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite); + $this->urlRewriteEdit->getPageMainActions()->save(); + + return ['cmsPage' => $cmsPage]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..518a013681fd4bb237eb92ed50d3ef31084e71ce --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/CreateCmsPageRewriteEntityTest.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\CreateCmsPageRewriteEntityTest"> + <variation name="CreateCmsPageRewriteEntityTestVariation1"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">No</data> + <data name="urlRewrite/data/description" xsi:type="string">test_description_default</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="CreateCmsPageRewriteEntityTestVariation2"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.html</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Temporary (302)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_302</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="CreateCmsPageRewriteEntityTestVariation3"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.htm</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Permanent (301)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_301</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="CreateCmsPageRewriteEntityTestVariation4"> + <data name="urlRewrite/data/entity_type" xsi:type="string">For CMS page</data> + <data name="urlRewrite/data/target_path/entity" xsi:type="string">cms/page/view/page_id/%cmsPage::default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.aspx</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Permanent (301)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_%isolation%</data> + <data name="isRequired" xsi:type="string">Yes</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..07f8d2dea4488bc90f697262bbaadf250022dde9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsBlock; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsBlockNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create CMS Block. + * + * Steps: + * 1. Open Backend. + * 2. Go to Content > Blocks. + * 3. Open created CMS block. + * 4. Click "Delete Block". + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25698 + */ +class DeleteCmsBlockEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Page CmsBlockIndex. + * + * @var CmsBlockIndex + */ + protected $cmsBlockIndex; + + /** + * Page CmsBlockNew. + * + * @var CmsBlockNew + */ + protected $cmsBlockNew; + + /** + * Injection data. + * + * @param CmsBlockIndex $cmsBlockIndex + * @param CmsBlockNew $cmsBlockNew + * @return void + */ + public function __inject( + CmsBlockIndex $cmsBlockIndex, + CmsBlockNew $cmsBlockNew + ) { + $this->cmsBlockIndex = $cmsBlockIndex; + $this->cmsBlockNew = $cmsBlockNew; + } + + /** + * Delete CMS Block. + * + * @param CmsBlock $cmsBlock + * @return void + */ + public function test(CmsBlock $cmsBlock) + { + // Precondition + $cmsBlock->persist(); + $filter = ['identifier' => $cmsBlock->getIdentifier()]; + + // Steps + $this->cmsBlockIndex->open(); + $this->cmsBlockIndex->getCmsBlockGrid()->searchAndOpen($filter, true, false); + $this->cmsBlockNew->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..622b867cab4007ef1cbb9deb279df76f4aa686e7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsBlockEntityTest.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\DeleteCmsBlockEntityTest"> + <variation name="DeleteCmsBlockEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockDeleteMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5801ba85ea504bfeab0d880713bb50a51780d201 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.php @@ -0,0 +1,78 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. CMS Page is created. + * + * Steps: + * 1. Log in to Backend. + * 2. Navigate to CONTENT > Pages. + * 3. Click on CMS Page from grid. + * 4. Click "Delete Page" button. + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-23291 + */ +class DeleteCmsPageEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * CMS Index page. + * + * @var CmsPageIndex + */ + protected $cmsPageIndex; + + /** + * Edit CMS page. + * + * @var CmsPageNew + */ + protected $cmsPageNew; + + /** + * Inject pages. + * + * @param CmsPageIndex $cmsPageIndex + * @param CmsPageNew $cmsPageNew + * @return void + */ + public function __inject(CmsPageIndex $cmsPageIndex, CmsPageNew $cmsPageNew) + { + $this->cmsPageIndex = $cmsPageIndex; + $this->cmsPageNew = $cmsPageNew; + } + + /** + * Delete CMS Page. + * + * @param CmsPage $cmsPage + * @return void + */ + public function test(CmsPage $cmsPage) + { + // Preconditions + $cmsPage->persist(); + + // Steps + $this->cmsPageIndex->open(); + $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsPage->getTitle()]); + $this->cmsPageNew->getPageMainActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..78dd465ad2b65d302b9e2f8d8786a7081b3dce64 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageEntityTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\DeleteCmsPageEntityTest"> + <variation name="DeleteCmsPageEntityTestVariation1"> + <data name="cmsPage/dataSet" xsi:type="string">default</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDeleteMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageNotInGrid" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7d5364c7c6fe48279ef35c797ddce98eefa828c2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteEdit; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create CMS Page. + * 2. Create CMS Page URL Redirect. + * + * Steps: + * 1. Login to backend as Admin. + * 2. Go to the Marketing > SEO & Search > URL Redirects. + * 3. Search and open created URL Redirect. + * 4. Delete Redirect. + * 5. Perform all assertions. + * + * @group URL_Rewrites_(PS) + * @ZephyrId MAGETWO-25915 + */ +class DeleteCmsPageUrlRewriteEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Url rewrite index page. + * + * @var UrlRewriteIndex + */ + protected $urlRewriteIndex; + + /** + * Url rewrite edit page. + * + * @var UrlRewriteEdit + */ + protected $urlRewriteEdit; + + /** + * Inject pages. + * + * @param UrlRewriteIndex $urlRewriteIndex + * @param UrlRewriteEdit $urlRewriteEdit + * @return void + */ + public function __inject( + UrlRewriteIndex $urlRewriteIndex, + UrlRewriteEdit $urlRewriteEdit + ) { + $this->urlRewriteIndex = $urlRewriteIndex; + $this->urlRewriteEdit = $urlRewriteEdit; + } + + /** + * Delete CMS page rewrites entity. + * + * @param UrlRewrite $urlRewrite + * @return void + */ + public function test(UrlRewrite $urlRewrite) + { + // Precondition + $urlRewrite->persist(); + + // Steps + $this->urlRewriteIndex->open(); + $this->urlRewriteIndex->getUrlRedirectGrid()->searchAndOpen(['request_path' => $urlRewrite->getRequestPath()]); + $this->urlRewriteEdit->getPageMainActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..86128fd3a6411d2f0a9564c4d084b984079d02a2 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/DeleteCmsPageUrlRewriteEntityTest.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\DeleteCmsPageUrlRewriteEntityTest"> + <variation name="DeleteCmsPageUrlRewriteEntityTestVariation1"> + <data name="urlRewrite/dataSet" xsi:type="string">cms_default_no_redirect</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteNotInGrid" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> + </variation> + <variation name="DeleteCmsPageUrlRewriteEntityTestVariation2"> + <data name="urlRewrite/dataSet" xsi:type="string">cms_default_permanent_redirect</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteNotInGrid" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> + </variation> + <variation name="DeleteCmsPageUrlRewriteEntityTestVariation3"> + <data name="urlRewrite/dataSet" xsi:type="string">cms_default_temporary_redirect</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteDeletedMessage" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteNotInGrid" /> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertPageByUrlRewriteIsNotFound" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..529810975dd2b4c9fd5321a5e200aea49494e5ec --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest18"> + <data name="menuItem" xsi:type="string">Content > Pages</data> + <data name="pageTitle" xsi:type="string">Pages</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest19"> + <data name="menuItem" xsi:type="string">Content > Blocks</data> + <data name="pageTitle" xsi:type="string">Blocks</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..7c2d579080f69e09b5d2629c20cc4213dcbc7d7b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsBlock; + +/** + * Preconditions: + * 1. Create store view. + * 2. Create CMS Block. + * + * Steps: + * 1. Open Backend. + * 2. Go to Content > Blocks. + * 3. Open created CMS block. + * 4. Fill data according to dataset. + * 5. Perform all assertions. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25941 + */ +class UpdateCmsBlockEntityTest extends AbstractCmsBlockEntityTest +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Run Update CMS Block test. + * + * @param CmsBlock $initialCmsBlock + * @param CmsBlock $cmsBlock + * @return void + */ + public function test(CmsBlock $initialCmsBlock, CmsBlock $cmsBlock) + { + // Prepare data for tearDown + $this->storeName = $cmsBlock->getStores(); + + // Precondition + $initialCmsBlock->persist(); + + // Steps + $this->cmsBlockIndex->open(); + $this->cmsBlockIndex->getCmsBlockGrid()->searchAndOpen(['identifier' => $initialCmsBlock->getIdentifier()]); + $this->cmsBlockNew->getCmsForm()->fill($cmsBlock); + $this->cmsBlockNew->getFormPageActions()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b72bf77ef56654718f9c6ab6fc2bd6ac9b4025a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsBlockEntityTest.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\UpdateCmsBlockEntityTest"> + <variation name="UpdateCmsBlockEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_updated_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_updated_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">All Store Views</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Enabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_updated_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage" /> + </variation> + <variation name="UpdateCmsBlockEntityTestVariation2"> + <data name="issue" xsi:type="string">Bug: MAGETWO-32125</data> + <data name="cmsBlock/data/title" xsi:type="string">block_updated_%isolation%</data> + <data name="cmsBlock/data/identifier" xsi:type="string">identifier_updated_%isolation%</data> + <data name="cmsBlock/data/stores/dataSet/option_0" xsi:type="string">default</data> + <data name="cmsBlock/data/is_active" xsi:type="string">Disabled</data> + <data name="cmsBlock/data/content" xsi:type="string">description_updated_%isolation%</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockInGrid" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4c8f8d1cf29e792b75501b2d16471d83671cb0cc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Cms\Test\Fixture\CmsPage; +use Magento\Cms\Test\Page\Adminhtml\CmsPageIndex; +use Magento\Cms\Test\Page\Adminhtml\CmsPageNew; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. CMS Page is created. + * + * Steps: + * 1. Log in to Backend. + * 2. Navigate to Content > Elements > Pages. + * 3. Click on CMS Page from grid. + * 4. Edit test value(s) according to data set. + * 5. Click 'Save' CMS Page. + * 6. Perform asserts. + * + * @group CMS_Content_(PS) + * @ZephyrId MAGETWO-25186 + */ +class UpdateCmsPageEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * CMS Index page. + * + * @var CmsPageIndex + */ + protected $cmsPageIndex; + + /** + * Edit CMS page. + * + * @var CmsPageNew + */ + protected $cmsPageNew; + + /** + * Fixture Factory. + * + * @var FixtureFactory + */ + protected $factory; + + /** + * Inject page. + * + * @param CmsPageIndex $cmsPageIndex + * @param CmsPageNew $cmsPageNew + * @param CmsPage $cmsOriginal + * @param FixtureFactory $factory + * @return array + */ + public function __inject( + CmsPageIndex $cmsPageIndex, + CmsPageNew $cmsPageNew, + CmsPage $cmsOriginal, + FixtureFactory $factory + ) { + $cmsOriginal->persist(); + $this->cmsPageIndex = $cmsPageIndex; + $this->cmsPageNew = $cmsPageNew; + $this->factory = $factory; + return ['cmsOriginal' => $cmsOriginal]; + } + + /** + * Update CMS Page. + * + * @param CmsPage $cms + * @param CmsPage $cmsOriginal + * @return array + */ + public function test(CmsPage $cms, CmsPage $cmsOriginal) + { + // Steps + $this->cmsPageIndex->open(); + $this->cmsPageIndex->getCmsPageGridBlock()->searchAndOpen(['title' => $cmsOriginal->getTitle()]); + $this->cmsPageNew->getPageForm()->fill($cms); + $this->cmsPageNew->getPageMainActions()->save(); + + return [ + 'cms' => $this->factory->createByCode( + 'cmsPage', + ['data' => array_merge($cmsOriginal->getData(), $cms->getData())] + ) + ]; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..d487f94272c8d1f32efc7679c1e646cb73f99711 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageEntityTest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\UpdateCmsPageEntityTest"> + <variation name="UpdateCmsPageEntityTestVariation1"> + <data name="cms/data/title" xsi:type="string">CmsPageEdited%isolation%</data> + <data name="cms/data/is_active" xsi:type="string">Disabled</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content_after_edit</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageDisabledOnFrontend" /> + </variation> + <variation name="UpdateCmsPageEntityTestVariation2"> + <data name="cms/data/title" xsi:type="string">CmsPageEdited%isolation%</data> + <data name="cms/data/identifier" xsi:type="string">cms_page_url_edited_%isolation%</data> + <data name="cms/data/content_heading" xsi:type="string">Content Heading TexEdited</data> + <data name="cms/data/content/content" xsi:type="string">cms_page_text_content_after_edit</data> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageSuccessSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPageForm" /> + <constraint name="Magento\Cms\Test\Constraint\AssertCmsPagePreview" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d1e65faea3d4e0dced9094619989da641b5f1fcb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Cms\Test\TestCase; + +use Magento\Backend\Test\Page\Adminhtml\StoreDelete; +use Magento\Backend\Test\Page\Adminhtml\StoreIndex; +use Magento\Backend\Test\Page\Adminhtml\StoreNew; +use Magento\UrlRewrite\Test\Fixture\UrlRewrite; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteEdit; +use Magento\UrlRewrite\Test\Page\Adminhtml\UrlRewriteIndex; +use Magento\Mtf\TestCase\Injectable; + +/** + * Preconditions: + * 1. Create custom store view. + * 2. Create CMS Page. + * 3. Create CMS Page URL Redirect. + * + * Steps: + * 1. Login to backend as Admin. + * 2. Go to the Marketing-> SEO & Search->URL Redirects. + * 3. Search and open created URL Redirect. + * 4. Fill data according to data set. + * 5. Save Redirect. + * 6. Perform all assertions. + * + * @group URL_Rewrites_(PS) + * @ZephyrId MAGETWO-26173 + */ +class UpdateCmsPageRewriteEntityTest extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'PS'; + /* end tags */ + + /** + * Url rewrite index page. + * + * @var UrlRewriteIndex + */ + protected $urlRewriteIndex; + + /** + * Url rewrite edit page. + * + * @var UrlRewriteEdit + */ + protected $urlRewriteEdit; + + /** + * Page StoreIndex. + * + * @var StoreIndex + */ + protected $storeIndex; + + /** + * Page StoreNew. + * + * @var StoreNew + */ + protected $storeNew; + + /** + * Page StoreDelete. + * + * @var StoreDelete + */ + protected $storeDelete; + + /** + * Store Name. + * + * @var string + */ + protected $storeName; + + /** + * Skipped stores for tearDown. + * + * @var array + */ + protected $skippedStores = [ + 'Main Website/Main Website Store/Default Store View', + ]; + + /** + * Inject pages. + * + * @param UrlRewriteIndex $urlRewriteIndex + * @param UrlRewriteEdit $urlRewriteEdit + * @param StoreIndex $storeIndex + * @param StoreNew $storeNew + * @param StoreDelete $storeDelete + * @return void + */ + public function __inject( + UrlRewriteIndex $urlRewriteIndex, + UrlRewriteEdit $urlRewriteEdit, + StoreIndex $storeIndex, + StoreNew $storeNew, + StoreDelete $storeDelete + ) { + $this->urlRewriteIndex = $urlRewriteIndex; + $this->urlRewriteEdit = $urlRewriteEdit; + $this->storeIndex = $storeIndex; + $this->storeNew = $storeNew; + $this->storeDelete = $storeDelete; + } + + /** + * Update CMS page rewrites. + * + * @param UrlRewrite $urlRewrite + * @param UrlRewrite $cmsPageRewrite + * @return array + */ + public function test(UrlRewrite $urlRewrite, UrlRewrite $cmsPageRewrite) + { + // Preconditions + $cmsPageRewrite->persist(); + + // Steps + $this->urlRewriteIndex->open(); + $this->storeName = $urlRewrite->getStoreId(); + $filter = ['request_path' => $cmsPageRewrite->getRequestPath()]; + $this->urlRewriteIndex->getUrlRedirectGrid()->searchAndOpen($filter); + $this->urlRewriteEdit->getFormBlock()->fill($urlRewrite); + $this->urlRewriteEdit->getPageMainActions()->save(); + + return ['cmsPage' => $cmsPageRewrite->getDataFieldConfig('target_path')['source']->getEntity()]; + } + + /** + * Delete Store after test. + * + * @return void|null + */ + public function tearDown() + { + if (in_array($this->storeName, $this->skippedStores)) { + return; + } + $storeName = explode("/", $this->storeName); + $filter['store_title'] = end($storeName); + $this->storeIndex->open(); + $this->storeIndex->getStoreGrid()->searchAndOpen($filter); + $this->storeNew->getFormPageActions()->delete(); + $this->storeDelete->getStoreForm()->fillForm(['create_backup' => 'No']); + $this->storeDelete->getFormPageActions()->delete(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..ebf6cc9116491916eb95a74a55217360e6987cc9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/TestCase/UpdateCmsPageRewriteEntityTest.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Cms\Test\TestCase\UpdateCmsPageRewriteEntityTest"> + <variation name="UpdateCmsPageRewriteEntityTestVariation1"> + <data name="cmsPageRewrite/dataSet" xsi:type="string">cms_default_no_redirect</data> + <data name="urlRewrite/data/store_id" xsi:type="string">Main Website/Main Website Store/%default%</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">No</data> + <data name="urlRewrite/data/description" xsi:type="string">test_description_custom_store</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="UpdateCmsPageRewriteEntityTestVariation2"> + <data name="cmsPageRewrite/dataSet" xsi:type="string">cms_default_temporary_redirect</data> + <data name="urlRewrite/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.html</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Temporary (302)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_302</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + <variation name="UpdateCmsPageRewriteEntityTestVariation3"> + <data name="cmsPageRewrite/dataSet" xsi:type="string">cms_default_permanent_redirect</data> + <data name="urlRewrite/data/store_id" xsi:type="string">Main Website/Main Website Store/Default Store View</data> + <data name="urlRewrite/data/request_path" xsi:type="string">request_path%isolation%.htm</data> + <data name="urlRewrite/data/redirect_type" xsi:type="string">Permanent (301)</data> + <data name="urlRewrite/data/description" xsi:type="string">test description_301</data> + <constraint name="Magento\UrlRewrite\Test\Constraint\AssertUrlRewriteSaveMessage" /> + <constraint name="Magento\Cms\Test\Constraint\AssertUrlRewriteCmsPageRedirect" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/curl/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..1827e66341e7b0e3aa9d47e1464576a79e3010ee --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/curl/di.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <preference for="\Magento\Cms\Test\Handler\CmsPage\CmsPageInterface" type="\Magento\Cms\Test\Handler\CmsPage\Curl" /> + <preference for="\Magento\Cms\Test\Handler\CmsBlock\CmsBlockInterface" type="\Magento\Cms\Test\Handler\CmsBlock\Curl" /> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b297f22903f1ff3ba003043921d6e77f160dc4c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/etc/di.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockSuccessSaveMessage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockOnCategoryPage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockNotOnCategoryPage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> + <type name="Magento\Cms\Test\Constraint\AssertCmsBlockDeleteMessage"> + <arguments> + <argument name="severity" xsi:type="string">high</argument> + </arguments> + </type> +</config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php index e00f4e4e90f074166f810256dec43f444b382683..fe8b0dca7a593758f1b5ea59cf691ac080665e3e 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php @@ -715,6 +715,50 @@ class ConfigurableAttributesData implements FixtureInterface ], ], ], + + 'two_variations_with_fixed_price' => [ + 'attributes_data' => [ + 'attribute_key_0' => [ + 'options' => [ + 'option_key_0' => [ + 'label' => 'option_key_1_%isolation%', + 'pricing_value' => 1, + 'is_percent' => 'No', + 'include' => 'Yes', + ], + 'option_key_1' => [ + 'label' => 'option_2_%isolation%', + 'pricing_value' => 2, + 'is_percent' => 'No', + 'include' => 'Yes', + ], + ], + ], + ], + 'attributes' => [ + 'attribute_key_0' => 'catalogProductAttribute::attribute_type_dropdown_two_options', + ], + 'products' => [ + 'attribute_key_0:option_key_0' => 'catalogProductSimple::product_without_category', + 'attribute_key_0:option_key_1' => 'catalogProductSimple::product_without_category', + ], + 'matrix' => [ + 'attribute_key_0:option_key_0' => [ + 'display' => 'Yes', + 'quantity_and_stock_status' => [ + 'qty' => 100, + ], + 'weight' => 1, + ], + 'attribute_key_0:option_key_1' => [ + 'display' => 'Yes', + 'quantity_and_stock_status' => [ + 'qty' => 200, + ], + 'weight' => 1, + ], + ], + ], ]; /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml index 1e716ac2f3b163505ebd14af8596f7122fe98470..fa36f1aef661ab28d1eceace46b405d40e263af9 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml @@ -275,6 +275,31 @@ </field> </dataset> + <dataset name="two_variations_with_fixed_price"> + <field name="name" xsi:type="string">Configurable product %isolation%</field> + <field name="url_key" xsi:type="string">test-configurable-product-%isolation%</field> + <field name="sku" xsi:type="string">sku_configurable_product_%isolation%</field> + <field name="price" xsi:type="array"> + <item name="value" xsi:type="string">10</item> + </field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">taxable_goods</item> + </field> + <field name="weight" xsi:type="string">1</field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="configurable_attributes_data" xsi:type="array"> + <item name="preset" xsi:type="string">two_variations_with_fixed_price</item> + </field> + <field name="attribute_set_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">custom_attribute_set</item> + </field> + <field name="checkout_data" xsi:type="array"> + <item name="preset" xsi:type="string">two_options_by_one_dollar</item> + </field> + </dataset> + <dataset name="filterable_two_options_with_zero_price"> <field name="name" xsi:type="string">Test configurable product %isolation%</field> <field name="sku" xsi:type="string">sku_test_configurable_product_%isolation%</field> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml index 5d9a0ef2c098102b6d7ef447d7dde0eeffb6612b..1605e59d91b2e1636c387ee812bc02049bb5d042 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml @@ -5,156 +5,130 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest"> - <variation name="CreateConfigurableProductEntityTestVariation1" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with category and two new options</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="tag" xsi:type="string">Bug: MTA-1616</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with two options</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_options</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with special price</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options_with_special_price</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">10</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="issue" xsi:type="string">Bug: MTA-1616</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation4" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">Create product with assigned products to options</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_assigned_product</data> - <data name="product/data/checkout_data/preset" xsi:type="string">two_options_with_assigned_product</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">Configurable short description</data> - <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> - <data name="product/data/weight" xsi:type="string">2</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-12620: Create Configurable Product and Assign it to Category</data> - <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_fixed_price</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> - <data name="product/data/tax_class_id" xsi:type="string">Taxable Goods</data> - <data name="product/data/price/value" xsi:type="string">10</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">1</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" next="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - <variation name="CreateConfigurableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="description" xsi:type="string">MAGETWO-13361: Create Configurable Product with Creating New Category and New Attribute (Required Fields Only)</data> - <data name="product/data/url_key" xsi:type="string">-</data> - <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_searchable_options</data> - <data name="product/data/checkout_data/preset" xsi:type="string">-</data> - <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> - <data name="product/data/sku" xsi:type="string">-</data> - <data name="product/data/tax_class_id" xsi:type="string">-</data> - <data name="product/data/price/value" xsi:type="string">100</data> - <data name="product/data/special_price" xsi:type="string">-</data> - <data name="product/data/category_ids/new_category" xsi:type="string">no</data> - <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/weight" xsi:type="string">-</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="tag" xsi:type="string">test_type:acceptance_test</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" next="Magento\Catalog\Test\Constraint\AssertProductInCategory" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> - <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" prev="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> - </variation> - </testCase> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest"> + <variation name="CreateConfigurableProductEntityTestVariation1"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34195</data> + <data name="description" xsi:type="string">Create product with category and two new options</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductIsNotDisplayedSeparately"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation2"> + <data name="description" xsi:type="string">Create product with two options</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_options</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation3"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34195</data> + <data name="description" xsi:type="string">Create product with special price</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_new_options_with_special_price</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/special_price" xsi:type="string">10</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertChildProductsInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation4"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34791</data> + <data name="description" xsi:type="string">Create product with assigned products to options</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_assigned_product</data> + <data name="product/data/checkout_data/preset" xsi:type="string">two_options_with_assigned_product</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/short_description" xsi:type="string">Configurable short description</data> + <data name="product/data/description" xsi:type="string">Configurable Product description %isolation%</data> + <data name="product/data/weight" xsi:type="string">2</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage"/> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation5"> + <data name="description" xsi:type="string">MAGETWO-12620: Create Configurable Product and Assign it to Category</data> + <data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_options_with_fixed_price</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/sku" xsi:type="string">configurable_sku_%isolation%</data> + <data name="product/data/tax_class_id" xsi:type="string">Taxable Goods</data> + <data name="product/data/price/value" xsi:type="string">10</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/weight" xsi:type="string">1</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + </variation> + <variation name="CreateConfigurableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34195</data> + <data name="description" xsi:type="string">MAGETWO-13361: Create Configurable Product with Creating New Category and New Attribute (Required Fields Only)</data> + <data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_searchable_options</data> + <data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data> + <data name="product/data/price/value" xsi:type="string">100</data> + <data name="product/data/category_ids/new_category" xsi:type="string">no</data> + <data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data> + <data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..b5586d999f7e304d0904c33329d82aa18265a962 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/DuplicateProductEntityTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Catalog\Test\TestCase\Product\DuplicateProductEntityTest"> + <variation name="DuplicateProductEntityTestVariation2" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> + <data name="productType" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" next="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductDuplicateForm" /> + <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductDuplicateForm" next="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml index c74b44ab0638b04e6c138b7221085ea3c3b2bc9a..943de11174926b759bd97566f7d1b5b4a8cf80f5 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/UpdateConfigurableProductEntityTest.xml @@ -50,7 +50,6 @@ <data name="updatedProduct/data/weight" xsi:type="string">3</data> <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data> - <data name="issue" xsi:type="string">Bug: MTA-1616</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> @@ -75,7 +74,6 @@ <data name="updatedProduct/data/weight" xsi:type="string">3</data> <data name="updatedProduct/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> <data name="updatedProduct/data/affected_attribute_set" xsi:type="string">-</data> - <data name="issue" xsi:type="string">Bug: MTA-1616</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid"/> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm"/> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php index 5289324d5c8377aea222a69ccb60460ac98aa397..7fe761407b715695ee64edd96ca42fa1b1d69292 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestStep/UpdateConfigurableProductStep.php @@ -72,7 +72,7 @@ class UpdateConfigurableProductStep implements TestStepInterface CatalogProductEdit $catalogProductEdit, ConfigurableProduct $product, ConfigurableProduct $updatedProduct, - $attributeTypeAction + $attributeTypeAction = '' ) { $this->fixtureFactory = $fixtureFactory; $this->catalogProductEdit = $catalogProductEdit; diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/ConfigData.xml index a2b7c380a102f302f5d93688fcb98662b03a345e..8bed37c9f9ba9a008e35327b901217acf596e00a 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/ConfigData.xml +++ b/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/ConfigData.xml @@ -10,7 +10,7 @@ module="Magento_Core" type="flat" entity_type="core_config_data" - collection="Magento\Core\Model\Resource\Config\Data\Collection" + collection="Magento\Config\Model\Resource\Config\Data\Collection" repository_class="Magento\Core\Test\Repository\ConfigData" handler_interface="Magento\Core\Test\Handler\ConfigData\ConfigDataInterface" class="Magento\Core\Test\Fixture\ConfigData"> diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/SystemVariable.xml b/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/SystemVariable.xml index c313b15a2c676409f660a274ce83234824579979..01f5710dc7a3d13d105d0dfbfadf6c06406d55f2 100644 --- a/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/SystemVariable.xml +++ b/dev/tests/functional/tests/app/Magento/Core/Test/Fixture/SystemVariable.xml @@ -9,7 +9,7 @@ <fixture name="systemVariable" module="Magento_Core" type="composite" - collection="Magento\Core\Model\Resource\Variable\Collection" + collection="Magento\Variable\Model\Resource\Variable\Collection" handler_interface="Magento\Core\Test\Handler\SystemVariable\SystemVariableInterface" class="Magento\Core\Test\Fixture\SystemVariable"> <dataset name="default"> diff --git a/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2cff21bd91adf22b55288d661c274e7588bb7e4e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CurrencySymbol/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest20"> + <data name="menuItem" xsi:type="string">Stores > Currency Rates</data> + <data name="pageTitle" xsi:type="string">Currency Rates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest21"> + <data name="menuItem" xsi:type="string">Stores > Currency Symbols</data> + <data name="pageTitle" xsi:type="string">Currency Symbols</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php index 056a514f08295d8693cc8c0d55c0515a4e4e8e49..0de0e9658a1e7362d2cefb0012e0435a186ee627 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Account/AddressesDefault.php @@ -19,7 +19,7 @@ class AddressesDefault extends Block * * @var string */ - protected $changeBillingAddressSelector = '.box-billing-address a'; + protected $changeBillingAddressSelector = '.box-address-billing a'; /** * Click on address book menu item diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddresses.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddresses.php index 1bffd3078e356fb693004493a4ba3dabe5f210ef..bff724ba12559379b2bf9dc7e35b3d95a0d8714a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddresses.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerDefaultAddresses.php @@ -25,6 +25,7 @@ class AssertCustomerDefaultAddresses extends AbstractConstraint public function processAssert(CustomerAccountIndex $customerAccountIndex, Address $address) { $customerAccountIndex->getAccountMenuBlock()->openMenuItem('Account Dashboard'); + sleep(6); $defaultBillingAddress = explode( "\n", $customerAccountIndex->getDashboardAddress()->getDefaultBillingAddressText() diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml index 6cb8e9be7977dea87d5df2064d352578d2430a91..d5afd5538951e8d4ecddcfaaeb6820c742ce3e04 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Fixture/Customer.xml @@ -10,6 +10,9 @@ <dataset name="default"> <field name="firstname" xsi:type="string">John</field> <field name="lastname" xsi:type="string">Doe</field> + <field name="group_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">General</item> + </field> <field name="email" xsi:type="string">John.Doe%isolation%@example.com</field> <field name="password" xsi:type="string">123123q</field> <field name="password_confirmation" xsi:type="string">123123q</field> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php index 7e8cfe0865fd63cf4578bf6d565656402f5087e1..1831cdcbd2168ecca66ec836b256511705db838a 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php @@ -31,7 +31,8 @@ class Curl extends AbstractCurl implements CustomerInterface */ protected $mappingData = [ 'country_id' => [ - 'United States' => 'US' + 'United States' => 'US', + 'United Kingdom' => 'GB' ], 'region_id' => [ 'California' => 12, @@ -57,6 +58,16 @@ class Curl extends AbstractCurl implements CustomerInterface ] ]; + /** + * Fields that have to be send using update curl. + * + * @var array + */ + protected $fieldsToUpdate = [ + 'address', + 'group_id', + ]; + /** * Post request for creating customer in frontend * @@ -82,7 +93,8 @@ class Curl extends AbstractCurl implements CustomerInterface $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); $curl->close(); - if (!strpos($response, 'data-ui-id="global-messages-message-success"')) { + // After caching My Account page we cannot check by success message + if (!strpos($response, 'customer/account/logout')) { throw new \Exception("Customer entity creating by curl handler was not successful! Response: $response"); } @@ -91,8 +103,8 @@ class Curl extends AbstractCurl implements CustomerInterface if (!empty($address)) { $data['address'] = $address; - $this->addAddress($data); } + $this->updateCustomer($data); return $result; } @@ -130,16 +142,21 @@ class Curl extends AbstractCurl implements CustomerInterface } /** - * Add addresses in to customer account + * Update customer fields that can not be added at creation step. + * - address + * - group_id * * @param array $data * @return void * @throws \Exception */ - protected function addAddress(array $data) + protected function updateCustomer(array $data) { + $result = array_intersect($this->fieldsToUpdate, array_keys($data)); + if (empty($result)) { + return; + } $curlData = []; - $url = $_ENV['app_backend_url'] . 'customer/index/save/id/' . $data['customer_id']; foreach ($data as $key => $value) { foreach ($this->curlMapping as $prefix => $prefixValues) { if (in_array($key, $prefixValues)) { @@ -151,15 +168,18 @@ class Curl extends AbstractCurl implements CustomerInterface unset($data['password'], $data['password_confirmation']); $curlData = $this->replaceMappingData(array_merge($curlData, $data)); - $curlData = $this->prepareAddressData($curlData); + if (!empty($data['address'])) { + $curlData = $this->prepareAddressData($curlData); + } + $url = $_ENV['app_backend_url'] . 'customer/index/save/id/' . $data['customer_id']; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->write(CurlInterface::POST, $url, '1.0', [], $curlData); $response = $curl->read(); $curl->close(); if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \Exception('Failed to assign an address to the customer!'); + throw new \Exception('Failed to update customer!'); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php index 225aa4a5660264f6bdbfdac873c776f1c970ceff..90b432c8d47acde1326078a623e26c5389675c07 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php @@ -26,7 +26,7 @@ class DefaultAddress extends Page * * @var string */ - protected $defaultAddressesSelector = '.block-addresses-default .box-billing-address'; + protected $defaultAddressesSelector = '.block-addresses-default'; /** * Get default addresses block diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index 37b655390419d33bf60bbb5bb749efee2338ac96..3510a9b9750299ed9a985447233748352d2f66b0 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -149,6 +149,22 @@ <field name="fax" xsi:type="string">444-44-444-44</field> </dataset> + <dataset name="address_UK_default_billing_address"> + <field name="firstname" xsi:type="string">Jane</field> + <field name="lastname" xsi:type="string">Doe</field> + <field name="email" xsi:type="string">JaneDoe_%isolation%@example.com</field> + <field name="company" xsi:type="string">Magento %isolation%</field> + <field name="city" xsi:type="string">London</field> + <field name="street" xsi:type="string">172, Westminster Bridge Rd</field> + <field name="postcode" xsi:type="string">SE1 7RW</field> + <field name="country_id" xsi:type="string">United Kingdom</field> + <field name="region" xsi:type="string">London</field> + <field name="telephone" xsi:type="string">444-44-444-44</field> + <field name="fax" xsi:type="string">444-44-444-44</field> + <field name="default_billing" xsi:type="string">Yes</field> + <field name="default_shipping" xsi:type="string">Yes</field> + </dataset> + <dataset name="address_US_1"> <field name="firstname" xsi:type="string">John</field> <field name="lastname" xsi:type="string">Doe</field> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml index 1649cb7b9e41132872563d569e85628dc5b8d5a3..eeea09970da769ab9eb00d22491aa9b4d6937999 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Customer.xml @@ -18,6 +18,17 @@ <field name="password_confirmation" xsi:type="string">123123q</field> </dataset> + <dataset name="customer_with_new_customer_group"> + <field name="firstname" xsi:type="string">John</field> + <field name="lastname" xsi:type="string">Doe</field> + <field name="group_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">customer_group_retail_customer</item> + </field> + <field name="email" xsi:type="string">JohnDoe_%isolation%@example.com</field> + <field name="password" xsi:type="string">123123q</field> + <field name="password_confirmation" xsi:type="string">123123q</field> + </dataset> + <dataset name="johndoe"> <field name="firstname" xsi:type="string">John</field> <field name="lastname" xsi:type="string">Doe</field> @@ -183,5 +194,16 @@ <item name="presets" xsi:type="string">address_UK</item> </field> </dataset> + + <dataset name="customer_UK_1_default_billing_address"> + <field name="firstname" xsi:type="string">John</field> + <field name="lastname" xsi:type="string">Doe%isolation%</field> + <field name="email" xsi:type="string">John.Doe%isolation%@example.com</field> + <field name="password" xsi:type="string">123123q</field> + <field name="password_confirmation" xsi:type="string">123123q</field> + <field name="address" xsi:type="array"> + <item name="presets" xsi:type="string">address_UK_default_billing_address</item> + </field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml index ed4fa8d8b49ebb0960141fbd1b87a5bedbeae5e6..0ac1bbdda5d592747ead4826b8cf9242c933cf1e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/CustomerGroupInjectable.xml @@ -43,5 +43,12 @@ <item name="dataSet" xsi:type="string">retail_customer</item> </field> </dataset> + + <dataset name="customer_group_retail_customer"> + <field name="customer_group_code" xsi:type="string">Customer_group_%isolation%</field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataSet" xsi:type="string">retail_customer</item> + </field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml index 39290c7f86b8a8f127afaed30ec458ab058c4e14..a939641976d0a71b01f4a743d0d57eb171c3316f 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml @@ -8,14 +8,14 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Customer\Test\TestCase\CreateCustomerGroupEntityTest"> <variation name="CreateCustomerGroupEntityTestVariation1"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">Retail Customer</data> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> <data name="customerGroup/data/customer_group_code" xsi:type="string">GroupName%isolation%</data> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage"/> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid"/> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm"/> </variation> <variation name="CreateCustomerGroupEntityTestVariation2"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">Retail Customer</data> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> <data name="customerGroup/data/customer_group_code" xsi:type="string">General</data> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupAlreadyExists"/> </variation> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php index 36cb46a29b4eed4f0716feecbbf02149c5a61f7a..a2fdc4922e7a127cb958d10787802e0807ff3429 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/DeleteCustomerAddressTest.php @@ -13,21 +13,17 @@ use Magento\Customer\Test\Page\CustomerAccountLogin; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for DeleteCustomerAddress - * - * Test Flow: - * * Preconditions: - * 1. Create customer - * 2. Add default address (NY) - * 3. Add one more address (CA) + * 1. Create customer. + * 2. Add default address (NY). + * 3. Add one more address (CA). * * Steps: - * 1. Open frontend - * 2. Login as customer - * 3. Go to 'Address Book' tab > Additional Address Entries - * 4. Delete second address - click 'Delete Address' button - * 5. Perform all assertions + * 1. Open frontend. + * 2. Login as customer. + * 3. Go to 'Address Book' tab > Additional Address Entries. + * 4. Delete second address - click 'Delete Address' button. + * 5. Perform all assertions. * * @group Customers_(CS) * @ZephyrId MAGETWO-28066 @@ -40,28 +36,28 @@ class DeleteCustomerAddressTest extends Injectable /* end tags */ /** - * Cms index page + * Cms index page. * * @var CmsIndex */ protected $cmsIndex; /** - * Customer login page + * Customer login page. * * @var CustomerAccountLogin */ protected $customerAccountLogin; /** - * Customer index page + * Customer index page. * * @var CustomerAccountIndex */ protected $customerAccountIndex; /** - * Prepare pages for test + * Prepare pages for test. * * @param CustomerAccountLogin $customerAccountLogin * @param CmsIndex $cmsIndex @@ -79,13 +75,14 @@ class DeleteCustomerAddressTest extends Injectable } /** - * Runs Delete Customer Address test + * Runs Delete Customer Address test. * * @param Customer $customer * @return array */ public function test(Customer $customer) { + $this->markTestIncomplete('Bug: MAGETWO-34634'); // Precondition: $customer->persist(); $addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[1]; diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..a8b352b7514ee376f664f20cb9958c70d351ae18 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest22"> + <data name="menuItem" xsi:type="string">Customers > All Customers</data> + <data name="pageTitle" xsi:type="string">Customers</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest23"> + <data name="menuItem" xsi:type="string">Customers > Now Online</data> + <data name="pageTitle" xsi:type="string">Customers Now Online</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest24"> + <data name="menuItem" xsi:type="string">Stores > Customer Groups</data> + <data name="pageTitle" xsi:type="string">Customer Groups</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php index 5fdcc4b7c39932cc2f0ab925a8f79d8f8b6d40fe..036c03c76f7e381b633155db19993757a37ceadd 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerFrontendEntityTest.php @@ -134,6 +134,7 @@ class UpdateCustomerFrontendEntityTest extends Injectable // Steps $this->cmsIndex->open(); $this->cmsIndex->getLinksBlock()->openLink('Log In'); + sleep(3); $this->customerAccountLogin->getLoginBlock()->fill($initialCustomer); $this->customerAccountLogin->getLoginBlock()->submit(); diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml index 84116576ab62ef13b0ab3fbd272e35a1b94eb6ca..198270813fc12df42be6cae0e92cbdce385bd16b 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/UpdateCustomerGroupEntityTest.xml @@ -8,7 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Customer\Test\TestCase\UpdateCustomerGroupEntityTest"> <variation name="UpdateCustomerGroupEntityTestVariation1"> - <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail Customer</data> + <data name="customerGroup/data/tax_class_id/dataSet" xsi:type="string">retail_customer</data> <data name="customerGroup/data/customer_group_code" xsi:type="string">GroupName%isolation%</data> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage"/> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid"/> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php index 745b576a528abc0e4c0543bc6855563d69f68055..b305528390cf0b200c7d867450459f2af2e3d576 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LoginCustomerOnFrontendStep.php @@ -61,7 +61,7 @@ class LoginCustomerOnFrontendStep implements TestStepInterface public function run() { $this->cmsIndex->open(); - $this->cmsIndex->getLinksBlock()->waitWelcomeMessage(); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) { $this->cmsIndex->getLinksBlock()->openLink("Log Out"); $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page'); diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php index 57fb8c5d9527d6aef60e7d82d67b317bea811a58..8e3861485f44756cd873591898ba6a2aafc30b4f 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php @@ -39,6 +39,7 @@ class LogoutCustomerOnFrontendStep implements TestStepInterface public function run() { $this->cmsIndex->open(); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); if ($this->cmsIndex->getLinksBlock()->isLinkVisible("Log Out")) { $this->cmsIndex->getLinksBlock()->openLink("Log Out"); $this->cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible('Home Page'); diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php index a68a64dc05794cd5046a5e82ab72023bad9d200e..e620a4ca4ac6ad2617a4a0f45492358fc05f0be5 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProduct/CheckoutData.php @@ -29,7 +29,7 @@ class CheckoutData extends \Magento\Catalog\Test\Fixture\CatalogProductSimple\Ch 'options' => [ 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes', ], ], @@ -43,11 +43,11 @@ class CheckoutData extends \Magento\Catalog\Test\Fixture\CatalogProductSimple\Ch 'options' => [ 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes', ], [ - 'label' => 'link_2', + 'label' => 'link_1', 'value' => 'Yes' ], ], @@ -75,7 +75,7 @@ class CheckoutData extends \Magento\Catalog\Test\Fixture\CatalogProductSimple\Ch 'options' => [ 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes', ], ], @@ -92,7 +92,7 @@ class CheckoutData extends \Magento\Catalog\Test\Fixture\CatalogProductSimple\Ch ], 'links' => [ [ - 'label' => 'link_1', + 'label' => 'link_0', 'value' => 'Yes' ] ], diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..1409e9a0d2f08893d5f2422654ca1cdd2e2b3fc4 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/DuplicateProductEntityTest.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Catalog\Test\TestCase\Product\DuplicateProductEntityTest"> + <variation name="DuplicateProductEntityTestVariation3" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> + <data name="productType" xsi:type="string">downloadableProduct::default</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateMessage" next="Magento\Downloadable\Test\Constraint\AssertDownloadableDuplicateForm" /> + <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableDuplicateForm" next="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicatedInGrid" next="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductDuplicateIsNotDisplayingOnFrontend" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..dccd3aa8972084cc1b05ed09a0705658446203d1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Email/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest29"> + <data name="menuItem" xsi:type="string">Marketing > Email Templates</data> + <data name="pageTitle" xsi:type="string">Email Templates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php index 4d111e4a6f603754f3ce8fed33d09ee0950b8fa8..a9a17c123c4c1b44d43312727d49111b29735da7 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/Constraint/AssertGiftMessageInFrontendOrderItems.php @@ -10,7 +10,7 @@ use Magento\Customer\Test\Fixture\Customer; use Magento\Customer\Test\Page\CustomerAccountLogout; use Magento\GiftMessage\Test\Fixture\GiftMessage; use Magento\Sales\Test\Page\OrderHistory; -use Magento\Sales\Test\Page\SalesOrderView; +use Magento\Sales\Test\Page\CustomerOrderView; use Magento\Mtf\Constraint\AbstractConstraint; /** @@ -25,7 +25,7 @@ class AssertGiftMessageInFrontendOrderItems extends AbstractConstraint * @param GiftMessage $giftMessage * @param Customer $customer * @param OrderHistory $orderHistory - * @param SalesOrderView $salesOrderView + * @param CustomerOrderView $customerOrderView * @param CustomerAccountLogout $customerAccountLogout * @param string $orderId * @param array $products @@ -35,7 +35,7 @@ class AssertGiftMessageInFrontendOrderItems extends AbstractConstraint GiftMessage $giftMessage, Customer $customer, OrderHistory $orderHistory, - SalesOrderView $salesOrderView, + CustomerOrderView $customerOrderView, CustomerAccountLogout $customerAccountLogout, $orderId, $products = [] @@ -64,7 +64,7 @@ class AssertGiftMessageInFrontendOrderItems extends AbstractConstraint } \PHPUnit_Framework_Assert::assertEquals( $expectedData, - $salesOrderView->getGiftMessageForItemBlock()->getGiftMessage($product->getName()), + $customerOrderView->getGiftMessageForItemBlock()->getGiftMessage($product->getName()), 'Wrong gift message is displayed on "' . $product->getName() . '" item.' ); } diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/scenario.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/scenario.xml deleted file mode 100644 index 10cedb90faf834d7390a7d9176672135b79e70c5..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/scenario.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<scenarios xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Config/etc/scenario.xsd"> - <scenario name="CheckoutWithGiftMessagesTest" module="Magento_GiftMessage"> - <methods> - <method name="test"> - <steps> - <first>setupConfiguration</first> - <step name="setupConfiguration" module="Magento_Core"> - <arguments> - <item name="configData">cashondelivery, enable_gift_messages</item> - </arguments> - <next>createProducts</next> - </step> - <step name="createProducts" module="Magento_Catalog"> - <next>createCustomer</next> - </step> - <step name="createCustomer" module="Magento_Customer"> - <next>loginCustomerOnFrontend</next> - </step> - <step name="loginCustomerOnFrontend" module="Magento_Customer"> - <next>addProductsToTheCart</next> - </step> - <step name="addProductsToTheCart" module="Magento_Checkout"> - <next>proceedToCheckout</next> - </step> - <step name="proceedToCheckout" module="Magento_Checkout"> - <next>fillBillingInformation</next> - </step> - <step name="fillBillingInformation" module="Magento_Checkout"> - <next>fillShippingMethod</next> - </step> - <step name="addGiftMessage" module="Magento_GiftMessage"> - <next>fillShippingMethod</next> - </step> - <step name="fillShippingMethod" module="Magento_Checkout"> - <next>selectPaymentMethod</next> - </step> - <step name="selectPaymentMethod" module="Magento_Checkout"> - <next>placeOrder</next> - </step> - <step name="placeOrder" module="Magento_Checkout" /> - </steps> - </method> - </methods> - </scenario> - <scenario name="CreateGiftMessageOnBackendTest" module="Magento_GiftMessage"> - <methods> - <method name="test"> - <steps> - <first>setupConfiguration</first> - <step name="setupConfiguration" module="Magento_Core"> - <arguments> - <item name="configData">cashondelivery, enable_gift_messages</item> - </arguments> - <next>createProducts</next> - </step> - <step name="createProducts" module="Magento_Catalog"> - <next>createCustomer</next> - </step> - <step name="createCustomer" module="Magento_Customer"> - <arguments> - <items name="customer"> - <item name="dataSet">johndoe_with_addresses</item> - </items> - </arguments> - <next>openSalesOrders</next> - </step> - <step name="openSalesOrders" module="Magento_Sales"> - <next>createNewOrder</next> - </step> - <step name="createNewOrder" module="Magento_Sales"> - <next>selectCustomerOrder</next> - </step> - <step name="selectCustomerOrder" module="Magento_Sales"> - <next>selectStore</next> - </step> - <step name="selectStore" module="Magento_Sales"> - <next>addProducts</next> - </step> - <step name="addProducts" module="Magento_Sales"> - <next>addGiftMessageBackend</next> - </step> - <step name="addGiftMessageBackend" module="Magento_GiftMessage"> - <next>fillBillingAddress</next> - </step> - <step name="fillBillingAddress" module="Magento_Sales"> - <next>selectPaymentMethodForOrder</next> - </step> - <step name="selectPaymentMethodForOrder" module="Magento_Sales"> - <next>selectShippingMethodForOrder</next> - </step> - <step name="selectShippingMethodForOrder" module="Magento_Sales"> - <next>submitOrder</next> - </step> - <step name="submitOrder" module="Magento_Sales" /> - </steps> - </method> - </methods> - </scenario> -</scenarios> diff --git a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml index 06784435184291fa7692da85704268f3401f4a3d..44be0fed9e25d120a412c63d54967587ab3d184a 100644 --- a/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/GiftMessage/Test/etc/testcase.xml @@ -6,40 +6,40 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> - <scenario name="CheckoutWithGiftMessagesTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"> - <item name="configData" value="cashondelivery, enableGiftMessages"/> - </step> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend"/> - <step name="loginCustomerOnFrontend" module="Magento_Customer" next="addProductsToTheCart"/> - <step name="addProductsToTheCart" module="Magento_Checkout" next="proceedToCheckout"/> - <step name="proceedToCheckout" module="Magento_Checkout" next="fillBillingInformation"/> - <step name="fillBillingInformation" module="Magento_Checkout" next="fillShippingMethod"/> - <step name="addGiftMessage" module="Magento_GiftMessage" next="fillShippingMethod"/> - <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod"/> - <step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder"/> - <step name="placeOrder" module="Magento_Checkout"/> - </scenario> - <scenario name="CreateGiftMessageOnBackendTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"> - <item name="configData" value="cashondelivery, enableGiftMessages"/> - </step> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> - <item name="customer"> - <item name="dataSet" value="johndoe_with_addresses"/> - </item> - </step> - <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder"/> - <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder"/> - <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore"/> - <step name="selectStore" module="Magento_Sales" next="addProducts"/> - <step name="addProducts" module="Magento_Sales" next="addGiftMessageBackend"/> - <step name="addGiftMessageBackend" module="Magento_GiftMessage" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"/> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"/> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales"/> - </scenario> + <scenario name="CheckoutWithGiftMessagesTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createProducts"> + <item name="configData" value="cashondelivery, enable_gift_messages" /> + </step> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend" /> + <step name="loginCustomerOnFrontend" module="Magento_Customer" next="addProductsToTheCart" /> + <step name="addProductsToTheCart" module="Magento_Checkout" next="proceedToCheckout" /> + <step name="proceedToCheckout" module="Magento_Checkout" next="fillBillingInformation" /> + <step name="fillBillingInformation" module="Magento_Checkout" next="addGiftMessage" /> + <step name="addGiftMessage" module="Magento_GiftMessage" next="fillShippingMethod" /> + <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod" /> + <step name="selectPaymentMethod" module="Magento_Checkout" next="placeOrder" /> + <step name="placeOrder" module="Magento_Checkout" /> + </scenario> + <scenario name="CreateGiftMessageOnBackendTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createProducts"> + <item name="configData" value="cashondelivery, enable_gift_messages" /> + </step> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> + <item name="customer"> + <item name="dataSet" value="johndoe_with_addresses" /> + </item> + </step> + <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder" /> + <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder" /> + <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addProducts" /> + <step name="addProducts" module="Magento_Sales" next="addGiftMessageBackend" /> + <step name="addGiftMessageBackend" module="Magento_GiftMessage" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder" /> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder" /> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" /> + </scenario> </config> diff --git a/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..528dc68a50b1ca268c00da11e502a530592fff3b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/GoogleShopping/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest33"> + <data name="menuItem" xsi:type="string">Products > Attributes</data> + <data name="pageTitle" xsi:type="string">Google Content Attributes</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest34"> + <data name="menuItem" xsi:type="string">Products > Items</data> + <data name="pageTitle" xsi:type="string">Google Content Items</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php index e7605924ad25889e630046ccac227fab7528dc1c..0a883fed4545d3f2d6eab56bd8e495b3fe549729 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.php @@ -12,10 +12,6 @@ use Magento\GroupedProduct\Test\Fixture\GroupedProduct; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for Update GroupedProductEntity - * - * Test Flow: - * * Preconditions: * 1. Create Grouped Product. * @@ -38,21 +34,21 @@ class UpdateGroupedProductEntityTest extends Injectable /* end tags */ /** - * Page product on backend + * Page product on backend. * * @var CatalogProductIndex */ protected $catalogProductIndex; /** - * Edit page on backend + * Edit page on backend. * * @var CatalogProductEdit */ protected $catalogProductEdit; /** - * Filling objects of the class + * Filling objects of the class. * * @param CatalogProductIndex $catalogProductIndexNewPage * @param CatalogProductEdit $catalogProductEditPage @@ -67,7 +63,7 @@ class UpdateGroupedProductEntityTest extends Injectable } /** - * Test update grouped product + * Test update grouped product. * * @param GroupedProduct $product * @param GroupedProduct $originalProduct diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml index dd1f2144e4e3f9fd9c606ff96d7e9866fd79b27a..cc918d24c96e699998e7896553dc3d225ebe8250 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/TestCase/UpdateGroupedProductEntityTest.xml @@ -6,78 +6,59 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\GroupedProduct\Test\TestCase\UpdateGroupedProductEntityTest"> - <variation name="UpdateGroupedProductEntityTestVariation1"> - <data name="originalProduct/dataSet" xsi:type="string">grouped_product_out_of_stock</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> - <data name="product/data/category_ids/presets" xsi:type="string">category_%isolation%</data> - <data name="product/data/associated/products" xsi:type="string">-</data> - <data name="product/data/associated/preset" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">This is edited description for grouped product</data> - <data name="product/data/short_description" xsi:type="string">This is edited short description for grouped product</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation2"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">catalogProductVirtual::default,catalogProductVirtual::product_50_dollar</data> - <data name="product/data/associated/preset" xsi:type="string">defaultVirtualProduct</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation3"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductSimple::default</data> - <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_without_qty</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductsDefaultQty"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation4"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">-</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::withSpecialPrice,catalogProductSimple::withSpecialPrice</data> - <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_with_specialPrice</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - <constraint name="Magento\GroupedProduct\Test\Constraint\AssertSpecialPriceOnGroupedProductPage"/> - </variation> - <variation name="UpdateGroupedProductEntityTestVariation5" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test"> - <data name="originalProduct/dataSet" xsi:type="string">default</data> - <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> - <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> - <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> - <data name="product/data/category_ids/presets" xsi:type="string">-</data> - <data name="product/data/associated/products" xsi:type="string">-</data> - <data name="product/data/associated/preset" xsi:type="string">-</data> - <data name="product/data/description" xsi:type="string">-</data> - <data name="product/data/short_description" xsi:type="string">-</data> - <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" next="Magento\Catalog\Test\Constraint\AssertProductOutOfStock"/> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" prev="Magento\Catalog\Test\Constraint\AssertProductSaveMessage"/> - </variation> - </testCase> + <testCase name="Magento\GroupedProduct\Test\TestCase\UpdateGroupedProductEntityTest"> + <variation name="UpdateGroupedProductEntityTestVariation1"> + <data name="originalProduct/dataSet" xsi:type="string">grouped_product_out_of_stock</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">In Stock</data> + <data name="product/data/category_ids/presets" xsi:type="string">category_%isolation%</data> + <data name="product/data/description" xsi:type="string">This is edited description for grouped product</data> + <data name="product/data/short_description" xsi:type="string">This is edited short description for grouped product</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation2"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/associated/products" xsi:type="string">catalogProductVirtual::default,catalogProductVirtual::product_50_dollar</data> + <data name="product/data/associated/preset" xsi:type="string">defaultVirtualProduct</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation3"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::simple_for_composite_products,catalogProductSimple::default</data> + <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_without_qty</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductsDefaultQty" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertGroupedProductForm" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation4"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/associated/products" xsi:type="string">catalogProductSimple::withSpecialPrice,catalogProductSimple::withSpecialPrice</data> + <data name="product/data/associated/preset" xsi:type="string">defaultSimpleProduct_with_specialPrice</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\GroupedProduct\Test\Constraint\AssertSpecialPriceOnGroupedProductPage" /> + </variation> + <variation name="UpdateGroupedProductEntityTestVariation5"> + <data name="originalProduct/dataSet" xsi:type="string">default</data> + <data name="product/data/name" xsi:type="string">GroupedProduct_edited %isolation%</data> + <data name="product/data/sku" xsi:type="string">GroupedProduct_sku_edited %isolation%</data> + <data name="product/data/quantity_and_stock_status/is_in_stock" xsi:type="string">Out of Stock</data> + <data name="product/data/url_key" xsi:type="string">updated-grouped-product-%isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertProductOutOfStock" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/ImportExport/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/ImportExport/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a696047e1e9976dd840d72c6dc53071e494c40 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/ImportExport/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest35"> + <data name="menuItem" xsi:type="string">System > Import</data> + <data name="pageTitle" xsi:type="string">Import</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest36"> + <data name="menuItem" xsi:type="string">System > Export</data> + <data name="pageTitle" xsi:type="string">Export</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Indexer/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Indexer/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..0a1afb249ef8f60fa62a9be36a73c9425e769f8a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Indexer/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest37"> + <data name="menuItem" xsi:type="string">System > Index Management</data> + <data name="pageTitle" xsi:type="string">Index Management</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab448ae81e249a63f1fb3eb8937b68536b69e800 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest38"> + <data name="menuItem" xsi:type="string">System > Integrations</data> + <data name="pageTitle" xsi:type="string">Integrations</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php b/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php index 23b69f71234439c9db12a7ae60740aaa245affc6..a05c605294479ab13de8186fecd56db3f5240a7f 100644 --- a/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php +++ b/dev/tests/functional/tests/app/Magento/Multishipping/Test/TestStep/ProceedToMultipleAddressCheckoutStep.php @@ -35,6 +35,7 @@ class ProceedToMultipleAddressCheckoutStep implements TestStepInterface */ public function run() { + $this->checkoutCart->open(); $this->checkoutCart->getMultipleAddressCheckoutBlock()->multipleAddressesCheckout(); } } diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php index 3de754dffa925d1f920b77c079b0df95a6cf63c7..098fff98e7ec599c1de64a2f55908e91005aa090 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Template/Preview.php @@ -45,6 +45,9 @@ class Preview extends Block ); $this->browser->switchToFrame(new Locator($this->iFrame)); - return $this->_rootElement->getText(); + $content = $this->_rootElement->getText(); + + $this->browser->switchToFrame(); + return $content; } } diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..b830ba8af1c5d1620cde6a20799b327c06fee910 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest46"> + <data name="menuItem" xsi:type="string">Marketing > Newsletter Template</data> + <data name="pageTitle" xsi:type="string">Newsletter Templates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest47"> + <data name="menuItem" xsi:type="string">Marketing > Newsletter Queue</data> + <data name="pageTitle" xsi:type="string">Newsletter Queue</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest48"> + <data name="menuItem" xsi:type="string">Marketing > Newsletter Subscribers</data> + <data name="pageTitle" xsi:type="string">Newsletter Subscribers</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest49"> + <data name="menuItem" xsi:type="string">Reports > Newsletter Problem Reports</data> + <data name="pageTitle" xsi:type="string">Newsletter Problems Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..46bb69f248a90ac90a6f816564fc4e1504af4480 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest55"> + <data name="menuItem" xsi:type="string">Reports > Products in Cart</data> + <data name="pageTitle" xsi:type="string">Products in Carts</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest56"> + <data name="menuItem" xsi:type="string">Reports > Abandoned Carts</data> + <data name="pageTitle" xsi:type="string">Abandoned Carts</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest57"> + <data name="menuItem" xsi:type="string">Reports > Orders</data> + <data name="pageTitle" xsi:type="string">Sales Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest58"> + <data name="menuItem" xsi:type="string">Reports > Tax</data> + <data name="pageTitle" xsi:type="string">Tax Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest59"> + <data name="menuItem" xsi:type="string">Reports > Invoiced</data> + <data name="pageTitle" xsi:type="string">Invoice Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest60"> + <data name="menuItem" xsi:type="string">Reports > Coupons</data> + <data name="pageTitle" xsi:type="string">Coupons Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest61"> + <data name="menuItem" xsi:type="string">Reports > Order Total</data> + <data name="pageTitle" xsi:type="string">Order Total Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest62"> + <data name="menuItem" xsi:type="string">Reports > Order Count</data> + <data name="pageTitle" xsi:type="string">Order Count Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest63"> + <data name="menuItem" xsi:type="string">Reports > New</data> + <data name="pageTitle" xsi:type="string">New Accounts Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest64"> + <data name="menuItem" xsi:type="string">Reports > Views</data> + <data name="pageTitle" xsi:type="string">Product Views Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest65"> + <data name="menuItem" xsi:type="string">Reports > Bestsellers</data> + <data name="pageTitle" xsi:type="string">Best Sellers Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest66"> + <data name="menuItem" xsi:type="string">Reports > Low Stock</data> + <data name="pageTitle" xsi:type="string">Low Stock Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest67"> + <data name="menuItem" xsi:type="string">Reports > Ordered</data> + <data name="pageTitle" xsi:type="string">Ordered Products Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest68"> + <data name="menuItem" xsi:type="string">Reports > Downloads</data> + <data name="pageTitle" xsi:type="string">Downloads Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest69"> + <data name="menuItem" xsi:type="string">Reports > Refresh statistics</data> + <data name="pageTitle" xsi:type="string">Refresh Statistics</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php index f00195c8369134c2a1b2f0862a58684b9bea7aee..f71fd73490e3a6cdebede5f6ffc28436c531e5e5 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/NewAccountsReportEntityTest.php @@ -70,7 +70,7 @@ class NewAccountsReportEntityTest extends Injectable */ public function test(Customer $customer, array $customersReport) { - $this->markTestIncomplete('MAGETWO-26663'); + $this->markTestIncomplete('Bug: MAGETWO-35037'); // Preconditions $this->customerIndexPage->open(); $this->customerIndexPage->getCustomerGridBlock()->massaction([], 'Delete', true, 'Select All'); diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php index a850585fabc198be53980992942c8c1d4a31a29c..b260e667b7fd17172b5c57dcfe38cf95035b39b9 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.php @@ -65,7 +65,6 @@ class ViewedProductsReportEntityTest extends Injectable */ public function __prepare(CatalogProductIndex $catalogProductIndexPage) { - $this->markTestIncomplete('Bug: MAGETWO-33029'); $catalogProductIndexPage->open(); $catalogProductIndexPage->getProductGrid()->massaction([], 'Delete', true, 'Select All'); } diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml index 631230c2956a1f82997324a253d466491cfc3120..b0d0b350efa711f84fc0addab09a1e5dc7b6f95f 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/TestCase/ViewedProductsReportEntityTest.xml @@ -6,36 +6,36 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Reports\Test\TestCase\ViewedProductsReportEntityTest"> - <variation name="ViewedProductsReportEntityTestVariation1"> - <data name="description" xsi:type="string">view products on front and verify they all reflected in Year report</data> - <data name="total" xsi:type="string">2, 1</data> - <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> - <data name="viewsReport/period_type" xsi:type="string">Year</data> - <data name="viewsReport/from" xsi:type="string">m/d/Y -1 year</data> - <data name="viewsReport/to" xsi:type="string">m/d/Y</data> - <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> - <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult"/> - </variation> - <variation name="ViewedProductsReportEntityTestVariation2"> - <data name="description" xsi:type="string">view products on front and verify they all reflected in Month report</data> - <data name="total" xsi:type="string">1, 1</data> - <data name="products" xsi:type="string">downloadableProduct::default, bundleProduct::bundle_dynamic_product</data> - <data name="viewsReport/period_type" xsi:type="string">Month</data> - <data name="viewsReport/from" xsi:type="string">m/d/Y</data> - <data name="viewsReport/to" xsi:type="string">m/d/Y</data> - <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> - <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult"/> - </variation> - <variation name="ViewedProductsReportEntityTestVariation3"> - <data name="description" xsi:type="string">view products on front and verify they all reflected in Day report</data> - <data name="total" xsi:type="string">1, 1</data> - <data name="products" xsi:type="string">configurableProduct::default, groupedProduct::default</data> - <data name="viewsReport/period_type" xsi:type="string">Day</data> - <data name="viewsReport/from" xsi:type="string">m/d/Y -1 day</data> - <data name="viewsReport/to" xsi:type="string">m/d/Y +1 day</data> - <data name="viewsReport/show_empty_rows" xsi:type="string">Yes</data> - <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult"/> - </variation> - </testCase> + <testCase name="Magento\Reports\Test\TestCase\ViewedProductsReportEntityTest"> + <variation name="ViewedProductsReportEntityTestVariation1"> + <data name="description" xsi:type="string">View products on front and verify they all reflected in Year report.</data> + <data name="total" xsi:type="string">1, 1</data> + <data name="products" xsi:type="string">catalogProductSimple::default, catalogProductVirtual::default</data> + <data name="viewsReport/period_type" xsi:type="string">Year</data> + <data name="viewsReport/from" xsi:type="string">m/d/Y -1 year</data> + <data name="viewsReport/to" xsi:type="string">m/d/Y</data> + <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult" /> + </variation> + <variation name="ViewedProductsReportEntityTestVariation2"> + <data name="description" xsi:type="string">View products on front and verify they all reflected in Month report.</data> + <data name="total" xsi:type="string">1, 1</data> + <data name="products" xsi:type="string">downloadableProduct::default, bundleProduct::bundle_dynamic_product</data> + <data name="viewsReport/period_type" xsi:type="string">Month</data> + <data name="viewsReport/from" xsi:type="string">m/d/Y - 1 month</data> + <data name="viewsReport/to" xsi:type="string">m/d/Y</data> + <data name="viewsReport/show_empty_rows" xsi:type="string">No</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult" /> + </variation> + <variation name="ViewedProductsReportEntityTestVariation3"> + <data name="description" xsi:type="string">View products on front and verify they all reflected in Day report.</data> + <data name="total" xsi:type="string">1, 1</data> + <data name="products" xsi:type="string">configurableProduct::default, groupedProduct::default</data> + <data name="viewsReport/period_type" xsi:type="string">Day</data> + <data name="viewsReport/from" xsi:type="string">m/d/Y -1 day</data> + <data name="viewsReport/to" xsi:type="string">m/d/Y +1 day</data> + <data name="viewsReport/show_empty_rows" xsi:type="string">Yes</data> + <constraint name="Magento\Reports\Test\Constraint\AssertProductViewsReportTotalResult" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php index 6d38c764c63b992e2c806ee104a03f20ac0ac94e..d2042d8a8370e0c044c87d0a688e3e16e8a70ef2 100644 --- a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/CreateProductReviewBackendEntityTest.php @@ -80,16 +80,6 @@ class CreateProductReviewBackendEntityTest extends Injectable */ protected $review; - /** - * Skip test due to a Magento bug. - * - * @return void - */ - public function __prepare() - { - $this->markTestIncomplete('Bug: MAGETWO-33912'); - } - /** * Inject pages into test * diff --git a/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c68c7f55f9697e6a31b8f494d3056b1a6e6c345 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Review/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest70"> + <data name="menuItem" xsi:type="string">Marketing > Reviews</data> + <data name="pageTitle" xsi:type="string">Reviews</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest71"> + <data name="menuItem" xsi:type="string">Reports > By Customers</data> + <data name="pageTitle" xsi:type="string">Customer Reviews Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest72"> + <data name="menuItem" xsi:type="string">Reports > By Products</data> + <data name="pageTitle" xsi:type="string">Product Reviews Report</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest73"> + <data name="menuItem" xsi:type="string">Stores > Rating</data> + <data name="pageTitle" xsi:type="string">Ratings</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php index 09919efbd1dba62122652d3e52e1317cd4005028..f402dd1f6273ce61c7acdb242a7ac34495b8fe14 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Grid.php @@ -10,48 +10,49 @@ use Magento\Backend\Test\Block\Widget\Grid as GridInterface; use Magento\Mtf\Client\Locator; /** - * Class Grid - * Sales order grid + * Sales order grid. */ class Grid extends GridInterface { /** - * 'Add New' order button + * 'Add New' order button. * * @var string */ protected $addNewOrder = "../*[@class='page-actions']//*[@id='add']"; /** - * Purchase Point Filter selector + * Purchase Point Filter selector. * * @var string */ protected $purchasePointFilter = '//*[@data-ui-id="widget-grid-column-filter-store-0-filter-store-id"]'; /** - * Purchase Point Filter option group elements selector + * Purchase Point Filter option group elements selector. * * @var string */ protected $purchasePointOptGroup = '//*[@data-ui-id="widget-grid-column-filter-store-0-filter-store-id"]/optgroup'; /** - * Order Id td selector + * Order Id td selector. * * @var string */ protected $editLink = 'td[class*=col-action] a'; /** - * First row selector + * First row selector. * * @var string */ protected $firstRowSelector = '//tbody/tr[1]//a'; /** - * {@inheritdoc} + * Filters array mapping. + * + * @var array */ protected $filters = [ 'id' => [ @@ -64,7 +65,7 @@ class Grid extends GridInterface ]; /** - * Start to create new order + * Start to create new order. */ public function addNewOrder() { @@ -72,24 +73,20 @@ class Grid extends GridInterface } /** - * Get selected data from Purchase Point filter + * Get StoreGroup list of Purchase Point on filter. * - * @return string + * @return array */ - public function getPurchasePointFilterText() + public function getPurchasePointStoreGroups() { - return $this->_rootElement->find($this->purchasePointFilter, Locator::SELECTOR_XPATH)->getText(); - } + $storeGroupElements = $this->_rootElement->find($this->purchasePointFilter, Locator::SELECTOR_XPATH) + ->getElements('.//optgroup[./option]', Locator::SELECTOR_XPATH); + $result = []; - /** - * Assert the number of Purchase Point Filter option group elements by checking non-existing group - * - * @param $number - * @return bool - */ - public function assertNumberOfPurchasePointFilterOptionsGroup($number) - { - $selector = $this->purchasePointOptGroup . '[' . ($number + 1) . ']'; - return !$this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->isVisible(); + foreach ($storeGroupElements as $storeGroupElement) { + $result[] = trim($storeGroupElement->getAttribute('label'), ' '); + } + + return $result; } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php index 893bde7b41f364ff54b3e62ea3a2b3f51fe919eb..fda4c7814591b1d4dd2faad01cc954c2dd5300e1 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertReorderStatusIsCorrect.php @@ -36,8 +36,8 @@ class AssertReorderStatusIsCorrect extends AbstractConstraint $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); \PHPUnit_Framework_Assert::assertEquals( - $salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), $previousOrderStatus, + $salesOrderView->getOrderForm()->getOrderInfoBlock()->getOrderStatus(), 'Order status is incorrect on order page in backend.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..0278a74760af2adf5f5a107e7f79fdd0784749c5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest77"> + <data name="menuItem" xsi:type="string">Sales > Orders</data> + <data name="pageTitle" xsi:type="string">Orders</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest78"> + <data name="menuItem" xsi:type="string">Sales > Invoices</data> + <data name="pageTitle" xsi:type="string">Invoices</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest79"> + <data name="menuItem" xsi:type="string">Sales > Shipments</data> + <data name="pageTitle" xsi:type="string">Shipments</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest80"> + <data name="menuItem" xsi:type="string">Sales > Credit Memos</data> + <data name="pageTitle" xsi:type="string">Credit Memos</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest81"> + <data name="menuItem" xsi:type="string">Sales > Transactions</data> + <data name="pageTitle" xsi:type="string">Transactions</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest82"> + <data name="menuItem" xsi:type="string">Stores > Order Status</data> + <data name="pageTitle" xsi:type="string">Order Status</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php index e873f8fc8e758e6c6a3d24c96c59c5ccdf3d6a3a..8deb7b0dbb0281e100c52c7fa5681bdbbb68f78d 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/FillBillingAddressStep.php @@ -42,7 +42,7 @@ class FillBillingAddressStep implements TestStepInterface * @param Address $billingAddress * @param string $saveAddress */ - public function __construct(OrderCreateIndex $orderCreateIndex, Address $billingAddress, $saveAddress) + public function __construct(OrderCreateIndex $orderCreateIndex, Address $billingAddress, $saveAddress = 'No') { $this->orderCreateIndex = $orderCreateIndex; $this->billingAddress = $billingAddress; diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml index c80098f59e6369bd9a4bf87bbe662ac9aba88bfe..f42ed2705b6c7a931d9b687d7127bd38e5238e30 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml @@ -6,72 +6,73 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/TestCase/etc/testcase.xsd"> - <scenario name="ReorderOrderEntityTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createOrder"/> - <step name="createOrder" module="Magento_Sales" next="openOrder"/> - <step name="openOrder" module="Magento_Sales" next="reorder"/> - <step name="reorder" module="Magento_Sales" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"/> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"/> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales"/> - </scenario> - <scenario name="CreateOrderBackendTest" firstStep="setupConfiguration"> - <step name="setupConfiguration" module="Magento_Core" next="createProducts"/> - <step name="createProducts" module="Magento_Catalog" next="createTaxRule"/> - <step name="createTaxRule" module="Magento_Tax" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"/> - <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder"/> - <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder"/> - <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore"/> - <step name="selectStore" module="Magento_Sales" next="addProducts"/> - <step name="addProducts" module="Magento_Sales" next="fillAccountInformation"/> - <step name="fillAccountInformation" module="Magento_Sales" next="updateProductsData"/> - <step name="updateProductsData" module="Magento_Sales" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"/> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"/> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales"/> - </scenario> - <scenario name="MoveRecentlyViewedProductsOnOrderPageTest" firstStep="createProducts"> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend"> - <item name="customer"> - <item name="dataSet" value="default"/> - </item> - </step> - <step name="loginCustomerOnFrontend" module="Magento_Customer" next="openProductsOnFrontend"/> - <step name="openProductsOnFrontend" module="Magento_Catalog" next="openCustomerOnBackend"/> - <step name="openCustomerOnBackend" module="Magento_Customer" next="createOrderFromCustomerAccount"/> - <step name="createOrderFromCustomerAccount" module="Magento_Customer" next="addRecentlyViewedProductsToCart"/> - <step name="addRecentlyViewedProductsToCart" module="Magento_Sales" next="configureProducts"/> - <step name="configureProducts" module="Magento_Sales"/> - </scenario> - <scenario name="PrintOrderFrontendGuestTest" firstStep="createProducts"> - <step name="createProducts" module="Magento_Catalog" next="createCustomer"/> - <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> - <item name="customer"> - <item name="dataSet" value="johndoe_with_addresses"/> - </item> - </step> - <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder"/> - <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder"/> - <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore"/> - <step name="selectStore" module="Magento_Sales" next="addProducts"/> - <step name="addProducts" module="Magento_Sales" next="fillBillingAddress"/> - <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"> - <item name="billingAddress"> - <item name="dataSet" value="customer_US"/> - </item> - </step> - <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"> - <item name="payment"> - <item name="method" value="checkmo"/> - </item> - </step> - <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder"/> - <step name="submitOrder" module="Magento_Sales" next="openSalesOrderOnFrontendForGuest"/> - <step name="openSalesOrderOnFrontendForGuest" module="Magento_Sales" next="printOrderOnFrontend"/> - <step name="printOrderOnFrontend" module="Magento_Sales"/> - </scenario> + <scenario name="ReorderOrderEntityTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createOrder" /> + <step name="createOrder" module="Magento_Sales" next="openOrder" /> + <step name="openOrder" module="Magento_Sales" next="reorder" /> + <step name="reorder" module="Magento_Sales" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder" /> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder" /> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" /> + </scenario> + <scenario name="CreateOrderBackendTest" firstStep="setupConfiguration"> + <step name="setupConfiguration" module="Magento_Core" next="createProducts" /> + <step name="createProducts" module="Magento_Catalog" next="createTaxRule" /> + <step name="createTaxRule" module="Magento_Tax" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="openSalesOrders" /> + <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder" /> + <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder" /> + <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addProducts" /> + <step name="addProducts" module="Magento_Sales" next="fillAccountInformation" /> + <step name="fillAccountInformation" module="Magento_Sales" next="updateProductsData" /> + <step name="updateProductsData" module="Magento_Sales" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder" /> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder" /> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" /> + </scenario> + <scenario name="MoveRecentlyViewedProductsOnOrderPageTest" firstStep="createProducts"> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="loginCustomerOnFrontend"> + <item name="customer"> + <item name="dataSet" value="default" /> + </item> + </step> + <step name="loginCustomerOnFrontend" module="Magento_Customer" next="openProductsOnFrontend" /> + <step name="openProductsOnFrontend" module="Magento_Catalog" next="openCustomerOnBackend" /> + <step name="openCustomerOnBackend" module="Magento_Customer" next="createOrderFromCustomerAccount" /> + <step name="createOrderFromCustomerAccount" module="Magento_Customer" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addRecentlyViewedProductsToCart" /> + <step name="addRecentlyViewedProductsToCart" module="Magento_Sales" next="configureProducts" /> + <step name="configureProducts" module="Magento_Sales" /> + </scenario> + <scenario name="PrintOrderFrontendGuestTest" firstStep="createProducts"> + <step name="createProducts" module="Magento_Catalog" next="createCustomer" /> + <step name="createCustomer" module="Magento_Customer" next="openSalesOrders"> + <item name="customer"> + <item name="dataSet" value="johndoe_with_addresses" /> + </item> + </step> + <step name="openSalesOrders" module="Magento_Sales" next="createNewOrder" /> + <step name="createNewOrder" module="Magento_Sales" next="selectCustomerOrder" /> + <step name="selectCustomerOrder" module="Magento_Sales" next="selectStore" /> + <step name="selectStore" module="Magento_Sales" next="addProducts" /> + <step name="addProducts" module="Magento_Sales" next="fillBillingAddress" /> + <step name="fillBillingAddress" module="Magento_Sales" next="selectPaymentMethodForOrder"> + <item name="billingAddress"> + <item name="dataSet" value="customer_US" /> + </item> + </step> + <step name="selectPaymentMethodForOrder" module="Magento_Sales" next="selectShippingMethodForOrder"> + <item name="payment"> + <item name="method" value="checkmo" /> + </item> + </step> + <step name="selectShippingMethodForOrder" module="Magento_Sales" next="submitOrder" /> + <step name="submitOrder" module="Magento_Sales" next="openSalesOrderOnFrontendForGuest" /> + <step name="openSalesOrderOnFrontendForGuest" module="Magento_Sales" next="printOrderOnFrontend" /> + <step name="printOrderOnFrontend" module="Magento_Sales" /> + </scenario> </config> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..14a87c13b7efcba2c1a068ae239f827abe6659fd --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest83"> + <data name="menuItem" xsi:type="string">Marketing > Cart Price Rules</data> + <data name="pageTitle" xsi:type="string">Cart Price Rules</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php index 670aca38ebfd3278e99503ec3e45ba86fc7b2bc2..c8b09124666bd8ab70c40b40bdf1f93affca8550 100644 --- a/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/Handler/Sitemap/Curl.php @@ -62,8 +62,7 @@ class Curl extends AbstractCurl implements SitemapInterface { //Sort data in grid to define sitemap id if more than 20 items in grid $url = 'admin/sitemap/index/sort/sitemap_id/dir/desc'; - $pattern = '/class=\" col\-id col\-sitemap_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' - . $data['sitemap_filename'] . '/siu'; + $pattern = '/col-sitemap_id\W*(\d+)<.td><[^<>]*?>' . $data['sitemap_filename'] . '/siu'; $extractor = new Extractor($url, $pattern); $match = $extractor->getData(); diff --git a/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..fbebdaee2d655b33a6112e15c1b08f6c188ef88b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Sitemap/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest85"> + <data name="menuItem" xsi:type="string">Marketing > Site Map</data> + <data name="pageTitle" xsi:type="string">Site Map</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php index 3e796d62655d43403e8ed8ecf069def881c6b1a2..3e23c4cbfb1d7d156ed0e3f096938fe0f79836f8 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.php @@ -34,6 +34,7 @@ class CreateStoreEntityTest extends Injectable /* tags */ const MVP = 'yes'; const DOMAIN = 'PS'; + const TEST_TYPE = 'acceptance_test'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml index 1da9ff702e422245440b78ff82583d538e206338..4ba86215b1c13a8851f4300298bd825521f0e341 100644 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/CreateStoreEntityTest.xml @@ -6,39 +6,52 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Store\Test\TestCase\CreateStoreEntityTest"> - <variation name="CreateStoreEntityTestVariation1"> - <data name="store/data/group_id/dataSet" xsi:type="string">default</data> - <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> - <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> - <data name="store/data/is_active" xsi:type="string">Enabled</data> - <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreForm"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend"/> - </variation> - <variation name="CreateStoreEntityTestVariation2"> - <data name="store/data/group_id/dataSet" xsi:type="string">default</data> - <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> - <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> - <data name="store/data/is_active" xsi:type="string">Disabled</data> - <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreForm"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreNotOnFrontend"/> - </variation> - <variation name="CreateStoreEntityTestVariation3"> - <data name="store/data/group_id/dataSet" xsi:type="string">custom</data> - <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> - <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> - <data name="store/data/is_active" xsi:type="string">Enabled</data> - <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreForm"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend"/> - <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend"/> - </variation> - </testCase> + <testCase name="Magento\Store\Test\TestCase\CreateStoreEntityTest"> + <variation name="CreateStoreEntityTestVariation1"> + <data name="store/data/group_id/dataSet" xsi:type="string">default</data> + <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> + <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Enabled</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreForm" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend" /> + </variation> + <variation name="CreateStoreEntityTestVariation2"> + <data name="store/data/group_id/dataSet" xsi:type="string">default</data> + <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> + <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Disabled</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreForm" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreNotOnFrontend" /> + </variation> + <variation name="CreateStoreEntityTestVariation3"> + <data name="store/data/group_id/dataSet" xsi:type="string">custom</data> + <data name="store/data/name" xsi:type="string">store_name_%isolation%</data> + <data name="store/data/code" xsi:type="string">storecode_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Enabled</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreForm" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreBackend" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreFrontend" /> + </variation> + <variation name="CreateStoreEntityTestVariation4"> + <data name="description" xsi:type="string">MAGETWO-12405: Create New Localized Store View</data> + <data name="store/data/group_id/dataSet" xsi:type="string">default</data> + <data name="store/data/name" xsi:type="string">DE_%isolation%</data> + <data name="store/data/code" xsi:type="string">de_%isolation%</data> + <data name="store/data/is_active" xsi:type="string">Enabled</data> + <data name="locale" xsi:type="string">German (Germany)</data> + <data name="welcomeText" xsi:type="string">Den gesamten Shop durchsuchen</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\Store\Test\Constraint\AssertStoreSuccessSaveMessage" /> + <constraint name="Magento\Store\Test\Constraint\AssertStoreInGrid" /> + <constraint name="Magento\Backend\Test\Constraint\AssertStoreCanBeLocalized" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php b/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php deleted file mode 100644 index ab189ce353019e5e821f66713b8491f63bb87aaf..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/Store/Test/TestCase/StoreTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Store test - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Store\Test\TestCase; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\TestCase\Functional; - -class StoreTest extends Functional -{ - /* tags */ - const TEST_TYPE = 'acceptance_test'; - /* end tags */ - - /** - * Login into backend area before test - */ - protected function setUp() - { - Factory::getApp()->magentoBackendLoginUser(); - } - - /** - * @ZephyrId MAGETWO-12405 - */ - public function testCreateNewLocalizedStoreView() - { - $objectManager = Factory::getObjectManager(); - $storeFixture = $objectManager->create('Magento\Store\Test\Fixture\Store', ['dataSet' => 'german']); - - $storeListPage = Factory::getPageFactory()->getAdminSystemStore(); - $storeListPage->open(); - $storeListPage->getGridPageActions()->addStoreView(); - - $newStorePage = Factory::getPageFactory()->getAdminSystemStoreNewStore(); - $newStorePage->getStoreForm()->fill($storeFixture); - $newStorePage->getFormPageActions()->save(); - $storeListPage->getMessagesBlock()->waitSuccessMessage(); - $this->assertContains( - 'The store view has been saved', - $storeListPage->getMessagesBlock()->getSuccessMessages() - ); - $this->assertTrue( - $storeListPage->getStoreGrid()->isStoreExists($storeFixture->getName()) - ); - - $cachePage = Factory::getPageFactory()->getAdminCache(); - $cachePage->open(); - $cachePage->getActionsBlock()->flushCacheStorage(); - $cachePage->getMessagesBlock()->waitSuccessMessage(); - - $configPage = Factory::getPageFactory()->getAdminSystemConfig(); - $configPage->open(); - $configPage->getPageActions()->selectStore($storeFixture->getGroupId() . "/" . $storeFixture->getName()); - $configGroup = $configPage->getForm()->getGroup('Locale Options'); - $configGroup->open(); - $configGroup->setValue('select-groups-locale-fields-code-value', 'German (Germany)'); - $configPage->getPageActions()->save(); - $configPage->getMessagesBlock()->waitSuccessMessage(); - - $homePage = Factory::getPageFactory()->getCmsIndexIndex(); - $homePage->open(); - - $homePage->getStoreSwitcherBlock()->selectStoreView($storeFixture->getName()); - $this->assertTrue($homePage->getSearchBlock()->isPlaceholderContains('Den gesamten Shop durchsuchen')); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php index 4c5e2cabf1c610cfacdef73b0b639bbe3fad0b95..b5631910c0d44a00f93df89cc540b56734348c1a 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php @@ -141,7 +141,9 @@ abstract class AssertTaxRuleApplying extends AbstractConstraint $checkoutCart->open()->getCartBlock()->clearShoppingCart(); $browser->open($_ENV['app_frontend_url'] . $this->productSimple->getUrlKey() . '.html'); $catalogProductView->getViewBlock()->clickAddToCart(); + $catalogProductView->getMessagesBlock()->waitSuccessMessage(); // Estimate Shipping and Tax + $checkoutCart->open(); $checkoutCart->getShippingBlock()->openEstimateShippingAndTax(); $checkoutCart->getShippingBlock()->fill($address); $checkoutCart->getShippingBlock()->clickGetQuote(); diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php index 997d0600cc759907a4e86346d420b53e61bb3a3c..b40b943db578694f85058bb4c165c854101b2c00 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxClass.php @@ -6,8 +6,8 @@ namespace Magento\Tax\Test\Fixture\TaxRule; +use Magento\Mtf\Fixture\DataSource; use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Mtf\Fixture\FixtureInterface; /** * Class TaxClass @@ -15,23 +15,17 @@ use Magento\Mtf\Fixture\FixtureInterface; * Data keys: * - dataSet */ -class TaxClass implements FixtureInterface +class TaxClass extends DataSource { /** - * Array with tax class names - * - * @var array - */ - protected $data; - - /** - * Array with tax class fixtures + * Array with tax class fixtures. * * @var array */ protected $fixture; /** + * @constructor * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data @@ -42,51 +36,16 @@ class TaxClass implements FixtureInterface if (isset($data['dataSet'])) { $dataSets = $data['dataSet']; foreach ($dataSets as $dataSet) { - if ($dataSet !== '-') { - /** @var \Magento\Tax\Test\Fixture\TaxClass $taxClass */ - $taxClass = $fixtureFactory->createByCode('taxClass', ['dataSet' => $dataSet]); - $this->fixture[] = $taxClass; - $this->data[] = $taxClass->getClassName(); - } + /** @var \Magento\Tax\Test\Fixture\TaxClass $taxClass */ + $taxClass = $fixtureFactory->createByCode('taxClass', ['dataSet' => $dataSet]); + $this->fixture[] = $taxClass; + $this->data[] = $taxClass->getClassName(); } } } /** - * Persist custom selections tax classes - * - * @return void - */ - public function persist() - { - // - } - - /** - * Return prepared data set - * - * @param $key [optional] - * @return mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } - - /** - * Return tax class fixture + * Return tax class fixture. * * @return array */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php index aacc3a65e7ab91f8292fc0461f9ed0de4b4e826d..238a754ee60480e310045ce8b6fec70ae836a9da 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Fixture/TaxRule/TaxRate.php @@ -6,8 +6,8 @@ namespace Magento\Tax\Test\Fixture\TaxRule; +use Magento\Mtf\Fixture\DataSource; use Magento\Mtf\Fixture\FixtureFactory; -use Magento\Mtf\Fixture\FixtureInterface; /** * Class TaxRate @@ -15,23 +15,17 @@ use Magento\Mtf\Fixture\FixtureInterface; * Data keys: * - dataSet */ -class TaxRate implements FixtureInterface +class TaxRate extends DataSource { /** - * Array with tax rates codes - * - * @var array - */ - protected $data; - - /** - * Array with tax rate fixtures + * Array with tax rate fixtures. * * @var array */ protected $fixture; /** + * @constructor * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data @@ -42,51 +36,16 @@ class TaxRate implements FixtureInterface if (isset($data['dataSet'])) { $dataSets = $data['dataSet']; foreach ($dataSets as $dataSet) { - if ($dataSet !== '-') { - /** @var \Magento\Tax\Test\Fixture\TaxRate $taxRate */ - $taxRate = $fixtureFactory->createByCode('taxRate', ['dataSet' => $dataSet]); - $this->fixture[] = $taxRate; - $this->data[] = $taxRate->getCode(); - } + /** @var \Magento\Tax\Test\Fixture\TaxRate $taxRate */ + $taxRate = $fixtureFactory->createByCode('taxRate', ['dataSet' => $dataSet]); + $this->fixture[] = $taxRate; + $this->data[] = $taxRate->getCode(); } } } /** - * Persist custom selections tax rates - * - * @return void - */ - public function persist() - { - // - } - - /** - * Return prepared data set - * - * @param $key [optional] - * @return mixed - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function getData($key = null) - { - return $this->data; - } - - /** - * Return data set configuration settings - * - * @return string - */ - public function getDataConfig() - { - return $this->params; - } - - /** - * Return tax rate fixtures + * Return tax rate fixtures. * * @return array */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php index a183fa5490125341f2750697f7d23e0ff13fe987..28e77379db72e1010f28e6bf0212e34ac8a2feea 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Handler/TaxClass/Curl.php @@ -14,13 +14,12 @@ use Magento\Mtf\Util\Protocol\CurlTransport; use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; /** - * Class Curl - * Curl handler for creating customer and product tax class + * Curl handler for creating customer and product tax class. */ class Curl extends AbstractCurl implements TaxClassInterface { /** - * Post request for creating tax class + * Post request for creating tax class. * * @param FixtureInterface $fixture [optional] * @return mixed|string @@ -29,7 +28,7 @@ class Curl extends AbstractCurl implements TaxClassInterface { $data = $fixture->getData(); - $url = $_ENV['app_backend_url'] . 'tax/tax/ajaxSAve/?isAjax=true'; + $url = $_ENV['app_backend_url'] . 'tax/tax/ajaxSave/?isAjax=true'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $curl->read(); @@ -40,7 +39,7 @@ class Curl extends AbstractCurl implements TaxClassInterface } /** - * Return saved class id if saved + * Return saved class id if saved. * * @param $response * @return int|null diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml index fe148b022e7170f8aa76c6f1d0b7a964f86b2b34..b8770c32386bd731c9dfc2f1cab9f2aa42ceefeb 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/CreateTaxRuleEntityTest.xml @@ -6,82 +6,72 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Tax\Test\TestCase\CreateTaxRuleEntityTest"> - <variation name="CreateTaxRuleEntityTestVariation1"> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation2"> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">1</data> - <data name="taxRule/data/position" xsi:type="string">1</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation3"> - <data name="description" xsi:type="string">Creating tax rule with new tax classes and tax rate</data> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">Taxable Goods</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">1</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation4"> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-CA-Rate_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">Taxable Goods</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/priority" xsi:type="string">1</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="CreateTaxRuleEntityTestVariation5"> - <data name="description" xsi:type="string">MAGETWO-12438: Create Tax Rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class</data> - <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-*-Rate 1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">us_ny_rate_8_1</data> - <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">-</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">Retail Customer</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">Taxable Goods</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> - <data name="tag" xsi:type="string">bamboo_plan:end_to_end,test_type:acceptance_test</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - </testCase> + <testCase name="Magento\Tax\Test\TestCase\CreateTaxRuleEntityTest"> + <variation name="CreateTaxRuleEntityTestVariation1"> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation2"> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <data name="taxRule/data/priority" xsi:type="string">1</data> + <data name="taxRule/data/position" xsi:type="string">1</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation3"> + <data name="description" xsi:type="string">Creating tax rule with new tax classes and tax rate</data> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-NY-Rate_1</data> + <data name="taxRule/data/tax_rate/dataSet/rate_2" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">taxable_goods</data> + <data name="taxRule/data/position" xsi:type="string">1</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation4"> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">US-CA-Rate_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">taxable_goods</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/priority" xsi:type="string">1</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="CreateTaxRuleEntityTestVariation5"> + <data name="description" xsi:type="string">MAGETWO-12438: Create Tax Rule with New and Existing Tax Rate, Customer Tax Class, Product Tax Class</data> + <data name="taxRule/data/code" xsi:type="string">TaxIdentifier%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">US-CA-*-Rate 1</data> + <data name="taxRule/data/tax_rate/dataSet/rate_1" xsi:type="string">us_ny_rate_8_1</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_1" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">taxable_goods</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> + <data name="tag" xsi:type="string">bamboo_plan:end_to_end,test_type:acceptance_test</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php index 3c8e925589b39f5caf6218d7b5d8a35e176e3283..bef4c799b43f3a3603fb29b7706b12def4732cc0 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.php @@ -6,26 +6,22 @@ namespace Magento\Tax\Test\TestCase; -use Magento\Customer\Test\Fixture\Address; use Magento\Tax\Test\Fixture\TaxRule; use Magento\Tax\Test\Page\Adminhtml\TaxRuleIndex; use Magento\Tax\Test\Page\Adminhtml\TaxRuleNew; -use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for Delete TaxRuleEntity - * - * Test Flow: * Preconditions: - * 1. Tax Rule is created + * 1. Tax Rule is created. * * Steps: * 1. Log in as default admin user. - * 2. Go to Sales > Tax Rules - * 3. Select required tax rule from preconditions - * 4. Click on the "Delete Rule" button - * 5. Perform all assertions + * 2. Go to Sales > Tax Rules. + * 3. Select required tax rule from preconditions. + * 4. Click on the "Delete Rule" button. + * 5. Perform all assertions. * * @group Tax_(CS) * @ZephyrId MAGETWO-20924 @@ -38,35 +34,34 @@ class DeleteTaxRuleEntityTest extends Injectable /* end tags */ /** - * Tax Rule grid page + * Tax Rule grid page. * * @var TaxRuleIndex */ protected $taxRuleIndexPage; /** - * Tax Rule new and edit page + * Tax Rule new and edit page. * * @var TaxRuleNew */ protected $taxRuleNewPage; /** - * Preparing data + * Create customer. * - * @param FixtureFactory $fixtureFactory + * @param Customer $customer * @return array */ - public function __prepare(FixtureFactory $fixtureFactory) + public function __prepare(Customer $customer) { - $customer = $fixtureFactory->createByCode('customer', ['dataSet' => 'default']); $customer->persist(); return ['customer' => $customer]; } /** - * Injection data + * Inject pages. * * @param TaxRuleIndex $taxRuleIndexPage * @param TaxRuleNew $taxRuleNewPage @@ -80,28 +75,19 @@ class DeleteTaxRuleEntityTest extends Injectable } /** - * Delete Tax Rule Entity test + * Delete Tax Rule Entity test. * * @param TaxRule $taxRule - * @param Address $address - * @param array $shipping - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @return void */ - public function testDeleteTaxRule( - TaxRule $taxRule, - Address $address, - array $shipping - ) { + public function testDeleteTaxRule(TaxRule $taxRule) + { // Precondition $taxRule->persist(); // Steps - $filters = [ - 'code' => $taxRule->getCode(), - ]; $this->taxRuleIndexPage->open(); - $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen($filters); + $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen(['code' => $taxRule->getCode()]); $this->taxRuleNewPage->getFormPageActions()->delete(); } } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml index 86c84ac32a3928f3779b647f8515339139bb6bf2..8c8aa1e3888b449ecb35b4cd65f5df9ce68baa96 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/DeleteTaxRuleEntityTest.xml @@ -6,18 +6,18 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Tax\Test\TestCase\DeleteTaxRuleEntityTest"> - <variation name="DeleteTaxRuleEntityTestVariation1"> - <data name="taxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">United States</data> - <data name="address/data/region_id" xsi:type="string">California</data> - <data name="address/data/postcode" xsi:type="string">90001</data> - <data name="shipping/carrier" xsi:type="string">Flat Rate</data> - <data name="shipping/method" xsi:type="string">Fixed</data> - <data name="shipping/price" xsi:type="string">5</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessDeleteMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleNotInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied"/> - </variation> - </testCase> + <testCase name="Magento\Tax\Test\TestCase\DeleteTaxRuleEntityTest"> + <variation name="DeleteTaxRuleEntityTestVariation1"> + <data name="taxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">California</data> + <data name="address/data/postcode" xsi:type="string">90001</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="shipping/price" xsi:type="string">5</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessDeleteMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleNotInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..2b07ad78838c0aef85bd7f355aebe1099ea126fa --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest87"> + <data name="menuItem" xsi:type="string">Stores > Tax Rules</data> + <data name="pageTitle" xsi:type="string">Tax Rules</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest88"> + <data name="menuItem" xsi:type="string">Stores > Tax Zones and Rates</data> + <data name="pageTitle" xsi:type="string">Tax Zones and Rates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest89"> + <data name="menuItem" xsi:type="string">System > Import/Export Tax Rates</data> + <data name="pageTitle" xsi:type="string">Import and Export Tax Rates</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml index 48c142a660842fc1dcd21fb721cd380257c02202..1cc98aeb5bf1a0dfc16dc5dd1129a3d29461dd19 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestCase/UpdateTaxRuleEntityTest.xml @@ -6,84 +6,63 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Tax\Test\TestCase\UpdateTaxRuleEntityTest"> - <variation name="UpdateTaxRuleEntityTestVariation1"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_default</data> - <data name="address/data/country_id" xsi:type="string">-</data> - <data name="address/data/region_id" xsi:type="string">-</data> - <data name="address/data/postcode" xsi:type="string">-</data> - <data name="shipping/carrier" xsi:type="string">-</data> - <data name="shipping/method" xsi:type="string">-</data> - <data name="shipping/price" xsi:type="string">-</data> - <data name="taxRule/data/code" xsi:type="string">New Tax Rule name%isolation%</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/priority" xsi:type="string">2</data> - <data name="taxRule/data/position" xsi:type="string">2</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="UpdateTaxRuleEntityTestVariation2"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">-</data> - <data name="address/data/region_id" xsi:type="string">-</data> - <data name="address/data/postcode" xsi:type="string">-</data> - <data name="shipping/carrier" xsi:type="string">-</data> - <data name="shipping/method" xsi:type="string">-</data> - <data name="shipping/price" xsi:type="string">-</data> - <data name="taxRule/data/code" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">taxable_goods</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - </variation> - <variation name="UpdateTaxRuleEntityTestVariation3"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">United States</data> - <data name="address/data/region_id" xsi:type="string">Utah</data> - <data name="address/data/postcode" xsi:type="string">84001</data> - <data name="shipping/carrier" xsi:type="string">Flat Rate</data> - <data name="shipping/method" xsi:type="string">Fixed</data> - <data name="shipping/price" xsi:type="string">5</data> - <data name="taxRule/data/code" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">us_ut_fixed_zip_rate_20</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsApplied"/> - </variation> - <variation name="UpdateTaxRuleEntityTestVariation4"> - <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> - <data name="address/data/country_id" xsi:type="string">United States</data> - <data name="address/data/region_id" xsi:type="string">Idaho</data> - <data name="address/data/postcode" xsi:type="string">83201</data> - <data name="shipping/carrier" xsi:type="string">Flat Rate</data> - <data name="shipping/method" xsi:type="string">Fixed</data> - <data name="shipping/price" xsi:type="string">5</data> - <data name="taxRule/data/code" xsi:type="string">-</data> - <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withFixedZip</data> - <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> - <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> - <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> - <data name="taxRule/data/priority" xsi:type="string">-</data> - <data name="taxRule/data/position" xsi:type="string">-</data> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm"/> - <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied"/> - </variation> - </testCase> + <testCase name="Magento\Tax\Test\TestCase\UpdateTaxRuleEntityTest"> + <variation name="UpdateTaxRuleEntityTestVariation1"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_default</data> + <data name="taxRule/data/code" xsi:type="string">New Tax Rule name%isolation%</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">default</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">customer_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/priority" xsi:type="string">2</data> + <data name="taxRule/data/position" xsi:type="string">2</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="UpdateTaxRuleEntityTestVariation2"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withZipRange</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">retail_customer</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">taxable_goods</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + </variation> + <variation name="UpdateTaxRuleEntityTestVariation3"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">Utah</data> + <data name="address/data/postcode" xsi:type="string">84001</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="shipping/price" xsi:type="string">5</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">us_ut_fixed_zip_rate_20</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsApplied" /> + </variation> + <variation name="UpdateTaxRuleEntityTestVariation4"> + <data name="initialTaxRule/dataSet" xsi:type="string">tax_rule_with_custom_tax_classes</data> + <data name="address/data/country_id" xsi:type="string">United States</data> + <data name="address/data/region_id" xsi:type="string">Idaho</data> + <data name="address/data/postcode" xsi:type="string">83201</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> + <data name="shipping/price" xsi:type="string">5</data> + <data name="taxRule/data/tax_rate/dataSet/rate_0" xsi:type="string">withFixedZip</data> + <data name="taxRule/data/tax_customer_class/dataSet/class_0" xsi:type="string">-</data> + <data name="taxRule/data/tax_product_class/dataSet/class_0" xsi:type="string">product_tax_class</data> + <data name="taxRule/data/tax_product_class/dataSet/class_1" xsi:type="string">-</data> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleSuccessSaveMessage" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleInGrid" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleForm" /> + <constraint name="Magento\Tax\Test\Constraint\AssertTaxRuleIsNotApplied" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php index dd7936803646c968ddbf503484427328bb50133e..027b1ca6ec7fff352865e5d0a001e059f4044372 100644 --- a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php @@ -57,6 +57,24 @@ class Links extends Block return $this->_rootElement->find(sprintf($this->link, $linkTitle), Locator::SELECTOR_XPATH)->isVisible(); } + /** + * Wait for link is visible. + * + * @param string $linkTitle + * @return void + */ + public function waitLinkIsVisible($linkTitle) + { + $browser = $this->_rootElement; + $selector = sprintf($this->link, $linkTitle); + $browser->waitUntil( + function () use ($browser, $selector) { + $element = $browser->find($selector, Locator::SELECTOR_XPATH); + return $element->isVisible() ? true : null; + } + ); + } + /** * Get the number of products added to compare list. * diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Theme/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..4fb8159fe987005275a625c72c1f97ea01c64e2d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest90"> + <data name="menuItem" xsi:type="string">Content > Themes</data> + <data name="pageTitle" xsi:type="string">Themes</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php index dcae5848887be99e10b707cbebb4c9bb35788b5b..373c6c4cabd7c90d4920667f958868594b4b3946 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Block/Adminhtml/Catalog/Edit/UrlRewriteForm.php @@ -12,13 +12,12 @@ use Magento\Mtf\Client\Element; use Magento\Mtf\Fixture\FixtureInterface; /** - * Class UrlRewriteForm - * Catalog URL rewrite edit form + * Catalog URL rewrite edit form. */ class UrlRewriteForm extends Form { /** - * Fill the root form + * Fill the root form. * * @param FixtureInterface $fixture * @param SimpleElement|null $element diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php index 8b176051fc18384f164d80381a2870f9b258c075..9dc49ec06a9bacdcea1c9d869eb26ac83564abbc 100644 --- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/Constraint/AssertUrlRewriteCustomRedirect.php @@ -29,7 +29,7 @@ class AssertUrlRewriteCustomRedirect extends AbstractConstraint { $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath()); $entity = $urlRewrite->getDataFieldConfig('target_path')['source']->getEntity(); - $title = $entity->hasData('name') ? $entity->getName() : $entity->getTitle(); + $title = $entity->hasData('name') ? $entity->getName() : $entity->getContentHeading(); $pageTitle = $cmsIndex->getTitleBlock()->getTitle(); \PHPUnit_Framework_Assert::assertEquals( $pageTitle, diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..3423afc8018e060a403ba5b91ad53c6ed73d0da9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest91"> + <data name="menuItem" xsi:type="string">Marketing > URL Rewrites</data> + <data name="pageTitle" xsi:type="string">URL Rewrites</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php index 8c034e549edfaa9900cc434375a9e04112de2cf3..3127b4b3f195ab13e015d8cf976ce9272efe3ca9 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleInGrid.php @@ -6,7 +6,7 @@ namespace Magento\User\Test\Constraint; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; use Magento\Mtf\Constraint\AbstractConstraint; @@ -19,14 +19,14 @@ class AssertRoleInGrid extends AbstractConstraint * Asserts that saved role is present in Role Grid. * * @param UserRoleIndex $rolePage - * @param AdminUserRole $role - * @param AdminUserRole $roleInit + * @param Role $role + * @param Role $roleInit * @return void */ public function processAssert( UserRoleIndex $rolePage, - AdminUserRole $role, - AdminUserRole $roleInit = null + Role $role, + Role $roleInit = null ) { $filter = ['rolename' => $role->hasData('rolename') ? $role->getRoleName() : $roleInit->getRoleName()]; $rolePage->open(); diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php index 9615318c08384d87d44f735570551c9e1a8ce983..2eb134bb51309355e52efcd9522b17f0c151bc6c 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertRoleNotInGrid.php @@ -6,7 +6,7 @@ namespace Magento\User\Test\Constraint; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; use Magento\Mtf\Constraint\AbstractConstraint; @@ -19,12 +19,12 @@ class AssertRoleNotInGrid extends AbstractConstraint * Asserts that role is not present in Role Grid. * * @param UserRoleIndex $rolePage - * @param AdminUserRole $role + * @param Role $role * @return void */ public function processAssert( UserRoleIndex $rolePage, - AdminUserRole $role + Role $role ) { $filter = ['rolename' => $role->getRoleName()]; $rolePage->open(); diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php index 4e409ccc9f3b4ac3c36ce74f90e64fadcd9b0cb2..2761f880264532f93c0dd0d16399a637f810977a 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserInGrid.php @@ -11,7 +11,7 @@ use Magento\User\Test\Page\Adminhtml\UserIndex; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertUserInGrid + * Asserts that user is present in User Grid. */ class AssertUserInGrid extends AbstractConstraint { @@ -20,20 +20,16 @@ class AssertUserInGrid extends AbstractConstraint * * @param UserIndex $userIndex * @param User $user - * @param User $customAdmin * @return void */ - public function processAssert( - UserIndex $userIndex, - User $user, - User $customAdmin = null - ) { - $adminUser = ($user->hasData('password') || $user->hasData('username')) ? $user : $customAdmin; - $filter = ['username' => $adminUser->getUsername()]; + public function processAssert(UserIndex $userIndex, User $user) + { + $filter = ['username' => $user->getUsername()]; + $userIndex->open(); \PHPUnit_Framework_Assert::assertTrue( $userIndex->getUserGrid()->isRowVisible($filter), - 'User with name \'' . $adminUser->getUsername() . '\' is absent in User grid.' + 'User with name \'' . $user->getUsername() . '\' is absent in User grid.' ); } diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleRestrictedAccess.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleRestrictedAccess.php new file mode 100644 index 0000000000000000000000000000000000000000..3cc808867742e584fca8a34990cde630560ea22a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleRestrictedAccess.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\Constraint; + +use Magento\Backend\Test\Page\Adminhtml\Dashboard; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\User\Test\Fixture\User; + +/** + * Asserts that user has only related permissions. + */ +class AssertUserRoleRestrictedAccess extends AbstractConstraint +{ + const DENIED_ACCESS = 'Access denied'; + + /** + * Asserts that user has only related permissions. + * + * @param BrowserInterface $browser + * @param Dashboard $dashboard + * @param User $user + * @param array $restrictedAccess + * @param string $denyUrl + * @return void + */ + public function processAssert( + BrowserInterface $browser, + Dashboard $dashboard, + User $user, + array $restrictedAccess, + $denyUrl + ) { + $this->objectManager->create('Magento\User\Test\TestStep\LoginUserOnBackendStep', ['user' => $user])->run(); + + $menuItems = $dashboard->getMenuBlock()->getTopMenuItems(); + \PHPUnit_Framework_Assert::assertEquals($menuItems, $restrictedAccess, 'Wrong display menu.'); + + $browser->open($_ENV['app_backend_url'] . $denyUrl); + $deniedMessage = $dashboard->getAccessDeniedBlock()->getTextFromAccessDeniedBlock(); + \PHPUnit_Framework_Assert::assertEquals(self::DENIED_ACCESS, $deniedMessage, 'Possible access to denied page.'); + } + + /** + * Returns success message if assert true. + * + * @return string + */ + public function toString() + { + return 'Sales item is present in Menu block.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleSalesRestrictedAccess.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleSalesRestrictedAccess.php deleted file mode 100644 index 7d1f1e298a4e6460c7b69be9d24211e2dc543ebc..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserRoleSalesRestrictedAccess.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Constraint; - -use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Page\Adminhtml\UserIndex; -use Magento\Mtf\Constraint\AbstractConstraint; - -/** - * Class AssertUserRoleSalesRestrictedAccess - */ -class AssertUserRoleSalesRestrictedAccess extends AbstractConstraint -{ - const ROLE_RESOURCE = 'sales'; - const DENIED_ACCESS = 'Access denied'; - - /** - * Asserts that user has only Sales-related permissions - * - * @param Dashboard $dashboard - * @param UserIndex $userIndex - * @return void - */ - public function processAssert( - Dashboard $dashboard, - UserIndex $userIndex - ) { - $menuItems = $dashboard->getMenuBlock()->getTopMenuItems(); - $userIndex->open(); - $deniedMessage = $userIndex->getAccessDeniedBlock()->getTextFromAccessDeniedBlock(); - $isMenuItemSingle = (count($menuItems) == 1); - $hasSales = in_array(self::ROLE_RESOURCE, $menuItems); - \PHPUnit_Framework_Assert::assertTrue( - $hasSales && $isMenuItemSingle && (self::DENIED_ACCESS == $deniedMessage), - 'Sales item is absent in Menu block or possible access to another page, not related to Sales.' - ); - } - - /** - * Returns success message if assert true. - * - * @return string - */ - public function toString() - { - return 'Sales item is present in Menu block.'; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php index c1214de922e8d930618d37428838ebfa1d9fdf07..ef60f6f4703859a8efd91f84e4b768e54d9d84cf 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Constraint/AssertUserSuccessLogin.php @@ -6,40 +6,25 @@ namespace Magento\User\Test\Constraint; -use Magento\Backend\Test\Page\AdminAuthLogin; use Magento\Backend\Test\Page\Adminhtml\Dashboard; use Magento\User\Test\Fixture\User; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertUserSuccessLogin + * Verify whether customer has logged in to the Backend. */ class AssertUserSuccessLogin extends AbstractConstraint { /** - * Verify whether customer has logged in to the Backend + * Verify whether customer has logged in to the Backend. * * @param User $user - * @param AdminAuthLogin $adminAuth * @param Dashboard $dashboard - * @param User $customAdmin - * @internal param null|string $userToLoginInAssert * @return void */ - public function processAssert( - User $user, - AdminAuthLogin $adminAuth, - Dashboard $dashboard, - User $customAdmin = null - ) { - $adminAuth->open(); - $adminUser = $customAdmin === null ? $user : $customAdmin; - if ($dashboard->getAdminPanelHeader()->isVisible()) { - $dashboard->getAdminPanelHeader()->logOut(); - } - $adminAuth->getLoginBlock()->fill($adminUser); - $adminAuth->getLoginBlock()->submit(); - + public function processAssert(User $user, Dashboard $dashboard) + { + $this->objectManager->create('Magento\User\Test\TestStep\LoginUserOnBackendStep', ['user' => $user])->run(); \PHPUnit_Framework_Assert::assertTrue( $dashboard->getAdminPanelHeader()->isLoggedIn(), 'Admin user was not logged in.' @@ -47,7 +32,7 @@ class AssertUserSuccessLogin extends AbstractConstraint } /** - * Returns success message if equals to expected message + * Returns success message if equals to expected message. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUser.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUser.php deleted file mode 100644 index 669ab32c19e254aadbcb66da4152203a65f2ed6f..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUser.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Fixture; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\Fixture\DataFixture; -use Magento\Mtf\ObjectManager; -use Magento\Mtf\Config; - -/** - * Fixture with all necessary data for user creation on backend - * - */ -class AdminUser extends DataFixture -{ - /** - * @param Config $configuration - * @param array $placeholders - */ - public function __construct(Config $configuration, $placeholders = []) - { - $placeholders['password'] = isset($placeholders['password']) ? $placeholders['password'] : '123123q'; - parent::__construct($configuration, $placeholders); - $this->_placeholders['sales_all_scopes'] = [$this, 'roleProvider']; - } - - /** - * Retrieve specify data from role.trieve specify data from role. - * - * @param $roleName - * @return mixed - */ - protected function roleProvider($roleName) - { - $role = Factory::getFixtureFactory()->getMagentoUserRole(); - $role->switchData($roleName); - $data = $role->persist(); - return $data['id']; - } - - /** - * initialize data - */ - protected function _initData() - { - /** @var \Magento\Mtf\Config $systemConfig */ - $systemConfig = ObjectManager::getInstance()->create('Magento\Mtf\Config'); - $superAdminPassword = $systemConfig->get('application/backendPassword'); - $this->_data = [ - 'fields' => [ - 'email' => [ - 'value' => 'email%isolation%@example.com', - ], - 'firstname' => [ - 'value' => 'firstname%isolation%', - ], - 'lastname' => [ - 'value' => 'lastname%isolation%', - ], - 'password' => [ - 'value' => '%password%', - ], - 'password_confirmation' => [ - 'value' => '%password%', - ], - 'roles' => [ - 'value' => ['1'], - ], - 'username' => [ - 'value' => 'admin%isolation%', - ], - 'current_password' => [ - 'value' => $superAdminPassword, - ], - ], - ]; - } - - /** - * @return string - */ - public function getEmail() - { - return $this->getData('fields/email/value'); - } - - /** - * @return string - */ - public function getPassword() - { - return $this->getData('fields/password/value'); - } - - /** - * @return string - */ - public function getUsername() - { - return $this->getData('fields/username/value'); - } - - /** - * Create user - */ - public function persist() - { - Factory::getApp()->magentoUserCreateUser($this); - } - - /** - * Set password for user - * - * @param string $password - */ - public function setPassword($password) - { - $this->_data['fields']['password']['value'] = $password; - $this->_data['fields']['password_confirmation']['value'] = $password; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole.xml b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole.xml deleted file mode 100644 index 3cdab7dfc0b11bc54d89f847a947055afeebd8ce..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> - <fixture name="adminUserRole" module="Magento_User" type="flat" entity_type="authorization_role" collection="Magento\User\Model\Resource\Role\User\Collection" repository_class="Magento\User\Test\Repository\AdminUserRole" handler_interface="Magento\User\Test\Handler\AdminUserRole\AdminUserRoleInterface" class="Magento\User\Test\Fixture\AdminUserRole"> - <dataset name="default"> - <field name="rolename" xsi:type="string">AdminRole%isolation%</field> - <field name="resource_access" xsi:type="string">All</field> - </dataset> - <field name="role_id" is_required="1"> - <default_value xsi:type="null"/> - </field> - <field name="parent_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="tree_level" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="sort_order" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="role_type" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="user_id" is_required=""> - <default_value xsi:type="number">0</default_value> - </field> - <field name="rolename" is_required="" group="role-info"> - <default_value xsi:type="string">AdminRole%isolation%</default_value> - </field> - <field name="user_type" is_required=""> - <default_value xsi:type="null"/> - </field> - <field name="resource_access" group="role-resources"> - <default_value xsi:type="string">All</default_value> - </field> - <field name="roles_resources" group="role-resources"/> - <field name="in_role_users" group="in_role_users" source="Magento\User\Test\Fixture\AdminUserRole\InRoleUsers"/> - </fixture> -</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Resource.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Resource.php deleted file mode 100644 index 89e81d3e7b73db217e8e7f1b95a0d37d2af8192b..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Resource.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\User\Test\Fixture; - -use Magento\Mtf\Fixture\DataFixture; - -/** - * ACL resources fixture - * - */ -class Resource extends DataFixture -{ - /** - * resources from the three in array - * key is resource id, value is parent id - * - * @var array - */ - protected $resources = [ - 'Magento_Backend::dashboard' => null, - 'Magento_Sales::sales' => null, - 'Magento_Sales::sales_operation' => 'Magento_Sales::sales', - 'Magento_Sales::sales_order' => 'Magento_Sales::sales_operation', - 'Magento_Sales::actions' => 'Magento_Sales::sales_order', - 'Magento_Sales::create' => 'Magento_Sales::actions', - 'Magento_Sales::actions_view' => 'Magento_Sales::actions', - 'Magento_Sales::email' => 'Magento_Sales::actions', - 'Magento_Sales::reorder' => 'Magento_Sales::actions', - 'Magento_Sales::actions_edit' => 'Magento_Sales::actions', - 'Magento_Sales::cancel' => 'Magento_Sales::actions', - 'Magento_Sales::review_payment' => 'Magento_Sales::actions', - 'Magento_Sales::capture' => 'Magento_Sales::actions', - 'Magento_Sales::invoice' => 'Magento_Sales::actions', - 'Magento_Sales::creditmemo' => 'Magento_Sales::actions', - 'Magento_Sales::hold' => 'Magento_Sales::actions', - 'Magento_Sales::unhold' => 'Magento_Sales::actions', - 'Magento_Sales::ship' => 'Magento_Sales::actions', - 'Magento_Sales::comment' => 'Magento_Sales::actions', - 'Magento_Sales::emails' => 'Magento_Sales::actions', - 'Magento_Sales::sales_invoice' => 'Magento_Sales::sales_operation', - 'Magento_Sales::shipment' => 'Magento_Sales::sales_operation', - 'Magento_Sales::sales_creditmemo' => 'Magento_Sales::sales_operation', - 'Magento_Paypal::billing_agreement' => 'Magento_Sales::sales_operation', - 'Magento_Paypal::billing_agreement_actions' => 'Magento_Paypal::billing_agreement', - 'Magento_Paypal::billing_agreement_actions_view' => 'Magento_Paypal::billing_agreement_actions', - 'Magento_Paypal::actions_manage' => 'Magento_Paypal::billing_agreement_actions', - 'Magento_Paypal::use' => 'Magento_Paypal::billing_agreement_actions', - 'Magento_Sales::transactions' => 'Magento_Sales::sales_operation', - 'Magento_Sales::transactions_fetch' => 'Magento_Sales::transactions', - ]; - - /** - * {@inheritdoc} - */ - protected function _initData() - { - } - - /** - * Just a stub of inherited method - * - * @throws \BadMethodCallException - */ - public function persist() - { - throw new \BadMethodCallException('This method is not applicable here. It is data provider for role fixture'); - } - - /** - * Return requested resource, all it's children and parents - * - * @param string $resourceId - * @throws \InvalidArgumentException - * @return array - */ - public function get($resourceId = null) - { - if (!array_key_exists($resourceId, $this->resources)) { - throw new \InvalidArgumentException('No resource "' . $resourceId . '" found'); - } - $withParents = $this->getParents($resourceId); - $withParents[] = $resourceId; - return array_merge($withParents, $this->getChildren($resourceId)); - } - - /** - * Get all direct parents - * - * @param string $resourceId - * @return array - */ - protected function getParents($resourceId) - { - if (is_null($this->resources[$resourceId])) { - return []; - } - - $parents = []; - $current = $this->resources[$resourceId]; - - while (!is_null($this->resources[$current])) { - $parents[] = $current; - $current = $this->resources[$current]; - } - $parents[] = $current; - - return $parents; - } - - /** - * Get all child resources - * - * @param string $resourceId - * @return array - */ - protected function getChildren($resourceId) - { - $children = array_keys($this->resources, $resourceId); - $result = $children; - foreach ($children as $child) { - $result = array_merge($result, $this->getChildren($child)); - } - return $result; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php deleted file mode 100644 index acb266f5d6c6978f4a7b9ffee53445115d0d2f33..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Fixture; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\Fixture\DataFixture; - -/** - * Class Role - * - */ -class Role extends DataFixture -{ - /** - * {@inheritdoc} - */ - public function persist() - { - return Factory::getApp()->magentoUserCreateRole($this); - } - - /** - * {@inheritdoc} - */ - protected function _initData() - { - $this->_repository = Factory::getRepositoryFactory() - ->getMagentoUserRole($this->_dataConfig, $this->_data); - } - - /** - * Set custom ACL resource array to role - * - * @param array $resource - */ - public function setResource(array $resource) - { - $this->_data['fields']['resource']['value'] = $resource; - } - - /** - * Merge resource array with existing values - * - * @param array $resource - */ - public function addResource(array $resource) - { - $this->_data['fields']['resource']['value'] = array_merge_recursive( - $this->_data['fields']['resource']['value'], - $resource - ); - } - - /** - * Set websites of stores if current data set works with them - * - * @param array $items - * @throws \InvalidArgumentException - */ - public function setScopeItems(array $items) - { - if (array_key_exists('gws_store_groups', $this->_data['fields'])) { - $scope = 'gws_store_groups'; - } elseif (array_key_exists('gws_websites', $this->_data['fields'])) { - $scope = 'gws_websites'; - } else { - throw new \InvalidArgumentException('Current data set doesn\'t work with stores and websites'); - } - $this->_data['fields'][$scope]['value'] = $items; - } - - /** - * Convert data from canonical array to repository native format - * - * @param array $data - * @return array - */ - protected function convertData(array $data) - { - $result = []; - foreach ($data as $key => $value) { - $result['fields'][$key]['value'] = $value; - } - return $result; - } - - /** - * Save custom data set to repository - * - * @param string $name - * @param array $data - * @param bool $convert convert data from canonical array to repository native format - */ - public function save($name, array $data, $convert = true) - { - if ($convert) { - $data = $this->convertData($data); - } - $this->_repository->set($name, $data); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.xml b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.xml new file mode 100644 index 0000000000000000000000000000000000000000..671556ced60023e557fce39be0f51dd6fef2d5d9 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd"> + <fixture name="role" module="Magento_User" type="flat" entity_type="authorization_role" collection="Magento\User\Model\Resource\Role\User\Collection" repository_class="Magento\User\Test\Repository\Role" handler_interface="Magento\User\Test\Handler\Role\RoleInterface" class="Magento\User\Test\Fixture\Role"> + <dataset name="default"> + <field name="rolename" xsi:type="string">AdminRole%isolation%</field> + <field name="resource_access" xsi:type="string">All</field> + </dataset> + <field name="role_id" is_required="1"> + <default_value xsi:type="null"/> + </field> + <field name="parent_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="tree_level" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="sort_order" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="role_type" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="user_id" is_required=""> + <default_value xsi:type="number">0</default_value> + </field> + <field name="rolename" is_required="" group="role-info"> + <default_value xsi:type="string">AdminRole%isolation%</default_value> + </field> + <field name="user_type" is_required=""> + <default_value xsi:type="null"/> + </field> + <field name="resource_access" group="role-resources"> + <default_value xsi:type="string">All</default_value> + </field> + <field name="roles_resources" group="role-resources"/> + <field name="in_role_users" group="in_role_users" source="Magento\User\Test\Fixture\Role\InRoleUsers"/> + </fixture> +</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole/InRoleUsers.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role/InRoleUsers.php similarity index 97% rename from dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole/InRoleUsers.php rename to dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role/InRoleUsers.php index eb1f27ccdc821d844c57b3607abcf09b43b429a0..bd716bbeabb47af94db3a766d59fa37cc14559d5 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/AdminUserRole/InRoleUsers.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/Role/InRoleUsers.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\User\Test\Fixture\AdminUserRole; +namespace Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\Mtf\Fixture\FixtureFactory; diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php index 6ee9c5eb5ed81f2379f24ba2c4f3ef69cc3d96d3..93e9e336080fe47fbad5c152dfa9347458029076 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Fixture/User/RoleId.php @@ -6,12 +6,12 @@ namespace Magento\User\Test\Fixture\User; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\Fixture\FixtureInterface; /** - * Class RoleId + * Source for Role of User. * * Data keys: * - dataSet @@ -20,14 +20,14 @@ use Magento\Mtf\Fixture\FixtureInterface; class RoleId implements FixtureInterface { /** - * Admin User Role + * Admin User Role. * - * @var AdminUserRole + * @var Role */ protected $role; /** - * User role name + * User role name. * * @var string */ @@ -43,20 +43,23 @@ class RoleId implements FixtureInterface { $this->params = $params; if (isset($data['dataSet']) && $data['dataSet'] !== '-') { - $this->role = $fixtureFactory->createByCode('adminUserRole', ['dataSet' => $data['dataSet']]); + list($fixtureCode, $dataSet) = explode('::', $data['dataSet']); + $this->role = $fixtureFactory->createByCode($fixtureCode, ['dataSet' => $dataSet]); if (!$this->role->hasData('role_id')) { $this->role->persist(); } $this->data = $this->role->getRoleName(); } - if (isset($data['role']) && $data['role'] instanceof AdminUserRole) { + if (isset($data['role']) && $data['role'] instanceof Role) { $this->role = $data['role']; $this->data = $data['role']->getRoleName(); + } elseif (isset($data['value'])) { + $this->data = $data['value']; } } /** - * Persist user role + * Persist user role. * * @return void */ @@ -66,7 +69,7 @@ class RoleId implements FixtureInterface } /** - * Return prepared data set + * Return prepared data set. * * @param string $key [optional] * @return string|null @@ -79,7 +82,7 @@ class RoleId implements FixtureInterface } /** - * Return data set configuration settings + * Return data set configuration settings. * * @return array */ @@ -89,9 +92,9 @@ class RoleId implements FixtureInterface } /** - * Return role fixture + * Return role fixture. * - * @return AdminUserRole + * @return Role */ public function getRole() { diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/Curl.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/Curl.php deleted file mode 100644 index faec3b0798ed32cf7d9ab2ae1a51052f2f985fc1..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/Curl.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Handler\AdminUserRole; - -use Magento\Backend\Test\Handler\Extractor; -use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Handler\Curl as AbstractCurl; -use Magento\Mtf\Config; -use Magento\Mtf\Util\Protocol\CurlInterface; -use Magento\Mtf\Util\Protocol\CurlTransport; -use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; - -/** - * Class Curl - * Creates Admin User role - */ -class Curl extends AbstractCurl implements AdminUserRoleInterface -{ - /** - * Curl creation of Admin User Role - * - * @param FixtureInterface $fixture - * @return array|mixed - * @throws \Exception - * - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function persist(FixtureInterface $fixture = null) - { - $data = $fixture->getData(); - $data['all'] = ($data['resource_access'] == 'All') ? 1 : 0; - if (isset($data['roles_resources'])) { - foreach ((array)$data['roles_resources'] as $resource) { - $data['resource'][] = $resource; - } - } - unset($data['roles_resources']); - $data['gws_is_all'] = (isset($data['gws_is_all'])) ? $data['gws_is_all'] : '1'; - if ($fixture->hasData('in_role_user')) { - $adminUsers = $fixture->getDataFieldConfig('in_role_user')['source']->getAdminUsers(); - $userIds = []; - foreach ($adminUsers as $adminUser) { - $userIds[] = $adminUser->getUserId() . "=true"; - } - $data['in_role_user'] = implode('&', $userIds); - } - $url = $_ENV['app_backend_url'] . 'admin/user_role/saverole/active_tab/info/'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $response = $curl->read(); - $curl->close(); - - if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \Exception("Role creating by curl handler was not successful! Response: $response"); - } - - $url = 'admin/user_role/roleGrid/sort/role_id/dir/desc/'; - $regExpPattern = '/class=\"\scol\-id col\-role_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' - . $data['rolename'] . '/siu'; - - $extractor = new Extractor($url, $regExpPattern); - - return ['role_id' => $extractor->getData()[1]]; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php deleted file mode 100644 index 8c5e8cde4eb080d682749193982dbebe8fc72407..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateRole.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Handler\Curl; - -use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Handler\Curl; -use Magento\Mtf\Config; -use Magento\Mtf\Util\Protocol\CurlInterface; -use Magento\Mtf\Util\Protocol\CurlTransport; -use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; - -/** - * Class CreateCategory. - * Curl handler for creating category. - * - */ -class CreateRole extends Curl -{ - /** - * Convert array from canonical to UI format - * - * @param array $fields - * @return array - */ - protected function _preparePostData(array $fields) - { - $data = []; - foreach ($fields as $key => $value) { - $data[$key] = $value['value']; - } - return $data; - } - - /** - * Look for role id on grid - * - * @param string $name - * @param string $page - * @return bool|string - */ - protected function findRoleOnPage($name, $page) - { - $dom = new \DOMDocument(); - $dom->loadHTML($page); - $xpath = new \DOMXPath($dom); - $row = '//tr[td[@data-column="role_name" and contains(text(),"' . $name . '")]]'; - $nodes = $xpath->query($row . '/td[@data-column="role_id"]'); - if ($nodes->length == 0) { - return false; - } - $node = $nodes->item(0); - $id = trim($node->nodeValue); - return $id; - } - - /** - * Send POST request with encoded filter parameters in URL - * - * @param $name - * @return string - */ - protected function filterByName($name) - { - $filter = base64_encode('role_name=' . $name); - $url = $_ENV['app_backend_url'] . 'admin/user_role/roleGrid/filter/' . $filter . '/'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->write(CurlInterface::POST, $url, '1.0', [], []); - $response = $curl->read(); - $curl->close(); - return $response; - } - - /** - * Look for needed role name and define id by name, - * if the role is absent on the page, filtering is performed - * - * @param string $name - * @param string $response - * @return bool|string - * @throws \UnderflowException - * @throws \Exception - */ - protected function findIdWithFilter($name, $response) - { - preg_match('/<table[\ \w\"\=]+id\="roleGrid_table">.*?<\/table>/siu', $response, $matches); - if (empty($matches)) { - throw new \Exception('Cannot find grid in response'); - } - $gridHtml = $matches[0]; - - $id = $this->findRoleOnPage($name, $gridHtml); - - // maybe, role is on another page, let's filter - if (false === $id) { - $newPage = $this->filterByName($name); - $id = $this->findRoleOnPage($name, $newPage); - } - - // still not found?? It's very suspicious. - if (false === $id) { - throw new \UnderflowException('Role with name "' . $name . '" not found'); - } - - return $id; - } - - /** - * Execute handler - * - * @param FixtureInterface|null $fixture [optional] - * @throws \UnexpectedValueException - * @throws \UnderflowException from findIdWithFilter - * @throws \Exception from findIdWithFilter - * @return mixed - */ - public function persist(FixtureInterface $fixture = null) - { - $url = $_ENV['app_backend_url'] . 'admin/user_role/saverole/'; - $data = $this->_preparePostData($fixture->getData('fields')); - - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $response = $curl->read(); - $curl->close(); - - if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \UnexpectedValueException('Success confirmation not found'); - } - - $data['id'] = $this->findIdWithFilter($data['rolename'], $response); - return $data; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php deleted file mode 100644 index ed2c2f0a2e039ef034f238a183ea0c6e56623108..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Curl/CreateUser.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Handler\Curl; - -use Magento\Mtf\Fixture\FixtureInterface; -use Magento\Mtf\Handler\Curl; -use Magento\Mtf\Util\Protocol\CurlInterface; -use Magento\Mtf\Util\Protocol\CurlTransport; -use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; - -/** - * Curl handler for persisting Magento user - * - */ -class CreateUser extends Curl -{ - /** - * Prepare data for using in the execute method - * - * @param array $fields - * @return array - */ - protected function _prepareData(array $fields) - { - $data = []; - foreach ($fields as $key => $value) { - $data[$key] = $value['value']; - } - return $data; - } - - /** - * Get id for newly created user - * - * @param $data - * @return mixed - * @throws \Exception - */ - protected function _getUserId($data) - { - //Sort data in grid to define user id if more than 20 items in grid - $url = $_ENV['app_backend_url'] . 'admin/user/roleGrid/sort/user_id/dir/desc'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0'); - $response = $curl->read(); - $curl->close(); - preg_match( - '/class=\"\scol\-id col\-user_id\W*>\W*(\d+)\W*<\/td>\W*<td[\w\s\"=\-]*?>\W*?' . $data['username'] . '/siu', - $response, - $matches - ); - if (empty($matches)) { - throw new \Exception('Cannot find user id'); - } - return $matches[1]; - } - - /** - * Post request for creating user in backend - * - * @param FixtureInterface $fixture - * @return array|mixed - * @throws \Exception - */ - public function persist(FixtureInterface $fixture = null) - { - $url = $_ENV['app_backend_url'] . 'admin/user/save'; - $data = $this->_prepareData($fixture->getData('fields')); - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $response = $curl->read(); - $curl->close(); - if (!strpos($response, 'data-ui-id="messages-message-success"')) { - throw new \Exception("User creation by curl handler was not successful! Response: $response"); - } - //Sort data in grid to define user id if more than 20 items in grid - $url = $_ENV['app_backend_url'] . 'admin/user/roleGrid/sort/user_id/dir/desc'; - $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); - $curl->addOption(CURLOPT_HEADER, 1); - $curl->write(CurlInterface::POST, $url, '1.0', [], $data); - $curl->read(); - $curl->close(); - $data['id'] = $this->_getUserId($data); - return $data; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/Curl.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/Curl.php new file mode 100644 index 0000000000000000000000000000000000000000..ad63a648f0bd1c74f183d09dcb12a99defa2b6c0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/Curl.php @@ -0,0 +1,142 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\Handler\Role; + +use Magento\Backend\Test\Handler\Extractor; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Handler\Curl as AbstractCurl; +use Magento\Mtf\Config; +use Magento\Mtf\Util\Protocol\CurlInterface; +use Magento\Mtf\Util\Protocol\CurlTransport; +use Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator; + +/** + * Creates Admin User role. + */ +class Curl extends AbstractCurl implements RoleInterface +{ + /** + * Additional mapping values for data. + * + * @var array + */ + protected $additionalMappingData = []; + + /** + * @constructor + * @param Config $configuration + */ + public function __construct(Config $configuration) + { + $this->mappingData = array_merge( + (null !== $this->mappingData) ? $this->mappingData : [], + $this->additionalMappingData + ); + parent::__construct($configuration); + } + + /** + * Curl creation of Admin User Role. + * + * @param FixtureInterface $fixture + * @return array|mixed + * @throws \Exception + */ + public function persist(FixtureInterface $fixture = null) + { + $data = $this->prepareData($fixture); + $url = $_ENV['app_backend_url'] . 'admin/user_role/saverole/active_tab/info/'; + $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); + $curl->addOption(CURLOPT_HEADER, 1); + $curl->write(CurlInterface::POST, $url, '1.0', [], $data); + $response = $curl->read(); + $curl->close(); + + if (!strpos($response, 'data-ui-id="messages-message-success"')) { + throw new \Exception("Role creating by curl handler was not successful! Response: $response"); + } + + $url = 'admin/user_role/roleGrid/sort/role_id/dir/desc/'; + $regExpPattern = '/col\-role_id\W*(\d+)<.td><[^<>]*?>' . $data['rolename'] . '/siu'; + + $extractor = new Extractor($url, $regExpPattern); + + return ['role_id' => $extractor->getData()[1]]; + } + + /** + * Prepare fixture data before send. + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareData(FixtureInterface $fixture = null) + { + $data = $fixture->getData(); + $data = $this->prepareResourceAccess($data); + $data = array_merge($data, $this->prepareAssignedUsers($fixture)); + $data = array_merge($data, $this->prepareAdminScope($data)); + + return $this->replaceMappingData($data); + } + + /** + * Prepare role resources data. + * + * @param array $data + * @return array + */ + protected function prepareResourceAccess(array $data) + { + $data['all'] = ($data['resource_access'] == 'All') ? 1 : 0; + if (isset($data['roles_resources'])) { + foreach ((array)$data['roles_resources'] as $resource) { + $data['resource'][] = $resource; + } + } + + return $data; + } + + /** + * Assign users to the role. + * + * @param FixtureInterface $fixture + * @return array + */ + protected function prepareAssignedUsers(FixtureInterface $fixture) + { + if (!$fixture->hasData('in_role_user')) { + return []; + } + $adminUsers = $fixture->getDataFieldConfig('in_role_user')['source']->getAdminUsers(); + $userIds = []; + foreach ($adminUsers as $adminUser) { + $userIds[] = $adminUser->getUserId() . "=true"; + } + + return ['in_role_user' => implode('&', $userIds)]; + } + + // TODO: Method should be removed in scope of MAGETWO-31563 + /** + * Prepare admin gws option. + * + * @param array $data + * @return array + */ + protected function prepareAdminScope(array $data) + { + if (isset($data['gws_is_all'])) { + $data['gws_is_all'] = 'All' == $data['gws_is_all'] ? 1 : 0; + } else { + $data['gws_is_all'] = 1; + } + + return $data; + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/AdminUserRoleInterface.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/RoleInterface.php similarity index 53% rename from dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/AdminUserRoleInterface.php rename to dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/RoleInterface.php index a7d0408abdba75e672a9131b4d2b45b0ff4cdba9..904bf57a01ca5c77237878fc684d9ad6bf66ae5b 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/AdminUserRole/AdminUserRoleInterface.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/RoleInterface.php @@ -4,14 +4,14 @@ * See COPYING.txt for license details. */ -namespace Magento\User\Test\Handler\AdminUserRole; +namespace Magento\User\Test\Handler\Role; use Magento\Mtf\Handler\HandlerInterface; /** - * Interface AdminUserRoleInterface + * Interface RoleInterface */ -interface AdminUserRoleInterface extends HandlerInterface +interface RoleInterface extends HandlerInterface { // } diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php b/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php index 2ba46490546be3923237737ceeca1b03b4b5b0b5..a79b2ec796f6c18e51dc1783d109a244ba7f29ca 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php @@ -47,8 +47,7 @@ class Curl extends AbstractCurl implements UserInterface } $url = 'admin/user/roleGrid/sort/user_id/dir/desc'; - $regExpPattern = '/class=\"\scol\-id col\-user_id\W*>\W+(\d+)\W+<\/td>\W+<td[\w\s\"=\-]*?>\W+?' - . $data['username'] . '/siu'; + $regExpPattern = '/col-user_id\W*(\d+)<.td><[^<>]*?>' . $data['username'] . '/siu'; $extractor = new Extractor($url, $regExpPattern); return ['user_id' => $extractor->getData()[1]]; diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml index 93868a2d47a883da99dd796941821f2cefa4bc88..35e58ff38d2fa1e0033e3949f49e4474315019da 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Page/Adminhtml/UserIndex.xml @@ -6,10 +6,9 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="UserIndex" area="Adminhtml" mca="admin/user" module="Magento_User"> - <block name="pageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> - <block name="userGrid" class="Magento\User\Test\Block\Adminhtml\UserGrid" locator="#permissionsUserGrid" strategy="css selector"/> - <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> - <block name="accessDeniedBlock" class="Magento\Backend\Test\Block\Denied" locator="#anchor-content" strategy="css selector"/> - </page> + <page name="UserIndex" area="Adminhtml" mca="admin/user" module="Magento_User"> + <block name="pageActions" class="Magento\Backend\Test\Block\GridPageActions" locator=".page-main-actions" strategy="css selector"/> + <block name="userGrid" class="Magento\User\Test\Block\Adminhtml\UserGrid" locator="#permissionsUserGrid" strategy="css selector"/> + <block name="messagesBlock" class="Magento\Core\Test\Block\Messages" locator="#messages" strategy="css selector"/> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUser.php b/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUser.php deleted file mode 100644 index 9046699e1a452f9bb5b7987654c28a62594219e3..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUser.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Repository; - -use Magento\Mtf\Repository\AbstractRepository; - -/** - * Class Admin User Repository - * - */ -class AdminUser extends AbstractRepository -{ - /** - * {@inheritdoc} - */ - public function __construct(array $defaultConfig = [], array $defaultData = []) - { - $this->_data['admin_default'] = [ - 'config' => $defaultConfig, - 'data' => $defaultData, - ]; - $this->_data['user_with_sales_resource'] = $this->_getUserWithRole('sales_all_scopes'); - } - - /** - * Build data for user - * - * @param string $roleName - * @return array - */ - protected function _getUserWithRole($roleName) - { - $role = [ - 'data' => [ - 'fields' => [ - 'roles' => [ - 'value' => ["%$roleName%"], - ], - ], - ], - ]; - - return array_replace_recursive($this->_data['admin_default'], $role); - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.php b/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.php deleted file mode 100644 index 08eb926a06a3e94c0a16ab168b2e50b31a41eb59..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.php +++ /dev/null @@ -1,152 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\User\Test\Repository; - -use Magento\Mtf\Factory\Factory; -use Magento\Mtf\Repository\AbstractRepository; - -/** - * Class Abstract Repository - * - */ -class Role extends AbstractRepository -{ - /** - * {@inheritdoc} - */ - public function __construct(array $defaultConfig = [], array $defaultData = []) - { - $this->_data['default'] = [ - 'config' => $defaultConfig, - 'data' => $defaultData, - ]; - - $this->initRoleTemplates(); - $this->initCustomRoles(); - } - - /** - * Role templates with different scopes for custom filling with resources, sites or stores - */ - protected function initRoleTemplates() - { - $dataTemplate = [ - 'fields' => [ - 'all' => [ - 'value' => 0, - ], - 'gws_is_all' => [ - 'value' => 0, - ], - 'rolename' => [ - 'value' => 'auto%isolation%', - ], - ], - ]; - - $this->_data['all_permissions_all_scopes']['data'] = $this->setPermissions( - 'all', - $this->setScope('all', $dataTemplate) - ); - - $this->_data['all_permissions_website_scope']['data'] = $this->setPermissions( - 'all', - $this->setScope('website', $dataTemplate) - ); - - $this->_data['all_permissions_store_scope']['data'] = $this->setPermissions( - 'all', - $this->setScope('store', $dataTemplate) - ); - - $this->_data['custom_permissions_all_scopes']['data'] = $this->setPermissions( - 'custom', - $this->setScope('all', $dataTemplate) - ); - - $this->_data['custom_permissions_website_scope']['data'] = $this->setPermissions( - 'custom', - $this->setScope('website', $dataTemplate) - ); - - $this->_data['custom_permissions_store_scope']['data'] = $this->setPermissions( - 'custom', - $this->setScope('store', $dataTemplate) - ); - } - - /** - * Init most popular custom roles - */ - protected function initCustomRoles() - { - $resourceFixture = Factory::getFixtureFactory()->getMagentoUserResource(); - $salesAllScopes = $this->_data['custom_permissions_all_scopes']['data']; - $salesAllScopes['fields']['resource']['value'] = $resourceFixture->get('Magento_Sales::sales'); - $this->_data['sales_all_scopes']['data'] = $salesAllScopes; - } - - /** - * Add role permission values to data array - * - * @param $permissions string. Possible values 'custom' or 'all' - * @param array $data - * @return array - * @throws \InvalidArgumentException - */ - protected function setPermissions($permissions, $data = []) - { - if ('all' == $permissions) { - $data['fields']['all']['value'] = 1; - } elseif ('custom' == $permissions) { - $data['fields']['all']['value'] = 0; - $data['fields']['resource']['value'] = []; - } else { - throw new \InvalidArgumentException('Invalid permissions "' . $permissions . '"'); - } - return $data; - } - - /** - * Set role scope: all, website or store - * - * @param string $scope possible values 'all', 'website', 'store' - * @param array $data - * @return array - * @throws \InvalidArgumentException - */ - protected function setScope($scope, $data = []) - { - switch ($scope) { - case 'all': - $data['fields']['gws_is_all']['value'] = 1; - break; - case 'website': - $data['fields']['gws_is_all']['value'] = 0; - $data['fields']['gws_websites']['value'] = []; - break; - case 'store': - $data['fields']['gws_is_all']['value'] = 0; - $data['fields']['gws_store_groups']['value'] = []; - break; - default: - throw new \InvalidArgumentException('Invalid role scope "' . $scope . '"'); - } - return $data; - } - - /** - * Save custom data set to repository - * - * @param string $dataSetName - * @param array $data - */ - public function set($dataSetName, array $data) - { - $this->_data[$dataSetName]['data'] = $data; - } -} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUserRole.xml b/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.xml similarity index 97% rename from dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUserRole.xml rename to dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.xml index 153c99a4b94368a9c8c6a7da4fd253c8bdb655a9..0413aad55c01e2cfe74d044a29b2cf8007b5b38b 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/AdminUserRole.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Repository/Role.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd"> - <repository class="Magento\User\Test\Repository\AdminUserRole"> + <repository class="Magento\User\Test\Repository\Role"> <dataset name="default"> <field name="rolename" xsi:type="string">RoleName%isolation%</field> <field name="resource_access" xsi:type="string">All</field> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml b/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml index e16fae4b2fc760e5f813174b5a2d869d2cc17f99..ab4fdba7cb44fb5833a6e2f994f3c2693d217e07 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/Repository/User.xml @@ -36,7 +36,7 @@ <field name="password" xsi:type="string">123123q</field> <field name="password_confirmation" xsi:type="string">123123q</field> <field name="role_id" xsi:type="array"> - <item name="dataSet" xsi:type="string">default</item> + <item name="dataSet" xsi:type="string">role::default</item> </field> <field name="current_password" xsi:type="string">%current_password%</field> <field name="is_active" xsi:type="string">Active</field> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml index 39f5dee8caa4b240a667cb8dcf00f9410eef9099..c71d32fb5b91f118f3c8067ff82d467861638f4b 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserEntityTest.xml @@ -6,93 +6,89 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\CreateAdminUserEntityTest"> - <variation name="CreateAdminUserEntityTestVariation1"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation2"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Inactive</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation3"> - <data name="user/data/username" xsi:type="string">-</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">username</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation4"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">-</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">Administrators</data> - <data name="isDuplicated" xsi:type="string">email</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation5"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> - </variation> - <variation name="CreateAdminUserEntityTestVariation6"> - <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> - <data name="user/data/email" xsi:type="string">email%isolation%@example.cim</data> - <data name="user/data/password" xsi:type="string">123123q</data> - <data name="user/data/password_confirmation" xsi:type="string">123123q</data> - <data name="user/data/is_active" xsi:type="string">Active</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="isDuplicated" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">%current_password%</data> - <constraint name="Magento\User\Test\Constraint\AssertUserInvalidEmailMessage"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\CreateAdminUserEntityTest"> + <variation name="CreateAdminUserEntityTestVariation1"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation2"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Inactive</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation3"> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">username</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation4"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::Administrators</data> + <data name="isDuplicated" xsi:type="string">email</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserDuplicateMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation5"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> + </variation> + <variation name="CreateAdminUserEntityTestVariation6"> + <data name="user/data/username" xsi:type="string">AdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">FirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">LastName%isolation%</data> + <data name="user/data/email" xsi:type="string">email%isolation%@example.cim</data> + <data name="user/data/password" xsi:type="string">123123q</data> + <data name="user/data/password_confirmation" xsi:type="string">123123q</data> + <data name="user/data/is_active" xsi:type="string">Active</data> + <data name="isDuplicated" xsi:type="string">-</data> + <data name="user/data/current_password" xsi:type="string">%current_password%</data> + <constraint name="Magento\User\Test\Constraint\AssertUserInvalidEmailMessage"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php index 57ae388e1a34cd35a209afbacee0758a62c99b6b..f37fc9ab0694a145c81bf435685bd68e24475b64 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.php @@ -6,7 +6,7 @@ namespace Magento\User\Test\TestCase; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Page\Adminhtml\UserRoleEditRole; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; use Magento\Mtf\TestCase\Injectable; @@ -59,9 +59,9 @@ class CreateAdminUserRoleEntityTest extends Injectable /** * Runs Create Admin User Role Entity test. * - * @param AdminUserRole $role + * @param Role $role */ - public function testCreateUserRole(AdminUserRole $role) + public function testCreateUserRole(Role $role) { //Steps $this->userRoleIndex->open(); diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml index 0113079846524c4766208c56a6b23cd4e7cf3aca..aa70d5ad8bf4ec8fd910a5d90782edc20ee6aa5b 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/CreateAdminUserRoleEntityTest.xml @@ -6,20 +6,19 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\CreateAdminUserRoleEntityTest"> - <variation name="CreateAdminUserRoleEntityTestVariation1"> - <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> - <data name="role/data/resource_access" xsi:type="string">Custom</data> - <data name="role/data/roles_resources" xsi:type="string">Sales</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - </variation> - <variation name="CreateAdminUserRoleEntityTestVariation2"> - <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> - <data name="role/data/resource_access" xsi:type="string">All</data> - <data name="role/data/roles_resources" xsi:type="string">-</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\CreateAdminUserRoleEntityTest"> + <variation name="CreateAdminUserRoleEntityTestVariation1"> + <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> + <data name="role/data/resource_access" xsi:type="string">Custom</data> + <data name="role/data/roles_resources" xsi:type="string">Sales</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + </variation> + <variation name="CreateAdminUserRoleEntityTestVariation2"> + <data name="role/data/rolename" xsi:type="string">AdminRole%isolation%</data> + <data name="role/data/resource_access" xsi:type="string">All</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml index 49cf5bf2094e79d057a0e225395307aca49c1f25..0a8c1deb857b4ca0a083b80808332f58485fe375 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteAdminUserEntityTest.xml @@ -6,15 +6,16 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\DeleteAdminUserEntityTest"> - <variation name="DeleteAdminUserEntityTestVariation1"> - <constraint name="Magento\User\Test\Constraint\AssertImpossibleDeleteYourOwnAccount"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - </variation> - <variation name="DeleteAdminUserEntityTestVariation2"> - <data name="isDefaultUser" xsi:type="string">1</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessDeleteMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserNotInGrid"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\DeleteAdminUserEntityTest"> + <variation name="DeleteAdminUserEntityTestVariation1"> + <data name="isDefaultUser" xsi:type="string">0</data> + <constraint name="Magento\User\Test\Constraint\AssertImpossibleDeleteYourOwnAccount" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + </variation> + <variation name="DeleteAdminUserEntityTestVariation2"> + <data name="isDefaultUser" xsi:type="string">1</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessDeleteMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserNotInGrid" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php index 161917c3b546196c4ac0619af2aa9d94a2170da8..b4cf004d50b0139d06c4aba565a19b351d3512bd 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.php @@ -8,7 +8,7 @@ namespace Magento\User\Test\TestCase; use Magento\Backend\Test\Page\AdminAuthLogin; use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\User\Test\Page\Adminhtml\UserRoleEditRole; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; @@ -100,13 +100,13 @@ class DeleteUserRoleEntityTest extends Injectable /** * Runs Delete User Role Entity test. * - * @param AdminUserRole $role + * @param Role $role * @param User $adminUser * @param string $isDefaultUser * @return void */ public function testDeleteAdminUserRole( - AdminUserRole $role, + Role $role, User $adminUser, $isDefaultUser ) { diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml index 5a3817a86bf8940c655ab918616c5b0cebe66c06..51c92524b1b0c2d2301bb65b1047ad6367f43b7d 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/DeleteUserRoleEntityTest.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\User\Test\TestCase\DeleteUserRoleEntityTest"> <variation name="DeleteUserRoleEntityTestVariation1"> + <data name="isDefaultUser" xsi:type="string">0</data> <constraint name="Magento\User\Test\Constraint\AssertImpossibleDeleteYourOwnRole"/> <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> </variation> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..692af412394d29b11c476861d27c119b054d12a1 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest92"> + <data name="menuItem" xsi:type="string">System > All Users</data> + <data name="pageTitle" xsi:type="string">Users</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + <variation name="NavigateMenuTest93"> + <data name="menuItem" xsi:type="string">System > User Roles</data> + <data name="pageTitle" xsi:type="string">Roles</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php index cad7c857bfb4794f0d5abb76d72e42045a7e8937..66c76db855a19df4e1dc703639354022969daedc 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.php @@ -15,9 +15,6 @@ use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestCase\Injectable; /** - * Test Creation for UpdateAdminUserEntity - * - * Test Flow: * Preconditions: * 1. Admin user with assigned full access role is created. * 2. Custom role with restricted permission: Sales is created @@ -38,35 +35,46 @@ class UpdateAdminUserEntityTest extends Injectable /* tags */ const MVP = 'no'; const DOMAIN = 'PS'; + const TEST_TYPE = 'acceptance_test'; /* end tags */ /** + * User list page on backend. + * * @var UserIndex */ protected $userIndex; /** + * User edit page on backend. + * * @var UserEdit */ protected $userEdit; /** + * Dashboard page on backend. + * * @var Dashboard */ protected $dashboard; /** + * Authorization page on backend. + * * @var AdminAuthLogin */ protected $adminAuth; /** + * Fixture factory. + * * @var FixtureFactory */ protected $fixtureFactory; /** - * Setup necessary data for test + * Setup necessary data for test. * * @param UserIndex $userIndex * @param UserEdit $userEdit @@ -90,16 +98,17 @@ class UpdateAdminUserEntityTest extends Injectable } /** - * Runs Update Admin User test + * Runs Update Admin User test. * - * @param User $user * @param User $initialUser + * @param User $user * @param string $loginAsDefaultAdmin * @return array + * @throws \Exception */ public function testUpdateAdminUser( - User $user, User $initialUser, + User $user, $loginAsDefaultAdmin ) { // Precondition @@ -117,20 +126,18 @@ class UpdateAdminUserEntityTest extends Injectable $this->userEdit->getUserForm()->fill($user); $this->userEdit->getPageActions()->save(); - return ['customAdmin' => $this->mergeUsers($user, $initialUser)]; + return ['user' => $this->mergeUsers($initialUser, $user)]; } /** - * Merging user data and returns custom user + * Merging user data and returns custom user. * - * @param User $user * @param User $initialUser + * @param User $user * @return User */ - protected function mergeUsers( - User $user, - User $initialUser - ) { + protected function mergeUsers(User $initialUser, User $user) + { $data = array_merge($initialUser->getData(), $user->getData()); if (isset($data['role_id'])) { $data['role_id'] = [ @@ -144,7 +151,7 @@ class UpdateAdminUserEntityTest extends Injectable } /** - * Logout Admin User from account + * Logout Admin User from account. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml index dd0f2c27818ef7106a348d6556f50ec3d56c38a9..c002a9df38696ef99b8112ca7282bdeef6203cfa 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserEntityTest.xml @@ -7,55 +7,59 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\User\Test\TestCase\UpdateAdminUserEntityTest"> - <variation name="UpdateAdminUserEntityTestVariation1"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/username" xsi:type="string">NewAdminUser%isolation%</data> - <data name="user/data/firstname" xsi:type="string">NewFirstName%isolation%</data> - <data name="user/data/lastname" xsi:type="string">NewLastName%isolation%</data> - <data name="user/data/email" xsi:type="string">NewEmail%isolation%@example.com</data> - <data name="user/data/password" xsi:type="string">123123qa</data> - <data name="user/data/password_confirmation" xsi:type="string">123123qa</data> - <data name="user/data/is_active" xsi:type="string">-</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - </variation> - <variation name="UpdateAdminUserEntityTestVariation2"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/username" xsi:type="string">-</data> - <data name="user/data/firstname" xsi:type="string">-</data> - <data name="user/data/lastname" xsi:type="string">-</data> - <data name="user/data/email" xsi:type="string">-</data> - <data name="user/data/password" xsi:type="string">-</data> - <data name="user/data/password_confirmation" xsi:type="string">-</data> - <data name="user/data/is_active" xsi:type="string">-</data> - <data name="user/data/role_id/dataSet" xsi:type="string">role_sales</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - <constraint name="Magento\User\Test\Constraint\AssertUserRoleSalesRestrictedAccess"/> - </variation> - <variation name="UpdateAdminUserEntityTestVariation3"> - <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="user/data/username" xsi:type="string">-</data> - <data name="user/data/firstname" xsi:type="string">-</data> - <data name="user/data/lastname" xsi:type="string">-</data> - <data name="user/data/email" xsi:type="string">-</data> - <data name="user/data/password" xsi:type="string">-</data> - <data name="user/data/password_confirmation" xsi:type="string">-</data> - <data name="user/data/is_active" xsi:type="string">Inactive</data> - <data name="user/data/role_id/dataSet" xsi:type="string">-</data> - <data name="loginAsDefaultAdmin" xsi:type="string">1</data> - <data name="user/data/current_password" xsi:type="string">123123q</data> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertUserInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage"/> - </variation> + <variation name="UpdateAdminUserEntityTestVariation1"> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/username" xsi:type="string">NewAdminUser%isolation%</data> + <data name="user/data/firstname" xsi:type="string">NewFirstName%isolation%</data> + <data name="user/data/lastname" xsi:type="string">NewLastName%isolation%</data> + <data name="user/data/email" xsi:type="string">NewEmail%isolation%@example.com</data> + <data name="user/data/password" xsi:type="string">123123qa</data> + <data name="user/data/password_confirmation" xsi:type="string">123123qa</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="loginAsDefaultAdmin" xsi:type="string">0</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin" /> + </variation> + <variation name="UpdateAdminUserEntityTestVariation2"> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::role_sales</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="loginAsDefaultAdmin" xsi:type="string">0</data> + <data name="restrictedAccess" xsi:type="array"> + <item name="0" xsi:type="string">sales</item> + </data> + <data name="denyUrl" xsi:type="string">admin/user</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin" /> + <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess" /> + </variation> + <variation name="UpdateAdminUserEntityTestVariation3"> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/is_active" xsi:type="string">Inactive</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="loginAsDefaultAdmin" xsi:type="string">1</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserInGrid" /> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut" /> + <constraint name="Magento\User\Test\Constraint\AssertUserWrongCredentialsMessage" /> + </variation> + <variation name="UpdateAdminUserEntityTestVariation4"> + <data name="description" xsi:type="string">MAGETWO-12375: Use ACL Role with Full GWS Scope (without Using Secret Key to URLs)</data> + <data name="loginAsDefaultAdmin" xsi:type="string">1</data> + <data name="initialUser/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="user/data/role_id/dataSet" xsi:type="string">role::role_sales</data> + <data name="user/data/current_password" xsi:type="string">123123q</data> + <data name="restrictedAccess" xsi:type="array"> + <item name="0" xsi:type="string">sales</item> + </data> + <data name="denyUrl" xsi:type="string">catalog/product</data> + <data name="tag" xsi:type="string">test_type:acceptance_test</data> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessSaveMessage" /> + <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php index 06a396c982cbac2ccd316f69d478f20d0a6b9b00..5908a7ffd7b916234fd0d09aeb6382a9bddb58aa 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.php @@ -8,7 +8,7 @@ namespace Magento\User\Test\TestCase; use Magento\Backend\Test\Page\AdminAuthLogin; use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\User\Test\Page\Adminhtml\UserRoleEditRole; use Magento\User\Test\Page\Adminhtml\UserRoleIndex; @@ -81,14 +81,14 @@ class UpdateAdminUserRoleEntityTest extends Injectable /** * Runs Update Admin User Roles Entity test * - * @param AdminUserRole $roleInit - * @param AdminUserRole $role + * @param Role $roleInit + * @param Role $role * @param User $user * @return array */ public function testUpdateAdminUserRolesEntity( - AdminUserRole $roleInit, - AdminUserRole $role, + Role $roleInit, + Role $role, User $user ) { // Preconditions @@ -108,7 +108,7 @@ class UpdateAdminUserRoleEntityTest extends Injectable $this->userRoleEditRole->getPageActions()->save(); return [ - 'customAdmin' => $role->hasData('in_role_users') + 'user' => $role->hasData('in_role_users') ? $role->getDataFieldConfig('in_role_users')['source']->getAdminUsers()[0] : $user, ]; diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml index b4ce41cdb8545f2955ea01c6fa6e5e5e9a53f6b6..e64b21124c8b1db49907f7571c2ce2242f2aa157 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UpdateAdminUserRoleEntityTest.xml @@ -6,29 +6,33 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\User\Test\TestCase\UpdateAdminUserRoleEntityTest"> - <variation name="UpdateAdminUserRoleEntityTestVariation1"> - <data name="user/dataSet" xsi:type="string">custom_admin_with_default_role</data> - <data name="role/data/rolename" xsi:type="string">NewAdminRole%isolation%</data> - <data name="role/data/resource_access" xsi:type="string">-</data> - <data name="role/data/roles_resources" xsi:type="string">-</data> - <data name="role/data/in_role_users/dataSet" xsi:type="string">-</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - </variation> - <variation name="UpdateAdminUserRoleEntityTestVariation2"> - <data name="user/dataSet" xsi:type="string">default</data> - <data name="role/data/rolename" xsi:type="string">-</data> - <data name="role/data/resource_access" xsi:type="string">Custom</data> - <data name="role/data/roles_resources" xsi:type="string">Sales</data> - <data name="role/data/in_role_users/dataSet" xsi:type="string">custom_admin</data> - <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> - <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> - <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> - <constraint name="Magento\User\Test\Constraint\AssertUserRoleSalesRestrictedAccess"/> - </variation> - </testCase> + <testCase name="Magento\User\Test\TestCase\UpdateAdminUserRoleEntityTest"> + <variation name="UpdateAdminUserRoleEntityTestVariation1"> + <data name="user/dataSet" xsi:type="string">custom_admin_with_default_role</data> + <data name="role/data/rolename" xsi:type="string">NewAdminRole%isolation%</data> + <data name="role/data/resource_access" xsi:type="string">-</data> + <data name="role/data/roles_resources" xsi:type="string">-</data> + <data name="role/data/in_role_users/dataSet" xsi:type="string">-</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> + </variation> + <variation name="UpdateAdminUserRoleEntityTestVariation2"> + <data name="user/dataSet" xsi:type="string">default</data> + <data name="role/data/rolename" xsi:type="string">-</data> + <data name="role/data/resource_access" xsi:type="string">Custom</data> + <data name="role/data/roles_resources" xsi:type="string">Sales</data> + <data name="role/data/in_role_users/dataSet" xsi:type="string">custom_admin</data> + <data name="restrictedAccess" xsi:type="array"> + <item name="0" xsi:type="string">sales</item> + </data> + <data name="denyUrl" xsi:type="string">catalog/product</data> + <constraint name="Magento\User\Test\Constraint\AssertRoleSuccessSaveMessage"/> + <constraint name="Magento\User\Test\Constraint\AssertRoleInGrid"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogOut"/> + <constraint name="Magento\User\Test\Constraint\AssertUserSuccessLogin"/> + <constraint name="Magento\User\Test\Constraint\AssertUserRoleRestrictedAccess"/> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php index 003e6640bdfe763919f694d9115d8a78e3d77ea4..b67ceaa5b97e363ec1116ad60abd5f217ef68aad 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestCase/UserLoginAfterChangingPermissionsTest.php @@ -7,7 +7,7 @@ namespace Magento\User\Test\TestCase; use Magento\Backend\Test\Page\Adminhtml\Dashboard; -use Magento\User\Test\Fixture\AdminUserRole; +use Magento\User\Test\Fixture\Role; use Magento\User\Test\Fixture\User; use Magento\User\Test\Page\Adminhtml\UserEdit; use Magento\User\Test\Page\Adminhtml\UserIndex; @@ -122,14 +122,14 @@ class UserLoginAfterChangingPermissionsTest extends Injectable } /** - * @param AdminUserRole $role - * @param AdminUserRole $updatedRole + * @param Role $role + * @param Role $updatedRole * @param User $user * @return void */ public function testLoginAfterChangingPermissions( - AdminUserRole $role, - AdminUserRole $updatedRole, + Role $role, + Role $updatedRole, User $user ) { /** Create role and a new user with this role */ diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LoginUserOnBackendStep.php b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LoginUserOnBackendStep.php new file mode 100644 index 0000000000000000000000000000000000000000..de73873c4950e1f611ff7ba3e33a72fac1e88f3d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LoginUserOnBackendStep.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\TestStep; + +use Magento\Backend\Test\Page\AdminAuthLogin; +use Magento\Mtf\TestStep\TestStepInterface; +use Magento\User\Test\Fixture\User; + +/** + * Login user on backend. + */ +class LoginUserOnBackendStep implements TestStepInterface +{ + /** + * Logout user on backend step. + * + * @var LogoutUserOnBackendStep + */ + protected $logoutUserOnBackendStep; + + /** + * Authorization backend page. + * + * @var AdminAuthLogin + */ + protected $adminAuth; + + /** + * Fixture User. + * + * @var User + */ + protected $user; + + /** + * @constructor + * @param LogoutUserOnBackendStep $logoutUserOnBackendStep + * @param AdminAuthLogin $adminAuth + * @param User $user + */ + public function __construct( + LogoutUserOnBackendStep $logoutUserOnBackendStep, + AdminAuthLogin $adminAuth, + User $user + ) { + $this->logoutUserOnBackendStep = $logoutUserOnBackendStep; + $this->adminAuth = $adminAuth; + $this->user = $user; + } + + /** + * Run step flow. + * + * @return void + */ + public function run() + { + $this->logoutUserOnBackendStep->run(); + + $this->adminAuth->open(); + $this->adminAuth->getLoginBlock()->fill($this->user); + $this->adminAuth->getLoginBlock()->submit(); + $this->adminAuth->getLoginBlock()->waitFormNotVisible(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LogoutUserOnBackendStep.php b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LogoutUserOnBackendStep.php new file mode 100644 index 0000000000000000000000000000000000000000..cf3227fafecbabb0a89ef565a67aaa430711170c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/User/Test/TestStep/LogoutUserOnBackendStep.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\User\Test\TestStep; + +use Magento\Backend\Test\Page\AdminAuthLogin; +use Magento\Backend\Test\Page\Adminhtml\Dashboard; +use Magento\Mtf\TestStep\TestStepInterface; + +/** + * Logout user on backend. + */ +class LogoutUserOnBackendStep implements TestStepInterface +{ + /** + * Authorization backend page. + * + * @var AdminAuthLogin + */ + protected $adminAuth; + + /** + * Dashboard backend page. + * + * @var Dashboard + */ + protected $dashboard; + + /** + * @construct + * @param AdminAuthLogin $adminAuth + * @param Dashboard $dashboard + */ + public function __construct(AdminAuthLogin $adminAuth, Dashboard $dashboard) + { + $this->adminAuth = $adminAuth; + $this->dashboard = $dashboard; + } + + /** + * Run step flow. + * + * @return void + */ + public function run() + { + $this->adminAuth->open(); + if ($this->dashboard->getAdminPanelHeader()->isVisible()) { + $this->dashboard->getAdminPanelHeader()->logOut(); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml b/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml index e5d8c6b54b072cad708f2d679a28afb398df3097..7801b2d8fc637c445e6071545c3ef2bd81912d66 100644 --- a/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml +++ b/dev/tests/functional/tests/app/Magento/User/Test/etc/curl/di.xml @@ -6,6 +6,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> - <preference for="Magento\User\Test\Handler\AdminUserRole\AdminUserRoleInterface" type="\Magento\User\Test\Handler\AdminUserRole\Curl" /> + <preference for="Magento\User\Test\Handler\Role\RoleInterface" type="\Magento\User\Test\Handler\Role\Curl" /> <preference for="Magento\User\Test\Handler\User\UserInterface" type="\Magento\User\Test\Handler\User\Curl" /> </config> \ No newline at end of file diff --git a/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..7a832e8763322093a2814bcd7468bfbab9848d6a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Variable/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest94"> + <data name="menuItem" xsi:type="string">System > Custom Variables</data> + <data name="pageTitle" xsi:type="string">Custom Variables</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/ChosenOption.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/ChosenOption.php new file mode 100644 index 0000000000000000000000000000000000000000..bce4e8a44da8145e626017b91ea45819613a5470 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/ChosenOption.php @@ -0,0 +1,143 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Block\Adminhtml\Widget; + +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Client\Element\SimpleElement; + +/** + * Widget Chosen Option. + */ +class ChosenOption extends SimpleElement +{ + /** + * Select page button selector. + * + * @var string + */ + protected $selectButton = '//ancestor::body//button[contains(@class,"btn-chooser")]'; + + /** + * Magento varienLoader.js loader. + * + * @var string + */ + protected $loaderOld = '//ancestor::body/div[@id="loading-mask"]'; + + // @codingStandardsIgnoreStart + /** + * Select block selector. + * + * @var string + */ + protected $selectBlock = "//ancestor::body//div[contains(@style,'display: block')]//*[contains(@id,'responseCntoptions')]"; + // @codingStandardsIgnoreEnd + + /** + * Page widget chooser block class. + * + * @var string + */ + protected $pageWidgetChooserBlockClass = 'Magento\Cms\Test\Block\Adminhtml\Page\Widget\Chooser'; + + /** + * Category widget chooser block class. + * + * @var string + */ + protected $categoryWidgetChooserBlockClass = '\Magento\Catalog\Test\Block\Adminhtml\Category\Widget\Chooser'; + + /** + * Product widget chooser block class. + * + * @var string + */ + protected $productWidgetChooserBlockClass = '\Magento\Catalog\Test\Block\Adminhtml\Product\Widget\Chooser'; + + /** + * Entity chooser block class mapping. + * + * @var array + */ + protected $chooserClasses = [ + 'page' => 'Magento\Cms\Test\Block\Adminhtml\Page\Widget\Chooser', + 'category' => 'Magento\Catalog\Test\Block\Adminhtml\Category\Widget\Chooser', + 'product' => 'Magento\Catalog\Test\Block\Adminhtml\Product\Widget\Chooser', + ]; + + /** + * Select widget options. + * + * @param string $value + * @return void + */ + public function setValue($value) + { + $this->clickSelectButton(); + if (isset($value['filter_url_key'])) { + $this->getClassBlock($this->chooserClasses['page']) + ->searchAndOpen(['chooser_identifier' => $value['filter_url_key']]); + } + if (isset($value['filter_identifier'])) { + $this->getClassBlock($this->chooserClasses['page']) + ->searchAndOpen(['chooser_identifier' => $value['filter_identifier']]); + } + if (isset($value['category_path'])) { + if (isset($value['filter_sku'])) { + $this->getClassBlock($this->chooserClasses['category']) + ->selectCategoryByName($value['category_path']); + $this->getClassBlock($this->chooserClasses['product']) + ->searchAndOpen(['chooser_sku' => $value['filter_sku']]); + } else { + $this->getClassBlock($this->chooserClasses['category']) + ->selectCategoryByName($value['category_path']); + } + } + } + + /** + * Clicking to select button. + * + * @return void + */ + protected function clickSelectButton() + { + $this->find($this->selectButton, Locator::SELECTOR_XPATH)->click(); + $this->waitLoader(); + } + + /** + * Waiting loader. + * + * @return void + */ + protected function waitLoader() + { + $browser = $this; + $loaderSelector = $this->loaderOld; + $this->waitUntil( + function () use ($browser, $loaderSelector) { + $loader = $browser->find($loaderSelector); + return $loader->isVisible() == false ? true : null; + } + ); + } + + /** + * Get block by class. + * + * @param string $class + * @return mixed + */ + protected function getClassBlock($class) + { + return \Magento\Mtf\ObjectManager::getInstance()->create( + $class, + ['element' => $this->find($this->selectBlock, Locator::SELECTOR_XPATH)] + ); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php new file mode 100644 index 0000000000000000000000000000000000000000..570f597f47de9a91485843983004c4e5d68700e8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/WidgetGrid.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Block\Adminhtml\Widget; + +use Magento\Backend\Test\Block\Widget\Grid as AbstractGrid; + +/** + * Widget grid on the Widget Instance Index page. + */ +class WidgetGrid extends AbstractGrid +{ + /** + * Locator value for link in action column. + * + * @var string + */ + protected $editLink = 'tbody tr td.col-title'; + + /** + * First row selector. + * + * @var string + */ + protected $firstRowSelector = '//tr[./td[contains(@class, "col-title")]][1]/td'; + + /** + * Filters array mapping. + * + * @var array + */ + protected $filters = [ + 'title' => [ + 'selector' => 'input[name="title"]', + ], + ]; +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.php b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.php new file mode 100644 index 0000000000000000000000000000000000000000..27cdefabd160dcd24b274feb480b4040f8b7392e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.php @@ -0,0 +1,74 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Widget\Test\Block\Adminhtml; + +use Magento\Mtf\Block\Form; +use Magento\Mtf\Client\Locator; + +/** + * Backend add widget block form. + */ +class WidgetForm extends Form +{ + /** + * Widget type selector. + * + * @var string + */ + protected $widgetType = '[name="widget_type"]'; + + /** + * Insert widget button selector. + * + * @var string + */ + protected $insertButton = '#insert_button'; + + /** + * Magento varienLoader.js loader. + * + * @var string + */ + protected $loaderOld = '//ancestor::body/div[@id="loading-mask"]'; + + /** + * Add widgets. + * + * @param array $widget + * @return void + */ + public function addWidget($widget) + { + $this->selectWidgetType($widget['widget_type']); + $mapping = $this->dataMapping($widget); + $this->_fill($mapping); + $this->insertWidget(); + } + + /** + * Select widget type. + * + * @param string $type + * @return void + */ + protected function selectWidgetType($type) + { + $this->_rootElement->find($this->widgetType, Locator::SELECTOR_CSS, 'select')->setValue($type); + $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH); + } + + /** + * Click Insert Widget button. + * + * @return void + */ + protected function insertWidget() + { + $this->_rootElement->find($this->insertButton)->click(); + $this->waitForElementNotVisible($this->loaderOld, Locator::SELECTOR_XPATH); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.xml new file mode 100644 index 0000000000000000000000000000000000000000..5f089a8e4ff001b8fdce60be66eb22b41fe6466d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" ?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<mapping strict="0"> + <wrapper>parameters</wrapper> + <fields> + <widget_type> + <selector>#select_widget_type</selector> + <input>select</input> + </widget_type> + <anchor_text/> + <title/> + <template> + <input>select</input> + </template> + <chosen_option> + <selector>.control button</selector> + <class>\Magento\Widget\Test\Block\Adminhtml\Widget\ChosenOption</class> + </chosen_option> + <display_type> + <input>select</input> + </display_type> + <show_pager> + <input>select</input> + </show_pager> + <products_count/> + <cache_lifetime/> + <page_size/> + </fields> +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..d66ba7af5f9c185f96fed2b96ecffa293dc9f4a7 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Widget/Test/TestCase/NavigateMenuTest.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Backend\Test\TestCase\NavigateMenuTest"> + <variation name="NavigateMenuTest96"> + <data name="menuItem" xsi:type="string">Content > Frontend Apps</data> + <data name="pageTitle" xsi:type="string">Frontend Apps</data> + <constraint name="Magento\Backend\Test\Constraint\AssertBackendPageIsAvailable"/> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php new file mode 100644 index 0000000000000000000000000000000000000000..bb60457362c20cc97c78a5e1208e86e66b30319b --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AbstractAssertWishlistProductDetails.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Wishlist\Test\Constraint; + +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Wishlist\Test\Page\WishlistIndex; +use Magento\Mtf\Constraint\AbstractAssertForm; + +/** + * Assert that the correct option details are displayed on the "View Details" tool tip. + */ +abstract class AbstractAssertWishlistProductDetails extends AbstractAssertForm +{ + /** + * Assert product details. + * + * @param WishlistIndex $wishlistIndex + * @param InjectableFixture $product + * @param FixtureFactory $fixtureFactory + * @return void + */ + protected function assertProductDetails( + WishlistIndex $wishlistIndex, + InjectableFixture $product, + FixtureFactory $fixtureFactory + ) { + $actualOptions = $wishlistIndex->getItemsBlock()->getItemProduct($product)->getOptions(); + $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); + $expectedOptions = $cartFixture->getItems()[0]->getData()['options']; + + $errors = $this->verifyData( + $this->sortDataByPath($expectedOptions, '::title'), + $this->sortDataByPath($actualOptions, '::title') + ); + \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php index a3a6c805a6fcecb17eea2cae36186a8f9ffc6b62..405852f2ee186bbbee71db6b088423988b582922 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php @@ -13,13 +13,12 @@ use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\Fixture\InjectableFixture; /** - * Class AssertBundleProductDetailsInWishlist - * Assert that the correct option details are displayed on the "View Details" tool tip + * Assert that the correct option details are displayed on the "View Details" tool tip. */ -class AssertProductDetailsInWishlist extends AbstractAssertForm +class AssertProductDetailsInWishlist extends AbstractAssertWishlistProductDetails { /** - * Assert that the correct option details are displayed on the "View Details" tool tip + * Assert that the correct option details are displayed on the "View Details" tool tip. * * @param CmsIndex $cmsIndex * @param WishlistIndex $wishlistIndex @@ -34,19 +33,11 @@ class AssertProductDetailsInWishlist extends AbstractAssertForm FixtureFactory $fixtureFactory ) { $cmsIndex->getLinksBlock()->openLink('My Wish List'); - $actualOptions = $wishlistIndex->getItemsBlock()->getItemProduct($product)->getOptions(); - $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]); - $expectedOptions = $cartFixture->getItems()[0]->getData()['options']; - - $errors = $this->verifyData( - $this->sortDataByPath($expectedOptions, '::title'), - $this->sortDataByPath($actualOptions, '::title') - ); - \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); + $this->assertProductDetails($wishlistIndex, $fixtureFactory, $product); } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php index b83ca2292615ded60e73de1cf71269806660935c..5c1d7416344989bff1c60c8dfae26978a2df2b35 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php @@ -43,6 +43,7 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli */ public function test(Customer $customer, $products, $qty) { + $this->markTestIncomplete('Bug: MAGETWO-34757'); // Preconditions $customer->persist(); $this->loginCustomer($customer); diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php index b358e5c1344026b539c9ce5b17766f1f21f4edc2..233640f3eb4908ec7072d51579ca20d25851b9a0 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnBackendTest.php @@ -44,6 +44,7 @@ class ConfigureProductInCustomerWishlistOnBackendTest extends AbstractWishlistTe */ public function __prepare(Customer $customer) { + $this->markTestIncomplete('Bug: MAGETWO-31868'); $customer->persist(); return ['customer' => $customer]; diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml index 65a635664b919e904c2c50dbf85faab476a02cdd..c1ff8db58e314ce323563668344faa431e61e46e 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.xml @@ -6,31 +6,33 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Wishlist\Test\TestCase\ConfigureProductInCustomerWishlistOnFrontendTest"> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation1" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation2" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">configurableProduct::default</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation3" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation4" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation5" firstConstraint="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" method="test"> - <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" next="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist"/> - <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" prev="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist"/> - </variation> - </testCase> + <testCase name="Magento\Wishlist\Test\TestCase\ConfigureProductInCustomerWishlistOnFrontendTest"> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation1"> + <data name="product" xsi:type="string">catalogProductSimple::with_two_custom_option</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation2"> + <data name="product" xsi:type="string">configurableProduct::default</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation3"> + <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> + <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation4"> + <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> + <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + <variation name="ConfigureProductInCustomerWishlistOnFrontendTestVariation5"> + <data name="product" xsi:type="string">groupedProduct::three_simple_products</data> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductIsPresentInWishlist" /> + <constraint name="Magento\Wishlist\Test\Constraint\AssertProductDetailsInWishlist" /> + </variation> + </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php index 7083e3e70ace578881d1d755adb684bee008b772..d325e868b4e703ba7bfb19e1e5816da24c5bdb07 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/MoveProductFromShoppingCartToWishlistTest.php @@ -12,8 +12,6 @@ use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Fixture\FixtureInterface; /** - * Test Flow: - * * Preconditions: * 1. Test products are created. * @@ -68,6 +66,7 @@ class MoveProductFromShoppingCartToWishlistTest extends AbstractWishlistTest // Steps: $this->addToCart($product); $assertAddedProductToCartSuccessMessage->processAssert($checkoutCart, $product); + $checkoutCart->open(); $checkoutCart->getCartBlock()->getCartItem($product)->moveToWishlist(); return ['product' => $product]; diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php index 881161d8d5166908db9177091e868654fd858895..47ffc259d718d459b218cdd4e7ab3988dc24135b 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php @@ -165,7 +165,9 @@ class ShareWishlistEntityTest extends Injectable $this->loginCustomer($customer); $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html'); $this->catalogProductView->getViewBlock()->clickAddToWishlist(); + $this->wishlistIndex->getMessagesBlock()->waitSuccessMessage(); $this->wishlistIndex->getWishlistBlock()->clickShareWishList(); + $this->cmsIndex->getCmsPageBlock()->waitPageInit(); $this->wishlistShare->getSharingInfoForm()->fillForm($sharingInfo); $this->wishlistShare->getSharingInfoForm()->shareWishlist(); } diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml index ee8bb1239977960850da8c7052eb45f461fbe6b1..1282b05826c506eb02f838064efd98658cebe579 100644 --- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ViewProductInCustomerWishlistOnBackendTest.xml @@ -16,10 +16,12 @@ <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCustomerWishlistOnBackendGrid"/> </variation> <variation name="ViewProductInCustomerWishlistOnBackendTestVariation3" firstConstraint="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid" method="test"> + <data name="issue" xsi:type="string">Bug: MAGETWO-33952</data> <data name="product" xsi:type="string">bundleProduct::bundle_dynamic_product</data> <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductInCustomerWishlistOnBackendGrid"/> </variation> <variation name="ViewProductInCustomerWishlistOnBackendTestVariation4" firstConstraint="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid" method="test"> + <data name="issue" xsi:type="string">Bug: MAGETWO-34633</data> <data name="product" xsi:type="string">downloadableProduct::with_two_separately_links</data> <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductInCustomerWishlistOnBackendGrid"/> </variation> diff --git a/dev/tests/integration/etc/install-config-mysql.php.dist b/dev/tests/integration/etc/install-config-mysql.php.dist index 391e1a7679b00c152b165b379be8bd5d9ea508bb..0f5adb4727c5fecff8c195f6c70d25fb7b0cee0a 100644 --- a/dev/tests/integration/etc/install-config-mysql.php.dist +++ b/dev/tests/integration/etc/install-config-mysql.php.dist @@ -7,7 +7,7 @@ return [ 'db_host' => 'localhost', 'db_user' => 'root', - 'db_pass' => '', + 'db_pass' => 'root', 'db_name' => 'magento_integration_tests', 'db_prefix' => '', 'backend_frontname' => 'backend', diff --git a/dev/tests/integration/framework/Magento/TestFramework/Entity.php b/dev/tests/integration/framework/Magento/TestFramework/Entity.php index ea6ecef137d5e621039966b1b279eeb6c7fdf497..dc9793f6a05c61e6070f815f06abc31734ca66da 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Entity.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Entity.php @@ -7,7 +7,7 @@ namespace Magento\TestFramework; /** - * Class that implements CRUD tests for \Magento\Core\Model\AbstractModel based objects + * Class that implements CRUD tests for \Magento\Framework\Model\AbstractModel based objects */ class Entity { diff --git a/dev/tests/integration/framework/Magento/TestFramework/Event/Magento.php b/dev/tests/integration/framework/Magento/TestFramework/Event/Magento.php index 9c1e8f43d68f94dd150f7861383a864c5f97772a..08812d8caf3b5f758a1f447e02dbf602d8a339ad 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Event/Magento.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Event/Magento.php @@ -4,11 +4,11 @@ * See COPYING.txt for license details. */ -/** - * Observer of Magento events triggered using Magento_Core_Model_\Magento\TestFramework\EventManager::dispatch() - */ namespace Magento\TestFramework\Event; +/** + * Observer of Magento events triggered using \Magento\TestFramework\EventManager::dispatch() + */ class Magento { /** diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php index c28fdc6d7a0d92fdb9aa5c64b37cbcc3eaa8e13c..41453aa0becc0e2d32513736f2cb99ddc60e8854 100644 --- a/dev/tests/integration/framework/bootstrap.php +++ b/dev/tests/integration/framework/bootstrap.php @@ -32,7 +32,7 @@ try { $installConfigFile = $installConfigFile . '.dist'; } $sandboxUniqueId = md5(sha1_file($installConfigFile)); - $installDir = "{$testsTmpDir}/sandbox-{$sandboxUniqueId}"; + $installDir = "{$testsTmpDir}/sandbox-{$settings->get('TESTS_PARALLEL_THREAD', 0)}-{$sandboxUniqueId}"; $application = new \Magento\TestFramework\Application( $shell, $installDir, diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Cache/MassActionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Cache/MassActionTest.php index 65ec766a6c8366ae3ece6783d7b662e458fa011d..559381cbe85dfad46f6e7666d81f66f0b0ea47d8 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Cache/MassActionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Cache/MassActionTest.php @@ -6,8 +6,8 @@ namespace Magento\Backend\Controller\Adminhtml\Cache; -use Magento\TestFramework\Helper\Bootstrap; use Magento\Framework\App\Cache\Type\ConfigSegment; +use Magento\TestFramework\Helper\Bootstrap; class MassActionTest extends \Magento\Backend\Utility\Controller { @@ -32,8 +32,8 @@ class MassActionTest extends \Magento\Backend\Utility\Controller $cacheState = Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache\StateInterface'); foreach (self::$typesSegment->getData() as $type => $value) { $cacheState->setEnabled($type, $value); - $cacheState->persist(); } + $cacheState->persist(); parent::tearDown(); } @@ -48,18 +48,11 @@ class MassActionTest extends \Magento\Backend\Utility\Controller $this->getRequest()->setParams(['types' => $typesToEnable]); $this->dispatch('backend/admin/cache/massEnable'); - Bootstrap::getInstance()->reinitialize(); - - /** @var \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList */ - $cacheTypeList = Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache\TypeListInterface'); - $types = array_keys($cacheTypeList->getTypes()); - /** @var $cacheState \Magento\Framework\App\Cache\StateInterface */ - $cacheState = Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache\StateInterface'); - foreach ($types as $type) { - if (in_array($type, $typesToEnable)) { - $this->assertTrue($cacheState->isEnabled($type), "Type '{$type}' has not been enabled"); + foreach ($this->getCacheStates() as $cacheType => $cacheState) { + if (in_array($cacheType, $typesToEnable)) { + $this->assertEquals(1, $cacheState, "Type '{$cacheType}' has not been enabled"); } else { - $this->assertFalse($cacheState->isEnabled($type), "Type '{$type}' must remain disabled"); + $this->assertEquals(0, $cacheState, "Type '{$cacheType}' has not been enabled"); } } } @@ -75,22 +68,31 @@ class MassActionTest extends \Magento\Backend\Utility\Controller $this->getRequest()->setParams(['types' => $typesToDisable]); $this->dispatch('backend/admin/cache/massDisable'); - Bootstrap::getInstance()->reinitialize(); - - /** @var \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList */ - $cacheTypeList = Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache\TypeListInterface'); - $types = array_keys($cacheTypeList->getTypes()); - /** @var $cacheState \Magento\Framework\App\Cache\StateInterface */ - $cacheState = Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache\StateInterface'); - foreach ($types as $type) { - if (in_array($type, $typesToDisable)) { - $this->assertFalse($cacheState->isEnabled($type), "Type '{$type}' has not been disabled"); + foreach ($this->getCacheStates() as $cacheType => $cacheState) { + if (in_array($cacheType, $typesToDisable)) { + $this->assertEquals(0, $cacheState, "Type '{$cacheType}' has not been disabled"); } else { - $this->assertTrue($cacheState->isEnabled($type), "Type '{$type}' must remain enabled"); + $this->assertEquals(1, $cacheState, "Type '{$cacheType}' must remain enabled"); } } } + /** + * Retrieve cache states (enabled/disabled) information + * + * Access configuration file directly as it is not possible to re-include modified file under HHVM + * @link https://github.com/facebook/hhvm/issues/1447 + * + * @return array + * @SuppressWarnings(PHPMD.EvalExpression) + */ + protected function getCacheStates() + { + $configPath = Bootstrap::getInstance()->getAppTempDir() . '/etc/config.php'; + $configData = eval(str_replace('<?php', '', file_get_contents($configPath))); + return $configData['cache_types']; + } + /** * Sets all cache types to enabled or disabled state * @@ -121,7 +123,7 @@ class MassActionTest extends \Magento\Backend\Utility\Controller $cacheTypeList = Bootstrap::getObjectManager()->get('Magento\Framework\App\Cache\TypeListInterface'); $invalidatedTypes = array_keys($cacheTypeList->getInvalidated()); $failed = array_intersect($typesToRefresh, $invalidatedTypes); - $this->assertEmpty($failed, 'Could not refresh following cache types: ' . join(', ', $failed)); + $this->assertEmpty($failed, 'Could not refresh following cache types: ' . implode(', ', $failed)); } /** @@ -135,8 +137,8 @@ class MassActionTest extends \Magento\Backend\Utility\Controller [ \Magento\Framework\App\Cache\Type\Config::TYPE_IDENTIFIER, \Magento\Framework\App\Cache\Type\Layout::TYPE_IDENTIFIER, - \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER - ] + \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER, + ], ] ]; } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php index 957a68bbdbd9db4bdcc8e502f60e75bb78dab9cb..43f63adca927c677227634203b5602c16eb19034 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Type/SelectTest.php @@ -22,7 +22,7 @@ class SelectTest extends \PHPUnit_Framework_TestCase 'select' ); $html = $block->getPriceTypeSelectHtml(); - $this->assertContains('select_<%= data.select_id %>', $html); - $this->assertContains('[<%= data.select_id %>]', $html); + $this->assertContains('select_<%- data.select_id %>', $html); + $this->assertContains('[<%- data.select_id %>]', $html); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php index 2d221e570a8ed1f34e7076f87ea95ea5ec637d33..75f5172727328e6cdc75008889dc68730568331e 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php @@ -11,7 +11,7 @@ namespace Magento\Catalog\Controller\Adminhtml; class CategoryTest extends \Magento\Backend\Utility\Controller { /** - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * @magentoDbIsolation enabled * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1 * @dataProvider saveActionDataProvider diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php index ca4fae8a6d121000d15c127353a47c89eb3d8c30..1af4fd36b8f494e3005f00b50ed0609d290c5e55 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/NewActionTest.php @@ -22,17 +22,14 @@ class NewActionTest extends \Magento\Backend\Utility\Controller */ public function testCustomerGroupArePresentInGroupPriceTemplate() { - $this->dispatch('backend/catalog/product/new/set/' - . \Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID - . '/type/' . \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE - ); + $this->dispatch('backend/catalog/product/new/set/4/type/' . \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE); $lines = explode(PHP_EOL, $this->getResponse()->getBody()); foreach ($lines as $index => $line) { - if ($line && strpos($line, 'name="product[group_price][<%= data.index %>][cust_group]"') !== false) { + if ($line && strpos($line, 'name="product[group_price][<%- data.index %>][cust_group]"') !== false) { break; } } - $this->assertContains('name="product[group_price][<%= data.index %>][cust_group]"', $lines[$index]); + $this->assertContains('name="product[group_price][<%- data.index %>][cust_group]"', $lines[$index]); $this->assertContains('<option value="0">NOT LOGGED IN</option>', $lines[$index + 1]); $this->assertContains('<option value="1">General</option>', $lines[$index + 2]); $this->assertContains('<option value="2">Wholesale</option>', $lines[$index + 3]); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php index 640c2c286a300a133a6e30322828d504a7ef6c8a..6be24179208de756406648fd6107c19d68720e3a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/ProductTest.php @@ -9,8 +9,19 @@ */ namespace Magento\Catalog\Controller; +/** + * @magentoAppIsolation enabled + */ class ProductTest extends \Magento\TestFramework\TestCase\AbstractController { + protected function setUp() + { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('Randomly fails due to known HHVM bug (DOMText mixed with DOMElement)'); + } + parent::setUp(); + } + public function assert404NotFound() { parent::assert404NotFound(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractModel/Stub.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractModel/Stub.php new file mode 100644 index 0000000000000000000000000000000000000000..ced9dd4c1ea77bb044f74242c28323cec1643212 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractModel/Stub.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Catalog\Model\AbstractModel; + +abstract class Stub extends \Magento\Catalog\Model\AbstractModel implements \Magento\Catalog\Api\Data\ProductInterface +{ + /** + * Retrieve Store Id + * + * @return int + */ + public function getStoreId() + { + return $this->getData(self::STORE_ID); + } + + /** + * Set product store id + * + * @param int $storeId + * @return $this + */ + public function setStoreId($storeId) + { + return $this->setData(self::STORE_ID, $storeId); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php index b45e05df43559ce9e92d08809fc1995cda7397cf..026e4f09722cc31c062dca66bef7e01c1a063a23 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/AbstractTest.php @@ -27,7 +27,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase protected function setUp() { if (!self::$_isStubClass) { - $this->getMockForAbstractClass('Magento\Catalog\Model\AbstractModel', [], self::STUB_CLASS, false); + $this->getMockForAbstractClass('Magento\Catalog\Model\AbstractModel\Stub', [], self::STUB_CLASS, false); self::$_isStubClass = true; } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php index 72a723413d214a205e9004f35185f0861dbc488d..2eb662d331ffc0a1e6717690ed3a55dc1a5f152b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTest.php @@ -115,7 +115,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase } /** - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * @magentoAppIsolation enabled * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1 */ diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php index 16bc2ff9e719257d271223d7e1f825057ac3fe71..2eb856f8f8236f39b824ec3f329afc62101c2b62 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php @@ -88,7 +88,7 @@ class ProcessorTest extends \Magento\TestFramework\Indexer\TestCase * @magentoDbIsolation enabled * @magentoAppIsolation enabled * @magentoAppArea adminhtml - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * @magentoConfigFixture current_store catalog/frontend/flat_catalog_product 1 */ public function testAddNewStore() diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php index 7569dd3be71a0777011c129dbac3e0b190728c51..d39b040df295d85c733c3a86613ac5860b33da06 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php @@ -25,10 +25,21 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase */ protected $httpFactoryMock; + /** @var int */ + protected $maxFileSizeInMb; + + /** @var int */ + protected $maxFileSize; + protected function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->httpFactoryMock = $this->getMock('Magento\Framework\HTTP\Adapter\FileTransferFactory', ['create']); + /** @var \Magento\Framework\File\Size $fileSize */ + $fileSize = $this->objectManager->create('Magento\Framework\File\Size'); + $this->maxFileSize = $fileSize->getMaxFileSize(); + $this->maxFileSizeInMb = $fileSize->getMaxFileSizeInMb(); + $this->model = $this->objectManager->create( 'Magento\Catalog\Model\Product\Option\Type\File\ValidatorFile', [ @@ -53,14 +64,16 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Framework\Exception\File\LargeSizeException - * @expectedExceptionMessage The file you uploaded is larger than 2 Megabytes allowed by server * @return void */ public function testLargeSizeException() { + $this->setExpectedException( + '\Magento\Framework\Exception\File\LargeSizeException', + sprintf('The file you uploaded is larger than %s Megabytes allowed by server', $this->maxFileSizeInMb) + ); $this->prepareEnv(); - $_SERVER['CONTENT_LENGTH'] = 2097153; + $_SERVER['CONTENT_LENGTH'] = $this->maxFileSize + 1; $httpAdapterMock = $this->getMock('Zend_File_Transfer_Adapter_Http', ['getFileInfo']); $exception = function () { throw new \Exception(); @@ -122,7 +135,10 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "Maximum allowed image size for 'MediaOption' is 2000x2000 px.\n" - . "The file 'test.jpg' you uploaded is larger than the 2 megabytes allowed by our server." + . sprintf( + "The file 'test.jpg' you uploaded is larger than the %s megabytes allowed by our server.", + $this->maxFileSizeInMb + ) ); $this->prepareEnv(); $httpAdapterMock = $this->getMock('Zend_File_Transfer_Adapter_Http', ['isValid', 'getErrors']); @@ -201,7 +217,7 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase */ protected function prepareEnv() { - $file = 'magento_small_image.jpg'; + $file = 'magento_small_image.jpg'; /** @var \Magento\Framework\Filesystem $filesystem */ $filesystem = $this->objectManager->get('Magento\Framework\Filesystem'); @@ -215,7 +231,6 @@ class ValidatorFileTest extends \PHPUnit_Framework_TestCase 'error' => 0, 'size' => 12500, ]; - $_SERVER['CONTENT_LENGTH'] = 2097152; } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php index 101e0456b84b53e427f44b7d301908fdd1d4cbb6..d0a5bdb5bdf034ed408ef27de589cc31626d10ea 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php @@ -20,6 +20,9 @@ class ValidatorInfoTest extends \PHPUnit_Framework_TestCase */ protected $objectManager; + /** @var int */ + protected $maxFileSizeInMb; + /** * @var \Magento\Catalog\Model\Product\Option\Type\File\ValidateFactory|\PHPUnit_Framework_MockObject_MockObject */ @@ -28,6 +31,10 @@ class ValidatorInfoTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Framework\File\Size $fileSize */ + $fileSize = $this->objectManager->create('Magento\Framework\File\Size'); + $this->maxFileSizeInMb = $fileSize->getMaxFileSizeInMb(); + $this->validateFactoryMock = $this->getMock( 'Magento\Catalog\Model\Product\Option\Type\File\ValidateFactory', ['create'] @@ -50,7 +57,10 @@ class ValidatorInfoTest extends \PHPUnit_Framework_TestCase "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "The file 'test.jpg' for 'MediaOption' has an invalid extension.\n" . "Maximum allowed image size for 'MediaOption' is 2000x2000 px.\n" - . "The file 'test.jpg' you uploaded is larger than the 2 megabytes allowed by our server." + . sprintf( + "The file 'test.jpg' you uploaded is larger than the %s megabytes allowed by our server.", + $this->maxFileSizeInMb + ) ); $validateMock = $this->getMock('Zend_Validate', ['isValid', 'getErrors']); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_multistore.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_multistore.php index 4f9c3e4c3fecf059e19661ee158d1e36a8da5979..133bc16660b5d139f225a735d1503bc3a9318ce0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_multistore.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_multistore.php @@ -3,7 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -require __DIR__ . '/../../Core/_files/store.php'; +require __DIR__ . '/../../Store/_files/core_fixturestore.php'; $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var Magento\Store\Model\Store $store */ diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 1563fc9e8d6ea3b382a1bd7bffbdb622359f199a..d3e665a753e5b1e401de8675209dbd64650b49d8 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -322,7 +322,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase $this->_model->importData(); - reset($source); + $source->rewind(); foreach ($source as $row) { /** @var $productAfterImport \Magento\Catalog\Model\Product */ $productBeforeImport = $productsBeforeImport[$row['sku']]; @@ -779,7 +779,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase /** * @magentoDataFixture Magento/Catalog/_files/categories.php - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * @magentoDataFixture Magento/Catalog/Model/Layer/Filter/_files/attribute_with_option.php * @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php * @magentoAppIsolation enabled diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index 9b3387532ab4dc6a1d31a59c03aa62fe4b1413b0..c3f988bad63fce6660fa13c90fbfc605e73911df 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -25,9 +25,17 @@ class CategoryUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); } + public function tearDown() + { + $category = $this->objectManager->create('Magento\Catalog\Model\Category'); + $category->load(3); + $category->delete(); + } + /** * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php * @magentoDbIsolation enabled + * @magentoAppIsolation enabled */ public function testGenerateUrlRewritesWithoutSaveHistory() { @@ -53,9 +61,9 @@ class CategoryUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase } /** - * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php * @magentoDbIsolation enabled - * + * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php + * @magentoAppIsolation enabled */ public function testGenerateUrlRewritesWithSaveHistory() { @@ -101,7 +109,7 @@ class CategoryUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase $actualResults[] = [ $url->getRequestPath(), $url->getTargetPath(), - $url->getIsAutogenerated(), + (int)$url->getIsAutogenerated(), $url->getRedirectType() ]; } @@ -114,8 +122,12 @@ class CategoryUrlRewriteGeneratorTest extends \PHPUnit_Framework_TestCase */ protected function assertResults($expected, $actual) { - foreach ($actual as $row) { - $this->assertContains($row, $expected, implode(', ', $row)); + foreach ($expected as $row) { + $this->assertContains( + $row, + $actual, + 'Expected: ' . var_export($row, true) . "\nIn Actual: " . var_export($actual, true) + ); } } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php index 017943a3a4fc5d6348415577a6139bc26d6c561e..42524e3ea0ed5ceb5cdcef04bc51b2ed3e308b31 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php @@ -6,6 +6,7 @@ namespace Magento\Checkout\Block\Cart\Item; /** + * @magentoDbIsolation enabled * @magentoDataFixture Magento/Checkout/_files/quote_with_simple_product_and_image.php */ class RendererTest extends \PHPUnit_Framework_TestCase diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php index 85d670d1caea880f8158b3145df8786e4c013ccc..5632555d4bec588f7650bb837bd0b1a40eaf7750 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Controller/CartTest.php @@ -9,6 +9,9 @@ */ namespace Magento\Checkout\Controller; +/** + * @magentoDbIsolation enabled + */ class CartTest extends \Magento\TestFramework\TestCase\AbstractController { /** diff --git a/dev/tests/integration/testsuite/Magento/Core/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Core/Controller/IndexTest.php deleted file mode 100644 index 0332a70a8d6024f88bf5cd55fdb735ad5ee8b07e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Controller/IndexTest.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Core\Controller; - -class IndexTest extends \Magento\TestFramework\TestCase\AbstractController -{ - public function testNotFoundAction() - { - $this->dispatch('core/index/notFound'); - $this->assertEquals('404', $this->getResponse()->getHttpResponseCode()); - $this->assertEquals('Requested resource not found', $this->getResponse()->getBody()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/a_d/file b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/a_d/file deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/b_e/file b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/b_e/file deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/magento_default/file b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/magento_default/file deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/magento_g/file b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/Source/_files/design/frontend/magento_g/file deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_AU.csv b/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_AU.csv deleted file mode 100644 index 0d502c76477f11d34f4b2bfb33c1ca0989fee185..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_AU.csv +++ /dev/null @@ -1 +0,0 @@ -"Original value for Magento_Core module","Translated value for Magento_Core module in en_AU" diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/config_cache.php b/dev/tests/integration/testsuite/Magento/Core/_files/config_cache.php deleted file mode 100644 index 6a4289fe4ea26e07297dd3a64abf32215d1f0c50..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/_files/config_cache.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -/** @var \Magento\Framework\App\Cache\Type\Config $layoutCache */ -$layoutCache = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Framework\App\Cache\Type\Config'); -$layoutCache->save('fixture config cache data', 'CONFIG_CACHE_FIXTURE'); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/etc/config.xml b/dev/tests/integration/testsuite/Magento/Core/_files/etc/config.xml deleted file mode 100644 index ef1e23d46c54ee613613a0ce4a2f42f19d79280a..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/_files/etc/config.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../app/code/Magento/Core/etc/config.xsd"> - <default> - <areas> - <test_area1> - <areaNode>value</areaNode> - </test_area1> - <test_area2> - </test_area2> - <test_area3> - </test_area3> - </areas> - </default> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/etc/module.xml b/dev/tests/integration/testsuite/Magento/Core/_files/etc/module.xml deleted file mode 100644 index 746181c42b2bae0f4888a87fad1eabcce954bc33..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/_files/etc/module.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> - <module name="Magento_Core" setup_version="1.6.0.2" /> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/fixture.csv b/dev/tests/integration/testsuite/Magento/Core/_files/fixture.csv deleted file mode 100644 index 297c90f5e6ec9735cd6c518b6e65ba61cf38f11e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/_files/fixture.csv +++ /dev/null @@ -1,3 +0,0 @@ -"Search:","Fixture search:" -"Search entire store here...","Fixture search entire store here..." -"Fixture string","Fixture translation" diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php index 0fdb5939928cfe40230052e9d3ce483166a1417d..7c5c490fc594672a29274872150bc4d22a76fee6 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php @@ -590,7 +590,11 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase ] ); $customerEntity = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray($customerEntity, $customerData); + $this->dataObjectHelper->populateWithArray( + $customerEntity, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $customerAfter = $this->accountManagement->createAccount($customerEntity, 'aPassword'); $this->assertGreaterThan(0, $customerAfter->getId()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php index 9f77693988cab1d85a44186e2c696778e759951c..1b9ad064466529226a1751f4a7c359931f6a1abd 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AddressMetadataTest.php @@ -31,18 +31,7 @@ class AddressMetadataTest extends \PHPUnit_Framework_TestCase public function testGetCustomAttributesMetadata() { $customAttributesMetadata = $this->_service->getCustomAttributesMetadata(); - $this->assertCount(2, $customAttributesMetadata, "Invalid number of attributes returned."); - $configAttributeCode = 'address_attribute_1'; - $configAttributeFound = false; - foreach ($customAttributesMetadata as $attribute) { - if ($attribute->getAttributeCode() == $configAttributeCode) { - $configAttributeFound = true; - break; - } - } - if (!$configAttributeFound) { - $this->fail("Custom attribute declared in the config not found."); - } + $this->assertCount(0, $customAttributesMetadata, "Invalid number of attributes returned."); } /** @@ -69,7 +58,7 @@ class AddressMetadataTest extends \PHPUnit_Framework_TestCase if (!$customAttributesFound) { $this->fail("Custom attributes declared in the config not found."); } - $this->assertCount(4, $customAttributesMetadata, "Invalid number of attributes returned."); + $this->assertCount(2, $customAttributesMetadata, "Invalid number of attributes returned."); } public function testGetAddressAttributeMetadata() diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php index 67243448374f24d8e3348638fd95eee4c1ccc724..7ec75e92d513795c73eaa286704bf3da208b707d 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Config/ShareTest.php @@ -23,7 +23,7 @@ class ShareTest extends \PHPUnit_Framework_TestCase } /** - * @magentoDataFixture Magento/Core/_files/second_third_store.php + * @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php * @magentoConfigFixture current_store customer/account_share/scope 0 */ public function testGetSharedWebsiteIdsMultipleSites() diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php index b18d1c2b598e8dce4af38fdbbe87ece1a0a9517b..672e0e17c6cc424819ec36046829e9e193e58fa7 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/CustomerMetadataTest.php @@ -47,18 +47,7 @@ class CustomerMetadataTest extends \PHPUnit_Framework_TestCase public function testGetCustomAttributesMetadata() { $customAttributesMetadata = $this->_service->getCustomAttributesMetadata(); - $this->assertCount(3, $customAttributesMetadata, "Invalid number of attributes returned."); - $configAttributeCode = 'customer_attribute_1'; - $configAttributeFound = false; - foreach ($customAttributesMetadata as $attribute) { - if ($attribute->getAttributeCode() == $configAttributeCode) { - $configAttributeFound = true; - break; - } - } - if (!$configAttributeFound) { - $this->fail("Custom attribute declared in the config not found."); - } + $this->assertCount(1, $customAttributesMetadata, "Invalid number of attributes returned."); } public function testGetNestedOptionsCustomAttributesMetadata() @@ -104,7 +93,7 @@ class CustomerMetadataTest extends \PHPUnit_Framework_TestCase if (!$customAttributesFound) { $this->fail("Custom attributes declared in the config not found."); } - $this->assertCount(5, $customAttributesMetadata, "Invalid number of attributes returned."); + $this->assertCount(3, $customAttributesMetadata, "Invalid number of attributes returned."); } /** diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php index e08486410020a74ff23d708edb92749e552a36e7..59c904036a712bf1d360c58a82ebb929fe5498d4 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/GroupManagementTest.php @@ -42,10 +42,10 @@ class GroupManagementTest extends \PHPUnit_Framework_TestCase } /** - * @magentoDataFixture Magento/Core/_files/second_third_store.php + * @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php */ public function testGetDefaultGroupWithNonDefaultStoreId() - { + { /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */ $storeManager = Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface'); $nonDefaultStore = $storeManager->getStore('secondstore'); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/CustomerRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/CustomerRepositoryTest.php index 92fc0f516f8e8c2633794d206460226a72c6b355..da8f3084e644a6c34069c4259209b65bd32cf311 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/CustomerRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/CustomerRepositoryTest.php @@ -146,7 +146,11 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase 'default_shipping' => $defaultShipping ]); $customerDetails = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray($customerDetails, $customerData); + $this->dataObjectHelper->populateWithArray( + $customerDetails, + $customerData, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $this->customerRepository->save($customerDetails); $customerAfter = $this->customerRepository->getById($existingCustomerId); $this->assertEquals($email, $customerAfter->getEmail()); @@ -208,10 +212,18 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase $addressId = $addresses[0]->getId(); $newAddress = array_merge($addresses[0]->__toArray(), ['city' => $city]); $newAddressDataObject = $this->addressFactory->create(); - $this->dataObjectHelper->populateWithArray($newAddressDataObject, $newAddress); + $this->dataObjectHelper->populateWithArray( + $newAddressDataObject, + $newAddress, + '\Magento\Customer\Api\Data\AddressInterface' + ); $newAddressDataObject->setRegion($addresses[0]->getRegion()); $newCustomerEntity = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray($newCustomerEntity, $customerDetails); + $this->dataObjectHelper->populateWithArray( + $newCustomerEntity, + $customerDetails, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $newCustomerEntity->setId($customerId) ->setAddresses([$newAddressDataObject, $addresses[1]]); $this->customerRepository->save($newCustomerEntity); @@ -236,7 +248,11 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase $customer = $this->customerRepository->getById($customerId); $customerDetails = $customer->__toArray(); $newCustomerEntity = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray($newCustomerEntity, $customerDetails); + $this->dataObjectHelper->populateWithArray( + $newCustomerEntity, + $customerDetails, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $newCustomerEntity->setId($customer->getId()) ->setAddresses(null); $this->customerRepository->save($newCustomerEntity); @@ -257,7 +273,11 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase $customer = $this->customerRepository->getById($customerId); $customerDetails = $customer->__toArray(); $newCustomerEntity = $this->customerFactory->create(); - $this->dataObjectHelper->populateWithArray($newCustomerEntity, $customerDetails); + $this->dataObjectHelper->populateWithArray( + $newCustomerEntity, + $customerDetails, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $newCustomerEntity->setId($customer->getId()) ->setAddresses([]); $this->customerRepository->save($newCustomerEntity); @@ -279,9 +299,9 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase */ public function testSearchCustomers($filters, $filterGroup, $expectedResult) { - /** @var \Magento\Framework\Api\SearchCriteriaDataBuilder $searchBuilder */ + /** @var \Magento\Framework\Api\SearchCriteriBuilder $searchBuilder */ $searchBuilder = Bootstrap::getObjectManager() - ->create('Magento\Framework\Api\SearchCriteriaDataBuilder'); + ->create('Magento\Framework\Api\SearchCriteriaBuilder'); foreach ($filters as $filter) { $searchBuilder->addFilter([$filter]); } @@ -308,9 +328,9 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase */ public function testSearchCustomersOrder() { - /** @var \Magento\Framework\Api\SearchCriteriaDataBuilder $searchBuilder */ + /** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchBuilder */ $objectManager = Bootstrap::getObjectManager(); - $searchBuilder = $objectManager->create('Magento\Framework\Api\SearchCriteriaDataBuilder'); + $searchBuilder = $objectManager->create('Magento\Framework\Api\SearchCriteriaBuilder'); // Filter for 'firstname' like 'First' $filterBuilder = $objectManager->create('Magento\Framework\Api\FilterBuilder'); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/GroupRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/GroupRepositoryTest.php index c9971f4b1f581d61ed1094d17ea75726fc75c172..e6b402a6c7e80df1611c57033d69cb20e6ce53fa 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/GroupRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Resource/GroupRepositoryTest.php @@ -25,7 +25,7 @@ class GroupRepositoryTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Customer\Model\Data\GroupInterfaceFactory */ private $groupFactory; - /** @var \Magento\Framework\Api\SearchCriteriaDataBuilder */ + /** @var \Magento\Framework\Api\SearchCriteriaBuilder */ private $searchCriteriaBuilder; protected function setUp() @@ -33,7 +33,7 @@ class GroupRepositoryTest extends \PHPUnit_Framework_TestCase $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->groupRepository = $this->objectManager->create('Magento\Customer\Api\GroupRepositoryInterface'); $this->groupFactory = $this->objectManager->create('Magento\Customer\Api\Data\GroupInterfaceFactory'); - $this->searchCriteriaBuilder = $this->objectManager->create('Magento\Framework\Api\SearchCriteriaDataBuilder'); + $this->searchCriteriaBuilder = $this->objectManager->create('Magento\Framework\Api\SearchCriteriaBuilder'); } /** diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php index e8bb754254ebeb39ae1329af1c612e69228d99c2..59747a3c427887b59895b20f16e07ce4f9fedc80 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/VisitorTest.php @@ -63,18 +63,22 @@ class VisitorTest extends \PHPUnit_Framework_TestCase */ public function testClean() { + $customerIdNow = 1; $lastVisitNow = date('Y-m-d H:i:s', time()); $sessionIdNow = 'asaswljxvgklasdflkjasieasd'; + $customerIdPast = null; $lastVisitPast = date('Y-m-d H:i:s', time() - 172800); $sessionIdPast = 'kui0aa57nqddl8vk7k6ohgi352'; /** @var \Magento\Customer\Model\Visitor $visitor */ $visitor = Bootstrap::getObjectManager()->get('Magento\Customer\Model\Visitor'); + $visitor->setCustomerId($customerIdPast); $visitor->setSessionId($sessionIdPast); $visitor->setLastVisitAt($lastVisitPast); $visitor->save(); $visitorIdPast = $visitor->getId(); $visitor->unsetData(); + $visitor->setCustomerId($customerIdNow); $visitor->setSessionId($sessionIdNow); $visitor->setLastVisitAt($lastVisitNow); $visitor->save(); @@ -87,7 +91,12 @@ class VisitorTest extends \PHPUnit_Framework_TestCase $visitor->unsetData(); $visitor->load($visitorIdNow); $this->assertEquals( - ['visitor_id' => $visitorIdNow, 'session_id' => $sessionIdNow, 'last_visit_at' => $lastVisitNow], + [ + 'visitor_id' => $visitorIdNow, + 'customer_id' => $customerIdNow, + 'session_id' => $sessionIdNow, + 'last_visit_at' => $lastVisitNow + ], $visitor->getData() ); } 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 eeea37be4c2828f7c2aacda436d1697a9751faa3..06746a974e5b04da732eedcb072fd66dc8b0adbc 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -176,7 +176,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase ], 'custom parameter' => [ 'frontend', - 'handle="email_template_test_handle" template="Magento_Core::sample_email_content_custom.phtml"', + 'handle="email_template_test_handle" template="Magento_Email::sample_email_content_custom.phtml"', 'Custom E-mail content for frontend/test_default theme', ], ]; diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index 5ffaed0005fadfe797d43b1753b32e13c1c35903..72cbb8f071d6f7b0a8cdd2574bc3ccb6005eabe1 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -89,7 +89,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase /** * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testGetProcessedTemplate() { @@ -137,7 +137,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase /** * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testGetProcessedTemplateSubject() { @@ -185,7 +185,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testSetDesignConfigException($config) { - // \Magento\Core\Model\Template is an abstract class + // \Magento\Email\Model\Template is an abstract class $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Email\Model\Template'); $model->setDesignConfig($config); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Core/layout/email_template_test_handle.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Email/layout/email_template_test_handle.xml similarity index 79% rename from dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Core/layout/email_template_test_handle.xml rename to dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Email/layout/email_template_test_handle.xml index 0fb1b826f9e7e6f6369fba3fd85313338ba42448..43ce29cbfa0a414e784d2c2d87f5188578038443 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Core/layout/email_template_test_handle.xml +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Email/layout/email_template_test_handle.xml @@ -6,5 +6,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > - <block class="Magento\Backend\Block\Template" name="sample_email_content" template="Magento_Core::sample_email_content.phtml"/> + <block class="Magento\Backend\Block\Template" name="sample_email_content" template="Magento_Email::sample_email_content.phtml"/> </layout> diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Core/templates/sample_email_content.phtml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Email/templates/sample_email_content.phtml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Core/templates/sample_email_content.phtml rename to dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/test_default/Magento_Email/templates/sample_email_content.phtml diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Core/layout/email_template_test_handle.xml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Email/layout/email_template_test_handle.xml similarity index 87% rename from dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Core/layout/email_template_test_handle.xml rename to dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Email/layout/email_template_test_handle.xml index 359f9c07e07ccfb6ac794116afa1fe4aee781c90..767644707ff84fe0b5c19561a8bc28e2f0e02aaa 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Core/layout/email_template_test_handle.xml +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Email/layout/email_template_test_handle.xml @@ -6,7 +6,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > - <block class="Magento\Framework\View\Element\Template" name="sample_email_content" template="Magento_Core::sample_email_content.phtml"/> + <block class="Magento\Framework\View\Element\Template" name="sample_email_content" template="Magento_Email::sample_email_content.phtml"/> <block class="Magento\Framework\View\Element\Text" name="ignored_email_content"> <action method="setText"> <argument name="text" xsi:type="string">Ignored e-mail content, only the first block is used</argument> diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Core/templates/sample_email_content.phtml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Email/templates/sample_email_content.phtml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Core/templates/sample_email_content.phtml rename to dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Email/templates/sample_email_content.phtml diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Core/templates/sample_email_content_custom.phtml b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Email/templates/sample_email_content_custom.phtml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Core/templates/sample_email_content_custom.phtml rename to dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/test_default/Magento_Email/templates/sample_email_content_custom.phtml diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/AbstractExtensibleObjectTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/AbstractExtensibleObjectTest.php new file mode 100644 index 0000000000000000000000000000000000000000..dd5fba5c4d60d9740bd931dffe0d5e208a883fa2 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/AbstractExtensibleObjectTest.php @@ -0,0 +1,92 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Api; + +/** + * Test for \Magento\Framework\Api\AbstractExtensibleObject + */ +class AbstractExtensibleObjectTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Framework\ObjectManagerInterface */ + private $_objectManager; + + protected function setUp() + { + $autoloadWrapper = \Magento\Framework\Autoload\AutoloaderRegistry::getAutoloader(); + $autoloadWrapper->addPsr4('Magento\\Wonderland\\', realpath(__DIR__ . '/_files/Magento/Wonderland')); + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_objectManager->configure( + [ + 'preferences' => [ + 'Magento\Wonderland\Api\Data\FakeAddressInterface' => 'Magento\Wonderland\Model\FakeAddress', + 'Magento\Wonderland\Api\Data\FakeRegionInterface' => 'Magento\Wonderland\Model\FakeRegion', + ], + ] + ); + } + + /** + * Test setExtensionAttributes and getExtensionAttributes for \Magento\Framework\Api\AbstractExtensibleObject + * + * @param array $expectedDataBefore + * @param array $expectedDataAfter + * @dataProvider extensionAttributesDataProvider + */ + public function testExtensionAttributes($expectedDataBefore, $expectedDataAfter) + { + /** @var \Magento\Framework\Api\ExtensionAttributesFactory $regionExtensionFactory */ + $regionExtensionFactory = $this->_objectManager->get('Magento\Framework\Api\ExtensionAttributesFactory'); + /** @var \Magento\Wonderland\Model\Data\FakeRegionFactory $regionFactory */ + $regionFactory = $this->_objectManager->get('Magento\Wonderland\Model\Data\FakeRegionFactory'); + + /** @var \Magento\Wonderland\Model\Data\FakeRegion $region */ + $region = $regionFactory->create(); + + $regionCode = 'test_code'; + /** @var \Magento\Wonderland\Model\Data\FakeRegionExtensionInterface $regionExtension */ + $regionExtension = $regionExtensionFactory->create( + 'Magento\Wonderland\Model\Data\FakeRegion', + ['data' => $expectedDataBefore] + ); + $region->setRegionCode($regionCode)->setExtensionAttributes($regionExtension); + $this->assertInstanceOf('Magento\Wonderland\Model\Data\FakeRegion', $region); + + $extensionAttributes = $region->getExtensionAttributes(); + $this->assertInstanceOf('Magento\Wonderland\Api\Data\FakeRegionExtension', $extensionAttributes); + $this->assertEquals($expectedDataBefore, $extensionAttributes->__toArray()); + $this->assertEquals($regionCode, $region->getRegionCode()); + + $regionCode = 'changed_test_code'; + $region->setExtensionAttributes( + $regionExtensionFactory->create('Magento\Wonderland\Model\Data\FakeRegion', ['data' => $expectedDataAfter]) + )->setRegionCode($regionCode); // change $regionCode to test AbstractExtensibleObject::setData + $extensionAttributes = $region->getExtensionAttributes(); + $this->assertEquals($expectedDataAfter, $extensionAttributes->__toArray()); + $this->assertEquals($regionCode, $region->getRegionCode()); + } + + public function extensionAttributesDataProvider() + { + return [ + 'boolean' => [ + [true], + [false] + ], + 'integer' => [ + [1], + [2] + ], + 'string' => [ + ['test'], + ['test test'] + ], + 'array' => [ + [[1]], + [[1, 2]] + ] + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php deleted file mode 100644 index 3f164c9d5312577ca04f70532db1c2d2b787a4e8..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php +++ /dev/null @@ -1,160 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Api\Code\Generator; - -use Magento\Wonderland\Api\Data\FakeAddressInterface; -use Magento\Wonderland\Api\Data\FakeRegionInterface; -use Magento\Wonderland\Model\Data\FakeAddress; -use Magento\Wonderland\Model\Data\FakeRegion; - -class DataBuilderTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Framework\ObjectManagerInterface */ - private $_objectManager; - - protected function setUp() - { - $autoloadWrapper = \Magento\Framework\Autoload\AutoloaderRegistry::getAutoloader(); - $autoloadWrapper->addPsr4('Magento\\Wonderland\\', realpath(__DIR__ . '/../../_files/Magento/Wonderland')); - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_objectManager->configure( - [ - 'preferences' => [ - 'Magento\Wonderland\Api\Data\FakeAddressInterface' => 'Magento\Wonderland\Model\FakeAddress', - 'Magento\Wonderland\Api\Data\FakeRegionInterface' => 'Magento\Wonderland\Model\FakeRegion', - ], - ] - ); - } - - /** - * @dataProvider getBuildersToTest - */ - public function testBuilders($builderType) - { - $builder = $this->_objectManager->create($builderType); - $this->assertInstanceOf($builderType, $builder); - } - - public function getBuildersToTest() - { - return [ - ['Magento\Catalog\Api\Data\ProductDataBuilder'], - ]; - } - - public function testDataObjectBuilder() - { - $regionBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeRegionBuilder'); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegionBuilder', $regionBuilder); - $region = $regionBuilder->setRegion('test') - ->setRegionCode('test_code') - ->setRegionId('test_id') - ->create(); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $region); - $this->assertEquals('test', $region->getRegion()); - } - - public function testDataObjectPopulateWithArray() - { - $data = $this->getAddressArray(); - - /** @var \Magento\Wonderland\Model\Data\FakeAddressBuilder $addressBuilder */ - $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeAddressBuilder'); - /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */ - $address = $addressBuilder->populateWithArray($data) - ->create(); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeAddress', $address); - $this->assertEquals('Johnes', $address->getLastname()); - $this->assertNull($address->getCustomAttribute('test')); - $this->assertEmpty($address->getCustomAttributes()); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegion()); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[0]); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[1]); - } - - public function testDataObjectPopulate() - { - $data = $this->getAddressArray(); - - /** @var \Magento\Wonderland\Model\Data\FakeAddressBuilder $addressBuilder */ - $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeAddressBuilder'); - /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */ - $address = $addressBuilder->populateWithArray($data) - ->create(); - - $addressUpdated = $addressBuilder->populate($address) - ->setCompany('RocketScience') - ->create(); - - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeAddress', $addressUpdated); - $this->assertEquals('RocketScience', $addressUpdated->getCompany()); - - $this->assertEmpty($address->getCustomAttributes()); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegion()); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[0]); - $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[1]); - } - - public function testModelPopulateWithArray() - { - $data = $this->getAddressArray(); - - /** @var \Magento\Wonderland\Api\Data\FakeAddressDataBuilder $addressBuilder */ - $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Api\Data\FakeAddressDataBuilder'); - /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */ - $address = $addressBuilder->populateWithArray($data) - ->create(); - $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeAddressInterface', $address); - $this->assertEquals('Johnes', $address->getLastname()); - $this->assertEquals(true, $address->isDefaultShipping()); - $this->assertEquals(false, $address->isDefaultBilling()); - $this->assertNull($address->getCustomAttribute('test')); - $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegion()); - $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[0]); - $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[1]); - } - - public function getAddressArray() - { - return [ - FakeAddressInterface::ID => 1, - FakeAddressInterface::CITY => 'Kiev', - FakeAddressInterface::REGION => [ - FakeRegionInterface::REGION => 'US', - FakeRegionInterface::REGION_CODE => 'TX', - FakeRegionInterface::REGION_ID => '1', - ], - FakeAddressInterface::REGIONS => [ - [ - FakeRegionInterface::REGION => 'US', - FakeRegionInterface::REGION_CODE => 'TX', - FakeRegionInterface::REGION_ID => '1', - ], [ - FakeRegionInterface::REGION => 'US', - FakeRegionInterface::REGION_CODE => 'TX', - FakeRegionInterface::REGION_ID => '2', - ], - ], - FakeAddressInterface::COMPANY => 'Magento', - FakeAddressInterface::COUNTRY_ID => 'US', - FakeAddressInterface::CUSTOMER_ID => '1', - FakeAddressInterface::FAX => '222', - FakeAddressInterface::FIRSTNAME => 'John', - FakeAddressInterface::MIDDLENAME => 'Dow', - FakeAddressInterface::LASTNAME => 'Johnes', - FakeAddressInterface::SUFFIX => 'Jr.', - FakeAddressInterface::POSTCODE => '78757', - FakeAddressInterface::PREFIX => 'Mr.', - FakeAddressInterface::STREET => 'Oak rd.', - FakeAddressInterface::TELEPHONE => '1234567', - FakeAddressInterface::VAT_ID => '1', - 'test' => 'xxx', - FakeAddressInterface::DEFAULT_BILLING => false, - FakeAddressInterface::DEFAULT_SHIPPING => true, - ]; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttributesFactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttributesFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2c6ddf42f67cbbfc9edb55330c4ae09f387807ae --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/ExtensionAttributesFactoryTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Api; + +class ExtensionAttributesFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Framework\Api\ExtensionAttributesFactory */ + private $factory; + + protected function setUp() + { + $autoloadWrapper = \Magento\Framework\Autoload\AutoloaderRegistry::getAutoloader(); + $autoloadWrapper->addPsr4('Magento\\Wonderland\\', realpath(__DIR__ . '/_files/Magento/Wonderland')); + /** @var \Magento\Framework\ObjectManagerInterface */ + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->factory = new ExtensionAttributesFactory($objectManager); + } + + /** + * @expectedException \LogicException + */ + public function testCreateThrowExceptionIfInterfaceNotImplemented() + { + $this->factory->create('Magento\Framework\Api\ExtensionAttributesFactoryTest'); + } + + /** + * @expectedException \LogicException + */ + public function testCreateThrowExceptionIfInterfaceNotOverridden() + { + $this->factory->create('\Magento\Wonderland\Model\Data\FakeExtensibleOne'); + } + + /** + * @expectedException \LogicException + */ + public function testCreateThrowExceptionIfReturnIsIncorrect() + { + $this->factory->create('\Magento\Wonderland\Model\Data\FakeExtensibleTwo'); + } + + public function testCreate() + { + $this->assertInstanceOf( + 'Magento\Wonderland\Api\Data\FakeRegionExtension', + $this->factory->create('Magento\Wonderland\Model\Data\FakeRegion') + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php index 597a30cc1de907d7eeb1f193ef97716b0568bdfd..8377ec40155785df4aeb482bc867d43cf2763224 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php @@ -170,4 +170,21 @@ interface FakeAddressInterface extends ExtensibleDataInterface * @return bool|null */ public function isDefaultBilling(); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes + ); } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleOneInterface.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleOneInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..fdf9d49a67c3fe67503ec23dda9fa8742c0d291f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleOneInterface.php @@ -0,0 +1,18 @@ +<?php +/** + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Wonderland\Api\Data; + +use Magento\Framework\Api\ExtensibleDataInterface; + +/** + * Fake interface + * to test exception if the method 'getExtensionAttributes' is not overridden + */ +interface FakeExtensibleOneInterface extends ExtensibleDataInterface +{ +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleTwoInterface.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleTwoInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..42f212c861474c3e66595458473d7227470fad7e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleTwoInterface.php @@ -0,0 +1,24 @@ +<?php +/** + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Wonderland\Api\Data; + +use Magento\Framework\Api\ExtensibleDataInterface; + +/** + * Fake interface + * to test exception if the method 'getExtensionAttributes' does not return concrete type + */ +interface FakeExtensibleTwoInterface extends ExtensibleDataInterface +{ + /** + * test incorrect return type + * + * @return int + */ + public function getExtensionAttributes(); +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeRegionInterface.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeRegionInterface.php index ce54b0484b530f1fdbd47753002b556fe2d841a0..76cb08b2395f8a5d5d8848ccce74302de8822dee 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeRegionInterface.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeRegionInterface.php @@ -41,4 +41,21 @@ interface FakeRegionInterface extends ExtensibleDataInterface * @return int */ public function getRegionId(); + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object. + * + * @param \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes + ); } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php index 0070597fa58bd402876514caf99ffbe6d933d91d..98407fcebb8f2a30cfb3c3f5a1de9c1f6710dc98 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php @@ -7,31 +7,10 @@ namespace Magento\Wonderland\Model\Data; use Magento\Framework\Api\AbstractExtensibleObject; +use Magento\Wonderland\Api\Data\FakeAddressInterface; -class FakeAddress extends AbstractExtensibleObject +class FakeAddress extends AbstractExtensibleObject implements FakeAddressInterface { - /**#@+ - * Constants for keys of data array - */ - const ID = 'id'; - const CUSTOMER_ID = 'customer_id'; - const REGION = 'region'; - const REGIONS = 'regions'; - const COUNTRY_ID = 'country_id'; - const STREET = 'street'; - const COMPANY = 'company'; - const TELEPHONE = 'telephone'; - const FAX = 'fax'; - const POSTCODE = 'postcode'; - const CITY = 'city'; - const FIRSTNAME = 'firstname'; - const LASTNAME = 'lastname'; - const MIDDLENAME = 'middlename'; - const PREFIX = 'prefix'; - const SUFFIX = 'suffix'; - const VAT_ID = 'vat_id'; - /**#@-*/ - /** * Get ID * @@ -201,4 +180,46 @@ class FakeAddress extends AbstractExtensibleObject { return $this->_get(self::VAT_ID); } + + /** + * Get if this address is default shipping address. + * + * @return bool|null + */ + public function isDefaultShipping() + { + return $this->_get(self::DEFAULT_SHIPPING); + } + + /** + * {@inheritdoc} + * + * @return \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * Get if this address is default billing address + * + * @return bool|null + */ + public function isDefaultBilling() + { + return $this->_get(self::DEFAULT_BILLING); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleOne.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleOne.php new file mode 100644 index 0000000000000000000000000000000000000000..536aeb9343dce89989d2662b2bbe4ca85a2292a7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleOne.php @@ -0,0 +1,13 @@ +<?php +/** + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Wonderland\Model\Data; + +use Magento\Wonderland\Api\Data\FakeExtensibleOneInterface; + +class FakeExtensibleOne implements FakeExtensibleOneInterface +{ +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleTwo.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleTwo.php new file mode 100644 index 0000000000000000000000000000000000000000..47c95a12b83c510ed50c72e99ef0738b0700a1e6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleTwo.php @@ -0,0 +1,21 @@ +<?php +/** + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Wonderland\Model\Data; + +use Magento\Framework\Api\AbstractExtensibleObject; +use Magento\Wonderland\Api\Data\FakeExtensibleTwoInterface; + +class FakeExtensibleTwo extends AbstractExtensibleObject implements FakeExtensibleTwoInterface +{ + /** + * {@inheritdoc} + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php index e6dad7fd79fc310c8298feb90420d8967e6aef88..cef747dcbdd1ceed0f357b680352921136420074 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php @@ -8,16 +8,8 @@ namespace Magento\Wonderland\Model\Data; use Magento\Framework\Api\AbstractExtensibleObject; -class FakeRegion extends AbstractExtensibleObject +class FakeRegion extends AbstractExtensibleObject implements \Magento\Wonderland\Api\Data\FakeRegionInterface { - /**#@+ - * Constants for keys of data array - */ - const REGION_CODE = 'region_code'; - const REGION = 'region'; - const REGION_ID = 'region_id'; - /**#@-*/ - /** * Get region * @@ -47,4 +39,37 @@ class FakeRegion extends AbstractExtensibleObject { return $this->_get(self::REGION_ID); } + + /** + * {@inheritdoc} + * + * @return \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } + + /** + * Set region code + * + * @param string $regionCode + * @return $this + */ + public function setRegionCode($regionCode) + { + return $this->setData(self::REGION_CODE, $regionCode); + } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php index 67db23b4f055b8fe778b480aa281aba05b789281..f98e3f5051c31b4c47b1dcdf07fcc4718a0022f4 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php @@ -200,4 +200,26 @@ class FakeAddress extends AbstractExtensibleModel implements FakeAddressInterfac { return $this->getData(self::DEFAULT_BILLING); } + + /** + * {@inheritdoc} + * + * @return \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Wonderland\Api\Data\FakeAddressExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeRegion.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeRegion.php index 9074d3fcf36feeeacb19e65302378424cc6e342a..7527cde11534a301cfb6ae6e0e7ccd306c96ceb1 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeRegion.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeRegion.php @@ -40,4 +40,26 @@ class FakeRegion extends AbstractExtensibleModel implements FakeRegionInterface { return $this->getData(self::REGION_ID); } + + /** + * {@inheritdoc} + * + * @return \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface|null + */ + public function getExtensionAttributes() + { + return $this->_getExtensionAttributes(); + } + + /** + * {@inheritdoc} + * + * @param \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes( + \Magento\Wonderland\Api\Data\FakeRegionExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php index c4fa6c52bcbf54d81dc14e42b08b101be27924bd..f2519497eeba1427d9c2005b3c0215020c32b6f3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Router/BaseTest.php @@ -36,7 +36,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase $request = $objectManager->get('Magento\TestFramework\Request'); $this->assertInstanceOf('Magento\Framework\App\ActionInterface', $this->_model->match($request)); - $request->setRequestUri('core/index/index'); + $request->setRequestUri('framework/index/index'); $this->assertInstanceOf('Magento\Framework\App\ActionInterface', $this->_model->match($request)); $request->setPathInfo( @@ -54,8 +54,8 @@ class BaseTest extends \PHPUnit_Framework_TestCase public function testGetControllerClassName() { $this->assertEquals( - 'Magento\Core\Controller\Index', - $this->_model->getActionClassName('Magento_Core', 'index') + 'Magento\Framework\Controller\Index', + $this->_model->getActionClassName('Magento_Framework', 'index') ); } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php index 943cc88e8f697eb55bec4754f01742945853dfd2..e31201caf943440ce75a00725b65c79cde471c29 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Code/GeneratorTest.php @@ -39,7 +39,8 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->varDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->varDirectory = $objectManager->get( 'Magento\Framework\Filesystem' )->getDirectoryWrite( DirectoryList::VAR_DIR @@ -49,7 +50,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase new \Magento\Framework\Filesystem\Driver\File(), $generationDirectory ); - $this->_generator = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + $this->_generator = $objectManager->create( 'Magento\Framework\Code\Generator', [ 'ioObject' => $this->_ioObject, @@ -61,6 +62,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase ] ] ); + $this->_generator->setObjectManager($objectManager); } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php index 5e0219f68f0e24e94bc092ddbbd2952743131bf8..ff713ae85f28f53df39201f3708adb5146b5a67b 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/InterfaceTest.php @@ -38,7 +38,7 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase '\Magento\Framework\Setup\ModuleDataSetupInterface', [ 'resourceName' => 'core_setup', - 'moduleName' => 'Magento_Core' + 'moduleName' => 'Magento_Test' ] ); $this->_connection = $installer->getConnection(); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/HelperTest.php similarity index 97% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php rename to dev/tests/integration/testsuite/Magento/Framework/DB/HelperTest.php index 4cdb588557727e2f3dbcbbb04cab0d11346f117e..ee8a44e4644de8816b8e8ea63d6d612489866300 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/DB/HelperTest.php @@ -3,7 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Model\Resource; +namespace Magento\Framework\DB; class HelperTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php index b1440adba626ebfd24344841aecbc544780ea734..248c90684a529a95cba9717392663360e6ed2a5f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Image/Adapter/InterfaceTest.php @@ -7,6 +7,9 @@ namespace Magento\Framework\Image\Adapter; use Magento\Framework\App\Filesystem\DirectoryList; +/** + * @magentoAppIsolation enabled + */ class InterfaceTest extends \PHPUnit_Framework_TestCase { /** @@ -107,6 +110,7 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase * Mark test as skipped if not * * @param string $adapterType + * @return \Magento\Framework\Image\Adapter\AdapterInterface */ protected function _getAdapter($adapterType) { @@ -319,7 +323,7 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase $pixel['y'] -= $center['y']; return [ 'x' => round($size[0] / 2 + $pixel['x'] * cos($angle) + $pixel['y'] * sin($angle), 0), - 'y' => round($size[1] / 2 + $pixel['y'] * cos($angle) - $pixel['x'] * sin($angle), 0) + 'y' => round($size[1] / 2 + $pixel['y'] * cos($angle) - $pixel['x'] * sin($angle), 0), ]; } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php index 68a1a23fec84a94e7e220cf1961af26459de37cc..9962b27826a785f1a29388d735b8e67bc5497757 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/ConfigTest.php @@ -210,11 +210,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertSame((bool)ini_get('session.cookie_secure'), $this->_model->getCookieSecure()); } - public function testCookieSecureIsMutable() + public function testSetCookieSecureInOptions() { - $value = ini_get('session.cookie_secure') ? false : true; - $this->_model->setCookieSecure($value); - $this->assertEquals($value, $this->_model->getCookieSecure()); + $this->_model->setCookieSecure(true); + $this->assertTrue($this->_model->getCookieSecure()); } public function testCookieDomainIsMutable() @@ -243,11 +242,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertEquals($preVal, $this->_model->getCookieDomain()); } - public function testCookieHttpOnlyIsMutable() + public function testSetCookieHttpOnlyInOptions() { - $value = ini_get('session.cookie_httponly') ? false : true; - $this->_model->setCookieHttpOnly($value); - $this->assertEquals($value, $this->_model->getCookieHttpOnly()); + $this->_model->setCookieHttpOnly(true); + $this->assertTrue($this->_model->getCookieHttpOnly()); } public function testUseCookiesDefaultsToIniSettings() @@ -255,11 +253,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertSame((bool)ini_get('session.use_cookies'), $this->_model->getUseCookies()); } - public function testUseCookiesIsMutable() + public function testSetUseCookiesInOptions() { - $value = ini_get('session.use_cookies') ? false : true; - $this->_model->setUseCookies($value); - $this->assertEquals($value, (bool)$this->_model->getUseCookies()); + $this->_model->setUseCookies(true); + $this->assertTrue($this->_model->getUseCookies()); } public function testUseOnlyCookiesDefaultsToIniSettings() @@ -267,11 +264,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertSame((bool)ini_get('session.use_only_cookies'), $this->_model->getUseOnlyCookies()); } - public function testUseOnlyCookiesIsMutable() + public function testSetUseOnlyCookiesInOptions() { - $value = ini_get('session.use_only_cookies') ? false : true; - $this->_model->setOption('use_only_cookies', $value); - $this->assertEquals($value, (bool)$this->_model->getOption('use_only_cookies')); + $this->_model->setOption('use_only_cookies', true); + $this->assertTrue((bool)$this->_model->getOption('use_only_cookies')); } public function testRefererCheckDefaultsToIniSettings() diff --git a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php index d1edb2e3599d44b28e9984b7b1ee0265dd978ef4..12dbfcb466dd269a9cff5b572ad706d21704a9b8 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandler/DbTableTest.php @@ -83,7 +83,7 @@ class DbTableTest extends \PHPUnit_Framework_TestCase /** @var $resource \Magento\Framework\App\Resource */ $resource = $this->_objectManager->get('Magento\Framework\App\Resource'); $this->_connection = $resource->getConnection('core_write'); - $this->_sessionTable = $resource->getTableName('core_session'); + $this->_sessionTable = $resource->getTableName('session'); // session stores serialized objects with protected properties // we need to test this case to ensure that DB adapter successfully processes "\0" symbols in serialized data diff --git a/dev/tests/integration/testsuite/Magento/Framework/Translate/_files/_translation_data.php b/dev/tests/integration/testsuite/Magento/Framework/Translate/_files/_translation_data.php index 002e59c5aa2e3a96abf8d250df92ec30ce5b5f8f..2fc1a5ff1eddb8863e2c2b3039bc40721710219f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Translate/_files/_translation_data.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Translate/_files/_translation_data.php @@ -5,8 +5,8 @@ */ ?> <?php return [ - 'Original value for Magento_Core module' => 'Translated value for Magento_Core module', - 'Magento_Core::Text with different translation on different modules' => 'Text translation by Magento_Core module', + 'Original value for Magento_Store module' => 'Translated value for Magento_Store module', + 'Magento_Store::Text with different translation on different modules' => 'Text translation by Magento_Store module', 'Some non-translated value for Magento_Catalog' => 'Translation for some value for Magento_Catalog', 'Another non-translated value for Magento_Catalog' => 'Translation for another value for Magento_Catalog', 'Magento_Catalog::Text with different translation on different modules' => diff --git a/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php b/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php index 44d7f7ab3c101a65c1a98ba1f62fbf30d126d5d9..da1d8586a1f3939fd1da8e9673a3aff77b632b6f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/TranslateTest.php @@ -40,11 +40,15 @@ class TranslateTest extends \PHPUnit_Framework_TestCase /** @var $moduleReader \Magento\Framework\Module\Dir\Reader */ $moduleReader = $objectManager->get('Magento\Framework\Module\Dir\Reader'); - $moduleReader->setModuleDir('Magento_Core', 'i18n', dirname(__DIR__) . '/Core/Model/_files/Magento/Core/i18n'); + $moduleReader->setModuleDir( + 'Magento_Store', + 'i18n', + dirname(__DIR__) . '/Translation/Model/_files/Magento/Store/i18n' + ); $moduleReader->setModuleDir( 'Magento_Catalog', 'i18n', - dirname(__DIR__) . '/Core/Model/_files/Magento/Catalog/i18n' + dirname(__DIR__) . '/Translation/Model/_files/Magento/Catalog/i18n' ); /** @var \Magento\Theme\Model\View\Design $designModel */ diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php index 569cd212239ee78cf3ddb8cf4f0d9c82ee79e5aa..1c77630c6661588ad5d1cf1fe71f1a1eb5b01041 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Element/AbstractBlockTest.php @@ -35,7 +35,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\View\Element\Context' ), - ['module_name' => 'Magento_Core'] + ['module_name' => 'Magento_Theme'] ] ); } @@ -483,8 +483,8 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase public function testGetModuleName() { - $this->assertEquals('Magento_Core', $this->_block->getModuleName()); - $this->assertEquals('Magento_Core', $this->_block->getData('module_name')); + $this->assertEquals('Magento_Theme', $this->_block->getModuleName()); + $this->assertEquals('Magento_Theme', $this->_block->getData('module_name')); } /** @@ -619,7 +619,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Framework\View\Element\Context' ), - ['module_name' => 'Magento_Core'] + ['module_name' => 'Magento_Theme'] ], $mockClass ); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php index 6df823cf87be89fbe8ce929fc99b91eafaa09954..4dde9773e60fba23c54046012b38a02ebcc2cb6c 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/Layout/Reader/BlockTest.php @@ -43,7 +43,9 @@ class BlockTest extends \PHPUnit_Framework_TestCase public function testInterpretBlockDirective() { $pageXml = new \Magento\Framework\View\Layout\Element( - __DIR__ . '/_files/_layout_update_block.xml', 0, true + __DIR__ . '/_files/_layout_update_block.xml', + 0, + true ); $parentElement = new \Magento\Framework\View\Layout\Element('<page></page>'); @@ -71,13 +73,12 @@ class BlockTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->blockName, $structure->getStructure()[$this->childBlockName][self::IDX_PARENT]); } - /** - * @depends testInterpretBlockDirective - */ public function testInterpretReferenceBlockDirective() { $pageXml = new \Magento\Framework\View\Layout\Element( - __DIR__ . '/_files/_layout_update_reference.xml', 0, true + __DIR__ . '/_files/_layout_update_reference.xml', + 0, + true ); $parentElement = new \Magento\Framework\View\Layout\Element('<page></page>'); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/arguments_object_type_updaters.xml b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/arguments_object_type_updaters.xml index b98084ad88f5ff7b1ba15141e58e7cb75efbd25e..f713bfb8bbfada6a5ead86f955e09bd99196eafb 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/arguments_object_type_updaters.xml +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/layout_directives_test/arguments_object_type_updaters.xml @@ -8,7 +8,7 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd"> <block class="Magento\Framework\View\Element\Text" name="block_with_object_updater_args"> <arguments> - <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="object">Magento\Core\Model\DataSource</argument> + <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="one" xsi:type="object">Magento\Store\Model\DataSource</argument> <argument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="two" xsi:type="number">0</argument> </arguments> </block> diff --git a/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php b/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php index 26fe450bc09707af9b4288f1bac4c82b8a3ac593..827606d2109cc98040774d98805329fe5ca57594 100644 --- a/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php +++ b/dev/tests/integration/testsuite/Magento/Indexer/Controller/Adminhtml/IndexerTest.php @@ -19,7 +19,7 @@ class IndexerTest extends \Magento\Backend\Utility\Controller { $this->dispatch('backend/indexer/indexer/list/'); $body = $this->getResponse()->getBody(); - $this->assertContains('<h1 class="title">Index Management</h1>', $body); + $this->assertContains('<h1 class="page-title">Index Management</h1>', $body); $this->assertSelectCount('#gridIndexer_massaction-select', 1, $body, 'Mode selector is not found'); $this->assertContains('option value="change_mode_onthefly"', $body); $this->assertContains('option value="change_mode_changelog"', $body); diff --git a/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php b/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php index 2a391f73699dac69a704b6773606ff61175da86f..96ea9e4516f60f0b3cbf7a26b20a3d67235ee5d4 100644 --- a/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php +++ b/dev/tests/integration/testsuite/Magento/MemoryUsageTest.php @@ -19,6 +19,9 @@ class MemoryUsageTest extends \PHPUnit_Framework_TestCase protected function setUp() { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped("For HHVM it's not relevant while MAGETWO-33679 is not resolved"); + } $this->_helper = new \Magento\TestFramework\Helper\Memory( new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer()) ); diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php index 8eadd1a288a00ca7b217547c55c3fd42b0c9006c..d501af84c4c26266dff6331a627d6ab1aad6dd30 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/TemplateTest.php @@ -6,7 +6,7 @@ namespace Magento\Newsletter\Model; /** - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ class TemplateTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php index fe3cc067ec3e18690865de39ee50aaf7c9e90988..470db3b9ad92d926c1f1f75b72446c3bc63cc1f3 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/subscribers.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -require __DIR__ . '/../../../Magento/Core/_files/store.php'; +require __DIR__ . '/../../../Magento/Store/_files/core_fixturestore.php'; require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; $currentStore = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php index f0d383549ac913e94928aa365da58946c2f0195b..985b0fd9bad9c0594b81362d179b0c7997a835c6 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php @@ -6,6 +6,9 @@ namespace Magento\ProductAlert\Model; +/** + * @magentoAppIsolation enabled + */ class EmailTest extends \PHPUnit_Framework_TestCase { /** diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php index cc314c331967cfc805c86ba53d785003edd4835c..10b2024b303668c00168d2f466bd8cb123714801 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php @@ -5,6 +5,9 @@ */ namespace Magento\ProductAlert\Model; +/** + * @magentoAppIsolation enabled + */ class ObserverTest extends \PHPUnit_Framework_TestCase { /** diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php index 655f6ea9d006c50f4afcdd14a9758aa842f52b62..92fc68dbe396734fa7d87b5803f7ecbb8c830e1c 100644 --- a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php +++ b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteTest.php @@ -46,7 +46,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $dataObjectHelper = Bootstrap::getObjectManager()->create('Magento\Framework\Api\DataObjectHelper'); $expected = $this->_getCustomerDataArray(); $customer = $customerFactory->create(); - $dataObjectHelper->populateWithArray($customer, $expected); + $dataObjectHelper->populateWithArray( + $customer, + $expected, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $this->assertEquals($expected, $this->convertToArray($customer)); @@ -68,7 +72,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase //For save in repository $expected = $this->removeIdFromCustomerData($expected); $customerDataSet = $customerFactory->create(); - $dataObjectHelper->populateWithArray($customerDataSet, $expected); + $dataObjectHelper->populateWithArray( + $customerDataSet, + $expected, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $this->assertEquals($expected, $this->convertToArray($customerDataSet)); /** * @var \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository @@ -80,7 +88,11 @@ class QuoteTest extends \PHPUnit_Framework_TestCase $expected = $this->_getCustomerDataArray(); $expected = $this->changeEmailInCustomerData('test@example.com', $expected); $customerDataUpdated = $customerFactory->create(); - $dataObjectHelper->populateWithArray($customerDataUpdated, $expected); + $dataObjectHelper->populateWithArray( + $customerDataUpdated, + $expected, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $quote->updateCustomerData($customerDataUpdated); $customer = $quote->getCustomer(); $expected = $this->changeEmailInCustomerData('test@example.com', $expected); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php index 6bbd0430c0bfc3f3a637465ea1aa9d5b30ea0d55..4d4c2d92a90b08fd8d132090fde771ca1d8a5261 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_fixture_store.php @@ -6,7 +6,7 @@ // @codingStandardsIgnoreFile -require __DIR__ . '/../../../Magento/Core/_files/store.php'; +require __DIR__ . '/../../../Magento/Store/_files/core_fixturestore.php'; require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_duplicated.php'; /** @var \Magento\Catalog\Model\Product $product */ diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataSource.php b/dev/tests/integration/testsuite/Magento/Store/Model/DataSource.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/Model/DataSource.php rename to dev/tests/integration/testsuite/Magento/Store/Model/DataSource.php index 8daa1aa1cdc27b0c33d1e0ea30182300f63a5cc1..4b9dcd8c763a8e2fea99630e4e31ca9b85861e9d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataSource.php +++ b/dev/tests/integration/testsuite/Magento/Store/Model/DataSource.php @@ -3,7 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Model; +namespace Magento\Store\Model; /** * Dummy layout argument data source object @@ -31,7 +31,7 @@ class DataSource extends \Magento\Framework\Data\Collection * Set updater calls * * @param array $calls - * @return \Magento\Core\Model\DataSource + * @return \Magento\Store\Model\DataSource */ public function setUpdaterCall(array $calls) { diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/store.php b/dev/tests/integration/testsuite/Magento/Store/_files/core_fixturestore.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/_files/store.php rename to dev/tests/integration/testsuite/Magento/Store/_files/core_fixturestore.php diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/second_third_store.php b/dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore.php similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/_files/second_third_store.php rename to dev/tests/integration/testsuite/Magento/Store/_files/core_second_third_fixturestore.php diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php index 76d788a77dd462d2f5b735671de16eedc46a3b0a..0c3af306bdeaa8f70d4a0b9e3e0d4bda252693e1 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxCalculationTest.php @@ -1951,12 +1951,18 @@ class TaxCalculationTest extends \PHPUnit_Framework_TestCase * * This utility function is used to simplify expected result verification. * - * @param AbstractExtensibleModel $object + * @param \Magento\Framework\Object $object * @return array */ - private function convertObjectToArray(AbstractExtensibleModel $object) + private function convertObjectToArray($object) { - $data = $object->getData(); + if ($object instanceof \Magento\Framework\Object) { + $data = $object->getData(); + } else if (is_object($object)) { + $data = (array)$object; + } else { + throw new \InvalidArgumentException("Provided argument is not an object."); + } foreach ($data as $key => $value) { if (is_object($value)) { $data[$key] = $this->convertObjectToArray($value); diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/Parser/Composer/JsonTest.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/Parser/Composer/JsonTest.php index 9a5cfc24ba9a3af8ee7be4996398de7291ed8b85..684c24f7b933bf7999ce97c835b851d8140e98a4 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/Parser/Composer/JsonTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/Parser/Composer/JsonTest.php @@ -32,7 +32,6 @@ class JsonTest extends \PHPUnit_Framework_TestCase [ 'name' => 'magento/module-module1', 'dependencies' => [ - ['module' => 'magento/module-core', 'type' => 'hard'], ['module' => 'magento/module-module2', 'type' => 'hard'], ['module' => 'magento/module-backend', 'type' => 'soft'], ], @@ -40,7 +39,6 @@ class JsonTest extends \PHPUnit_Framework_TestCase [ 'name' => 'magento/module-module2', 'dependencies' => [ - ['module' => 'magento/module-core', 'type' => 'hard'], ['module' => 'magento/module-module3', 'type' => 'hard'], ] ], diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer1.json b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer1.json index aa86499218364dd7e01ff62d8f33c9951ad10deb..14b92acc4f7ac59ba502c7da3d92c7d2c98b4997 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer1.json +++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer1.json @@ -3,7 +3,6 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-core": "0.1.0-alpha103", "magento/module-module2": "0.1.0-alpha103" }, "suggest": { diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer2.json b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer2.json index ee1f92ce06fdb65ceadaba97380a02370970ac80..ba14f37abc9f2fc85fd3bac276745c96c9ef4cef 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer2.json +++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer2.json @@ -3,7 +3,6 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-core": "0.1.0-alpha103", "magento/module-module3": "0.1.0-alpha103" }, "type": "magento2-module", diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer4.json b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer4.json index 7d6f1156608810b2570475de76a28ad49cdecf97..3f6b5173c8b4ea7fdd131bfa634f408b1d47b9fb 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer4.json +++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer4.json @@ -3,7 +3,6 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-core": "0.1.0-alpha103", "magento/module-module2": "0.1.0-alpha103" }, "type": "magento2-module", diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer5.json b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer5.json index 39685bcd994940866add3ad1d420483683a5a769..cb9d044436befb0593a3f8e2c98e9d8c3c5dace4 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer5.json +++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/composer5.json @@ -3,7 +3,6 @@ "description": "N/A", "require": { "php": "~5.5.0|~5.6.0", - "magento/module-core": "0.1.0-alpha103", "magento/module-module1": "0.1.0-alpha103" }, "type": "magento2-module", diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/expected/dependencies.csv b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/expected/dependencies.csv index afdc023ce7ecb1e3f47ae390846aa1f7df678a9d..bce8d9c13d29ac3ac3e983a635069e2170a3d6bf 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/expected/dependencies.csv +++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Dependency/_files/expected/dependencies.csv @@ -1,12 +1,10 @@ "";"All";"Hard";"Soft" -"Total number of dependencies";"5";"4";"1" +"Total number of dependencies";"3";"2";"1" "Dependencies for each module:";"All";"Hard";"Soft" -"magento/module-module1";"3";"2";"1" -" -- magento/module-core";"";"1";"0" +"magento/module-module1";"2";"1";"1" " -- magento/module-module2";"";"1";"0" " -- magento/module-backend";"";"0";"1" -"magento/module-module2";"2";"2";"0" -" -- magento/module-core";"";"1";"0" +"magento/module-module2";"1";"1";"0" " -- magento/module-module3";"";"1";"0" diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php index 2fe398ded09e7e0de078b09ffbb481f0f927fd22..4eec44f4a23449fd83b217e2dcd5f3b8470895de 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/View/DesignTest.php @@ -126,7 +126,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase /** * @magentoConfigFixture current_store design/theme/theme_id one * @magentoConfigFixture fixturestore_store design/theme/theme_id two - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testGetConfigurationDesignThemeStore() { diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/etc/view.xml b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/etc/view.xml index bbc87835a04fd3ce6965ee5f3ce05ba0b006375c..61d0514d8ae95c2aecbffd5df1445d98ab869c70 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/etc/view.xml +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/etc/view.xml @@ -6,8 +6,8 @@ */ --> <view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../lib/internal/Magento/Framework/Config/etc/view.xsd"> - <vars module="Magento_Core"> - <var name="var1">Core Value1</var> + <vars module="Magento_Store"> + <var name="var1">Store Value1</var> </vars> <vars module="Namespace_Module"> <var name="var1">value1</var> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Catalog/i18n/en_US.csv b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Catalog/i18n/en_US.csv similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Catalog/i18n/en_US.csv rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Catalog/i18n/en_US.csv diff --git a/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_AU.csv b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_AU.csv new file mode 100644 index 0000000000000000000000000000000000000000..6a8d6d9f0ef953317d8b2a0cd6527e0a995fb97f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_AU.csv @@ -0,0 +1 @@ +"Original value for Magento_Store module","Translated value for Magento_Store module in en_AU" diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_UK.csv b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_UK.csv similarity index 59% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_UK.csv rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_UK.csv index 49355d289e411b75539bbb275addbc770672e169..94f7f1ba263a29cc5907b327a421faccc6fefd56 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_UK.csv +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_UK.csv @@ -1 +1 @@ -"Text with different translation on different modules","Text translation by Magento_Core module in en_UK" +"Text with different translation on different modules","Text translation by Magento_Store module in en_UK" diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_US.csv b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_US.csv similarity index 54% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_US.csv rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_US.csv index a1e746bfeb758850e05e321110c4ef911d67025c..2ccaf17120470b3369ff0e6c6fe9c28acda7b0c2 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/Magento/Core/i18n/en_US.csv +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/Magento/Store/i18n/en_US.csv @@ -1,3 +1,3 @@ "%s","%s" -"Original value for Magento_Core module","Translated value for Magento_Core module" +"Original value for Magento_Store module","Translated value for Magento_Store module" "Text with different translation on different modules","Text translation that was last loaded" diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/custom/local.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/custom/local.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/custom/local.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/custom/local.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/custom/prohibited.filename.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/custom/prohibited.filename.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/custom/prohibited.filename.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/custom/prohibited.filename.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/local.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/local.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/local.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/local.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/z.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/z.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/local_config/z.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/local_config/z.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/no_local_config/a.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/no_local_config/a.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/no_local_config/a.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/no_local_config/a.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/no_local_config/b.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/no_local_config/b.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/no_local_config/b.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/no_local_config/b.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/no_local_config/custom/local.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/no_local_config/custom/local.xml similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/local_config/no_local_config/custom/local.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/local_config/no_local_config/custom/local.xml diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/locale/en_AU/config.xml b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/locale/en_AU/config.xml similarity index 92% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/locale/en_AU/config.xml rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/locale/en_AU/config.xml index d8a6cc64835de174524404991954e587c38f1fb5..97d3c799a4ee00613bab6e86f08c9c80d6c69a7f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/locale/en_AU/config.xml +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/locale/en_AU/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> <default> <locale> <inheritance> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/media/some_file.txt b/dev/tests/integration/testsuite/Magento/Translation/Model/_files/media/some_file.txt similarity index 100% rename from dev/tests/integration/testsuite/Magento/Core/Model/_files/media/some_file.txt rename to dev/tests/integration/testsuite/Magento/Translation/Model/_files/media/some_file.txt diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php index a17d3e18b9174680f40178c19876ce7e06707eb0..d4780d259aafb1213be6b66d7b5329f425ebea5a 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php @@ -88,7 +88,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * * @dataProvider getEntityStoresDataProvider * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * * @param array $productData * @param array $categoryData @@ -117,7 +117,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * Check exception is thrown when product does not associated with stores * * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testGetEntityStoresProductStoresException() { @@ -139,7 +139,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * Check exception is thrown when product stores in intersection with category stores is empty * * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * */ public function testGetEntityStoresProductCategoryStoresException() @@ -166,7 +166,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * Check exception is thrown when category does not associated with stores * * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testGetEntityStoresCategoryStoresException() { diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php index 8e95b21be5814e048e8696cee33156c0462ec85b..8eb255b89d94b35401db85052a114f4fc2577567 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/Edit/FormTest.php @@ -70,7 +70,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * Test entity stores * * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testGetEntityStores() { @@ -91,7 +91,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * Check exception is thrown when product does not associated with stores * * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testGetEntityStoresProductStoresException() { diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php index cd1827579b22945d145266e0305afa8b43ed59f8..a201e3105ae79dd598267cc054d3b20562e80225 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Cms/Page/GridTest.php @@ -48,7 +48,7 @@ class GridTest extends \PHPUnit_Framework_TestCase /** * Test prepare grid when there is more than one store * - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testPrepareGridForMultipleStores() { diff --git a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php index 18382c4b69f1ee450254ff283e22e4535c406aeb..570e42dad7dba858baa7751723d99604414b46b6 100644 --- a/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlRewrite/Block/Edit/FormTest.php @@ -116,7 +116,7 @@ class FormTest extends \PHPUnit_Framework_TestCase * Test store selection is available and correctly configured * * @magentoAppIsolation enabled - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testStoreElementMultiStores() { diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php index 268d2274beb25c2963d630b095a290f4af542ce0..f9f6ceda847cd08e413b946714077ae302d69e57 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Controller/PathProcessorTest.php @@ -26,7 +26,7 @@ class PathProcessorTest extends \PHPUnit_Framework_TestCase } /** - * @magentoDataFixture Magento/Core/_files/store.php + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php */ public function testProcessWithValidStoreCode() { 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 94e740210165ddea0a721a2700e0be52586cd79a..07d9d098ce8c23ec611478dec332941a46befac9 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 @@ -5,52 +5,117 @@ */ return [ 'services' => [ - 'Magento\TestModule1\Service\V1\AllSoapAndRestInterface' => [ - 'item' => [ - 'resources' => [ - 'Magento_Test1::resource1', + 'Magento\TestModuleMSC\Api\AllSoapAndRestInterface' => [ + 'V1' => [ + 'methods' => [ + 'item' => [ + 'resources' => [ + 'Magento_TestModuleMSC::resource1', + ], + 'secure' => false, + ], + 'create' => [ + 'resources' => [ + 'Magento_TestModuleMSC::resource3', + ], + 'secure' => false, + ], ], - 'secure' => false, ], - 'create' => [ - 'resources' => [ - 'Magento_Test1::resource1', + 'V2' => [ + 'methods' => [ + 'getPreconfiguredItem' => [ + 'resources' => [ + 'Magento_TestModuleMSC::resource1', + 'Magento_TestModuleMSC::resource2', + ], + 'secure' => false, + ], ], - 'secure' => false, ], ], - 'Magento\TestModule1\Service\V2\AllSoapAndRestInterface' => [ - 'item' => [ - 'resources' => [ - 'Magento_Test1::resource1', - 'Magento_Test1::resource2', + 'Magento\TestModule1\Service\V1\AllSoapAndRestInterface' => [ + 'V1' => [ + 'methods' => [ + 'item' => [ + 'resources' => [ + 'Magento_Test1::resource1', + ], + 'secure' => false, + ], + 'create' => [ + 'resources' => [ + 'Magento_Test1::resource1', + ], + 'secure' => false, + ], ], - 'secure' => false, ], - 'create' => [ - 'resources' => [ - 'Magento_Test1::resource1', - 'Magento_Test1::resource2', + ], + 'Magento\TestModule1\Service\V2\AllSoapAndRestInterface' => [ + 'V2' => [ + 'methods' => [ + 'item' => [ + 'resources' => [ + 'Magento_Test1::resource1', + 'Magento_Test1::resource2', + ], + 'secure' => false, + ], + 'create' => [ + 'resources' => [ + 'Magento_Test1::resource1', + 'Magento_Test1::resource2', + ], + 'secure' => false, + ], + 'delete' => [ + 'resources' => [ + 'Magento_Test1::resource1', + 'Magento_Test1::resource2', + ], + 'secure' => false, + ], + 'update' => [ + 'resources' => [ + 'Magento_Test1::resource1', + 'Magento_Test1::resource2', + ], + 'secure' => false, + ], ], - 'secure' => false, ], - 'delete' => [ + ], + ], + 'routes' => [ + '/V1/testmoduleMSC/:itemId' => [ + 'GET' => [ + 'secure' => false, + 'service' => [ + 'class' => 'Magento\TestModuleMSC\Api\AllSoapAndRestInterface', + 'method' => 'item', + ], 'resources' => [ - 'Magento_Test1::resource1', - 'Magento_Test1::resource2', + 'Magento_TestModuleMSC::resource1' => true, + ], + 'parameters' => [ ], - 'secure' => false, ], - 'update' => [ + ], + '/V1/testmoduleMSC' => [ + 'POST' => [ + 'secure' => false, + 'service' => [ + 'class' => 'Magento\TestModuleMSC\Api\AllSoapAndRestInterface', + 'method' => 'create', + ], 'resources' => [ - 'Magento_Test1::resource1', - 'Magento_Test1::resource2', + 'Magento_TestModuleMSC::resource3' => true, + ], + 'parameters' => [ ], - 'secure' => false, ], ], - ], - 'routes' => [ '/V1/testmodule1/:id' => [ 'GET' => [ 'secure' => false, @@ -143,5 +208,19 @@ return [ ], ], ], + '/V2/testmoduleMSC/itemPreconfigured' => [ + 'GET' => [ + 'secure' => false, + 'service' => [ + 'class' => 'Magento\TestModuleMSC\Api\AllSoapAndRestInterface', + 'method' => 'getPreconfiguredItem', + ], + 'resources' => [ + 'Magento_TestModuleMSC::resource1' => true, + 'Magento_TestModuleMSC::resource2' => true, + ], + 'parameters' => [], + ] + ] ], ]; 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 cd41f812c4e2be5a32998e94b10cf5cf347e9446..f3e03397766b885725a1f8bd1c1ff1e524659952 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 @@ -37,4 +37,23 @@ <resource ref="Magento_Test1::resource2"/> </resources> </route> + <route method="GET" url="/V1/testmoduleMSC/:itemId"> + <service class="Magento\TestModuleMSC\Api\AllSoapAndRestInterface" method="item" /> + <resources> + <resource ref="Magento_TestModuleMSC::resource1" /> + </resources> + </route> + <route method="POST" url="/V1/testmoduleMSC"> + <service class="Magento\TestModuleMSC\Api\AllSoapAndRestInterface" method="create" /> + <resources> + <resource ref="Magento_TestModuleMSC::resource3" /> + </resources> + </route> + <route method="GET" url="/V2/testmoduleMSC/itemPreconfigured"> + <service class="Magento\TestModuleMSC\Api\AllSoapAndRestInterface" method="getPreconfiguredItem" /> + <resources> + <resource ref="Magento_TestModuleMSC::resource1" /> + <resource ref="Magento_TestModuleMSC::resource2" /> + </resources> + </route> </routes> diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ServerTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ServerTest.php deleted file mode 100644 index 84a5a3269427b85aa6aadaaa7aacdfdfcd8bfab9..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ServerTest.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php -/** - * Test SOAP server model. - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Webapi\Model\Soap; - -class ServerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_configScopeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_areaListMock; - - /** @var \Magento\Webapi\Controller\Soap\Request */ - protected $_requestMock; - - /** @var \Magento\Framework\DomDocument\Factory */ - protected $_domDocumentFactory; - - /** @var \Magento\Store\Model\Store */ - protected $_storeMock; - - /** @var \Magento\Store\Model\StoreManagerInterface */ - protected $_storeManagerMock; - - /** @var \Magento\Webapi\Model\Soap\ServerFactory */ - protected $_soapServerFactory; - - /** @var \Magento\Framework\Reflection\TypeProcessor */ - protected $_typeProcessor; - - /** @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject */ - protected $_configMock; - - protected function setUp() - { - $this->_storeManagerMock = $this->getMockBuilder( - 'Magento\Store\Model\StoreManager' - )->disableOriginalConstructor()->getMock(); - $this->_storeMock = $this->getMockBuilder( - 'Magento\Store\Model\Store' - )->disableOriginalConstructor()->getMock(); - - $this->_areaListMock = $this->getMock('Magento\Framework\App\AreaList', [], [], '', false); - $this->_configScopeMock = $this->getMock('Magento\Framework\Config\ScopeInterface'); - $this->_storeManagerMock->expects( - $this->any() - )->method( - 'getStore' - )->will( - $this->returnValue($this->_storeMock) - ); - $this->_requestMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\Soap\Request' - )->disableOriginalConstructor()->getMock(); - $this->_domDocumentFactory = $this->getMockBuilder( - 'Magento\Framework\DomDocument\Factory' - )->disableOriginalConstructor()->getMock(); - $this->_soapServerFactory = $this->getMockBuilder( - 'Magento\Webapi\Model\Soap\ServerFactory' - )->disableOriginalConstructor()->getMock(); - $this->_typeProcessor = $this->getMock( - 'Magento\Framework\Reflection\TypeProcessor', - [], - [], - '', - false - ); - $this->_configMock = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface'); - - parent::setUp(); - } - - /** - * Test SOAP server construction with WSDL cache enabling. - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function testConstructEnableWsdlCache() - { - /** Mock getConfig method to return true. */ - $this->_configMock->expects($this->once())->method('isSetFlag')->will($this->returnValue(true)); - /** Create SOAP server object. */ - $server = new \Magento\Webapi\Model\Soap\Server( - $this->_areaListMock, - $this->_configScopeMock, - $this->_requestMock, - $this->_domDocumentFactory, - $this->_storeManagerMock, - $this->_soapServerFactory, - $this->_typeProcessor, - $this->_configMock - ); - /** Assert that SOAP WSDL caching option was enabled after SOAP server initialization. */ - $this->assertTrue((bool)ini_get('soap.wsdl_cache_enabled'), 'WSDL caching was not enabled.'); - } - - /** - * Test SOAP server construction with WSDL cache disabling. - * @SuppressWarnings(PHPMD.UnusedLocalVariable) - */ - public function testConstructDisableWsdlCache() - { - /** Mock getConfig method to return false. */ - $this->_configMock->expects($this->once())->method('isSetFlag')->will($this->returnValue(false)); - /** Create SOAP server object. */ - $server = new \Magento\Webapi\Model\Soap\Server( - $this->_areaListMock, - $this->_configScopeMock, - $this->_requestMock, - $this->_domDocumentFactory, - $this->_storeManagerMock, - $this->_soapServerFactory, - $this->_typeProcessor, - $this->_configMock - ); - /** Assert that SOAP WSDL caching option was disabled after SOAP server initialization. */ - $this->assertFalse((bool)ini_get('soap.wsdl_cache_enabled'), 'WSDL caching was not disabled.'); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayBuilder.php deleted file mode 100644 index e5d4037bf903b60af6d50808f0e35fa2c92588d5..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/AssociativeArrayBuilder.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Webapi\Service\Entity; - -class AssociativeArrayBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param string[] $associativeArray - */ - public function setAssociativeArray(array $associativeArray) - { - $this->data['associativeArray'] = $associativeArray; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/DataObjectArrayBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/DataObjectArrayBuilder.php deleted file mode 100644 index 4abff8fedc1b030d160bf132905d7a379a319110..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/DataObjectArrayBuilder.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Webapi\Service\Entity; - -class DataObjectArrayBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param \Magento\Webapi\Service\Entity\SimpleDataObject[] $items - */ - public function setItems(array $items) - { - $this->data['items'] = $items; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/NestedBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/NestedBuilder.php deleted file mode 100644 index ccac8cbd49be0a3310c28dd7a31a3d3188e9263c..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/NestedBuilder.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Webapi\Service\Entity; - -class NestedBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param \Magento\Webapi\Service\Entity\SimpleDataObject $details - */ - public function setDetails($details) - { - $this->data['details'] = $details; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleArrayBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleArrayBuilder.php deleted file mode 100644 index 852a82291ad0ba6b81b388207aebcc5c7bef1d4e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleArrayBuilder.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Webapi\Service\Entity; - -class SimpleArrayBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param int[] $ids - */ - public function setIds(array $ids) - { - $this->data['ids'] = $ids; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleBuilder.php b/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleBuilder.php deleted file mode 100644 index dbe4047089ca615df59be24c9c6889a5c90f7826..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Service/Entity/SimpleBuilder.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Webapi\Service\Entity; - -class SimpleBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * @param int $entityId - */ - public function setEntityId($entityId) - { - $this->data['entityId'] = $entityId; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->data['name'] = $name; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php b/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php index 09014548e5d8ea81e5855ad4104ddcabd693e0db..f568c3b307889a7b06d352ddbe6c0676d649a606 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/ServiceNameCollisionTest.php @@ -11,6 +11,8 @@ */ namespace Magento\Webapi; +use Magento\Webapi\Model\Config\Converter; + class ServiceNameCollisionTest extends \PHPUnit_Framework_TestCase { /** @@ -28,10 +30,12 @@ class ServiceNameCollisionTest extends \PHPUnit_Framework_TestCase $webapiConfig = $objectManager->get('Magento\Webapi\Model\Config'); $serviceNames = []; - foreach (array_keys($webapiConfig->getServices()['services']) as $serviceClassName) { - $newServiceName = $soapConfig->getServiceName($serviceClassName); - $this->assertFalse(in_array($newServiceName, $serviceNames)); - $serviceNames[] = $newServiceName; + foreach ($webapiConfig->getServices()[Converter::KEY_SERVICES] as $serviceClassName => $serviceVersionData) { + foreach ($serviceVersionData as $version => $serviceData) { + $newServiceName = $soapConfig->getServiceName($serviceClassName, $version); + $this->assertFalse(in_array($newServiceName, $serviceNames)); + $serviceNames[] = $newServiceName; + } } } } diff --git a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php index 03819211a74ecb9c997a21214fd073eae8eca57c..8b1d329150edc4b0e5219f54efdd70a4c49e6106 100644 --- a/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php +++ b/dev/tests/integration/testsuite/Magento/Weee/Model/TaxTest.php @@ -65,7 +65,11 @@ class TaxTest extends \PHPUnit_Framework_TestCase $customerRepository->getById(1), [], '\Magento\Customer\Api\Data\CustomerInterface' ); $customerDataSet = $customerFactory->create(); - $dataObjectHelper->populateWithArray($customerDataSet, $expected); + $dataObjectHelper->populateWithArray( + $customerDataSet, + $expected, + '\Magento\Customer\Api\Data\CustomerInterface' + ); $fixtureGroupCode = 'custom_group'; $fixtureTaxClassId = 3; /** @var \Magento\Customer\Model\Group $group */ diff --git a/dev/tests/static/framework/autoload.php b/dev/tests/static/framework/autoload.php index cb9a10bb9d057575ecf1a2af821030e4136899fa..17e643a9f9a3b821ae529713ab5bbec84f250fb0 100644 --- a/dev/tests/static/framework/autoload.php +++ b/dev/tests/static/framework/autoload.php @@ -4,9 +4,10 @@ * See COPYING.txt for license details. */ -require __DIR__ . '/../../../../app/autoload.php'; -$testsBaseDir = realpath(__DIR__ . '/../'); - +$baseDir = realpath(__DIR__ . '/../../../../'); +require $baseDir . '/app/autoload.php'; +$testsBaseDir = $baseDir . '/dev/tests/static'; $autoloadWrapper = \Magento\Framework\Autoload\AutoloaderRegistry::getAutoloader(); $autoloadWrapper->addPsr4('Magento\\', $testsBaseDir . '/testsuite/Magento/'); $autoloadWrapper->addPsr4('Magento\\TestFramework\\', $testsBaseDir . '/framework/Magento/TestFramework/'); +$autoloadWrapper->addPsr4('Magento\\', $baseDir . '/var/generation/Magento/'); diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php index 3d226ef1c24fb6da37e9e901538016c03456f9e0..8ea64f945afdfe44ef49a430a8e4b09de717cb77 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php @@ -13,6 +13,6 @@ class CodeMessDetectorTest extends \PHPUnit_Framework_TestCase 'some/ruleset/file.xml', 'some/report/file.xml' ); - $this->assertEquals(class_exists('PHP_PMD_TextUI_Command'), $messDetector->canRun()); + $this->assertEquals(class_exists('PHPMD\TextUI\Command'), $messDetector->canRun()); } } 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 df8f052ccc25ec33229b0205a299a9b866685c64..493f1310e380c6e586ca25d5afc032c727cbd891 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php @@ -7,14 +7,13 @@ */ namespace Magento\Test\Integrity\Di; -use Magento\Framework\Api\Code\Generator\DataBuilder; use Magento\Framework\Api\Code\Generator\Mapper; use Magento\Framework\Api\Code\Generator\SearchResults; -use Magento\Framework\Api\Code\Generator\SearchResultsBuilder; use Magento\Framework\ObjectManager\Code\Generator\Converter; use Magento\Framework\ObjectManager\Code\Generator\Factory; use Magento\Framework\ObjectManager\Code\Generator\Repository; -use Magento\Framework\Api\Code\Generator\ObjectExtensionInterface; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -316,16 +315,15 @@ class CompilerTest extends \PHPUnit_Framework_TestCase $generator = new \Magento\Framework\Code\Generator( $generatorIo, [ - DataBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\DataBuilder', - SearchResultsBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder', - DataBuilder::ENTITY_TYPE_BUILDER => 'Magento\Framework\Api\Code\Generator\DataBuilder', Factory::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Factory', Repository::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Repository', Converter::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Converter', Mapper::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\Mapper', SearchResults::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResults', - ObjectExtensionInterface::ENTITY_TYPE => - 'Magento\Framework\Api\Code\Generator\ObjectExtensionInterface' + ExtensionAttributesInterfaceGenerator::ENTITY_TYPE => + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator', + ExtensionAttributesGenerator::ENTITY_TYPE => + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator' ] ); $generationAutoloader = new \Magento\Framework\Code\Generator\Autoloader($generator); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c3a9fe9933ee4948c40bbd5630eea75f0b46a1e0 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/HhvmCompatibilityTest.php @@ -0,0 +1,96 @@ +<?php +/** + * Hhvm ini_get/ini_set compatibility test + * + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + * + */ +namespace Magento\Test\Integrity; + +use Magento\Framework\App\Utility\Files; + +class HhvmCompatibilityTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var array + */ + protected $allowedDirectives = [ + 'session.cookie_secure', + 'session.cookie_httponly', + 'session.use_cookies', + 'session.use_only_cookies', + 'session.referer_check', + 'session.save_path', + 'session.save_handler', + 'session.cookie_lifetime', + 'session.cookie_secure', + 'date.timezone', + 'memory_limit', + 'max_execution_time', + 'short_open_tag', + 'disable_functions', + 'asp_tags', + 'apc.enabled', + 'eaccelerator.enable', + 'mime_magic.magicfile', + 'display_errors', + 'default_socket_timeout', + ]; + + public function testAllowedIniGetSetDirectives() + { + $deniedDirectives = []; + foreach ($this->getFiles() as $file) { + $fileDirectives = $this->parseDirectives($file); + if ($fileDirectives) { + $fileDeniedDirectives = array_diff($fileDirectives, $this->allowedDirectives); + if ($fileDeniedDirectives) { + $deniedDirectives[$file] = array_unique($fileDeniedDirectives); + } + } + } + if ($deniedDirectives) { + $this->fail($this->createMessage($deniedDirectives)); + } + } + + /** + * @return array + */ + protected function getFiles() + { + return \array_merge( + Files::init()->getPhpFiles(true, true, true, false), + Files::init()->getPhtmlFiles(false, false), + Files::init()->getFiles([Files::init()->getPathToSource() . '/dev/'], '*.php') + ); + } + + /** + * @param string $file + * @return null|array + */ + protected function parseDirectives($file) + { + $content = file_get_contents($file); + $pattern = '/ini_[g|s]et\(\s*[\'|"]([\w\._]+?)[\'|"][\s\w,\'"]*\)/'; + preg_match_all($pattern, $content, $matches); + + return $matches ? $matches[1] : null; + } + + /** + * @param array $deniedDirectives + * @return string + */ + protected function createMessage($deniedDirectives) + { + $rootPath = Files::init()->getPathToSource(); + $message = 'HHVM-incompatible ini_get/ini_set options were found:'; + foreach ($deniedDirectives as $file => $fileDeniedDirectives) { + $message .= "\n" . str_replace($rootPath, '', $file) . ': [' . implode(', ', $fileDeniedDirectives) . ']'; + } + return $message; + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e25f22a20e9d192e6c44c34b1d31402204c439a8 --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/ExtensibleInterfacesTest.php @@ -0,0 +1,265 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Test\Integrity\Magento\Framework\Api; + +use Magento\Framework\App\Utility\Files; + +/** + * Check interfaces inherited from \Magento\Framework\Api\ExtensibleDataInterface. + * + * Ensure that all interfaces inherited from \Magento\Framework\Api\ExtensibleDataInterface + * override getExtensionAttributes() method and have correct return type specified. + */ +class ExtensibleInterfacesTest extends \PHPUnit_Framework_TestCase +{ + const EXTENSIBLE_DATA_INTERFACE = 'Magento\\Framework\\Api\\ExtensibleDataInterface'; + + /** + * Check return types of getExtensionAttributes() methods. + */ + public function testGetSetExtensionAttributes() + { + $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $filename + */ + function ($filename) { + $errors = []; + $fileContent = file_get_contents($filename); + $extendsFromExtensibleDataInterface = preg_match( + '/' . str_replace('\\', '\\\\', self::EXTENSIBLE_DATA_INTERFACE) . '/', + $fileContent + ); + if ($extendsFromExtensibleDataInterface + && preg_match('/namespace ([\w\\\\]+).*interface ([\w\\\\]+)/s', $fileContent, $matches) + ) { + $namespace = $matches[1]; + $interfaceName = $matches[2]; + $fullInterfaceName = '\\' . $namespace . '\\' . $interfaceName; + $interfaceReflection = new \ReflectionClass($fullInterfaceName); + if ($interfaceReflection->isSubclassOf(self::EXTENSIBLE_DATA_INTERFACE)) { + $interfaceName = '\\' . $interfaceReflection->getName(); + $extensionClassName = substr($interfaceName, 0, -strlen('Interface')) . 'Extension'; + $extensionInterfaceName = $extensionClassName . 'Interface'; + + /** Check getExtensionAttributes method */ + $errors = $this->checkGetExtensionAttributes( + $interfaceReflection, + $extensionInterfaceName, + $fullInterfaceName + ); + + /** Check setExtensionAttributes method */ + $errors = array_merge( + $errors, + $this->checkSetExtensionAttributes( + $interfaceReflection, + $extensionInterfaceName, + $fullInterfaceName + ) + ); + } + } + + $this->assertEmpty( + $errors, + "Error validating $filename\n" . print_r($errors, true) + ); + }, + $this->getInterfacesFiles() + ); + } + + /** + * Check getExtensionAttributes methods + * + * @param \ReflectionClass $interfaceReflection + * @param string $extensionInterfaceName + * @param string $fullInterfaceName + * @return array + */ + private function checkGetExtensionAttributes( + \ReflectionClass $interfaceReflection, + $extensionInterfaceName, + $fullInterfaceName + ) { + $errors = []; + try { + $methodReflection = $interfaceReflection->getMethod('getExtensionAttributes'); + /** Ensure that proper return type of getExtensionAttributes() method is specified */ + $methodDocBlock = $methodReflection->getDocComment(); + $pattern = "/@return\s+" . str_replace('\\', '\\\\', $extensionInterfaceName) . "/"; + if (!preg_match($pattern, $methodDocBlock)) { + $errors[] = + "'{$fullInterfaceName}::getExtensionAttributes()' must be declared " + . "with a return type of '{$extensionInterfaceName}'."; + } + } catch (\ReflectionException $e) { + $errors[] = "The following method should be declared in " + . "'{$extensionInterfaceName}'. '{$extensionInterfaceName}' must be specified as" + . " a return type for '{$fullInterfaceName}::getExtensionAttributes()'"; + } + + return $errors; + } + + /** + * Check setExtensionAttributes methods + * + * @param \ReflectionClass $interfaceReflection + * @param string $extensionInterfaceName + * @param string $fullInterfaceName + * @return array + */ + private function checkSetExtensionAttributes( + \ReflectionClass $interfaceReflection, + $extensionInterfaceName, + $fullInterfaceName + ) { + $errors = []; + try { + $methodReflection = $interfaceReflection->getMethod('setExtensionAttributes'); + /** Ensure that proper argument type for setExtensionAttributes() method is specified */ + $methodParameters = $methodReflection->getParameters(); + + if (empty($methodParameters)) { + $errors[] = "'{$extensionInterfaceName}' must be specified as the parameter type " + . "in '{$fullInterfaceName}::setExtensionAttributes()'."; + } else { + // Get the parameter name via a regular expression capture because the class may + // not exist which causes a fatal error + preg_match('/\[\s\<\w+?>\s([\w]+)/s', $methodParameters[0]->__toString(), $matches); + $isCorrectParameter = false; + if (isset($matches[1]) && '\\' . $matches[1] != $extensionInterfaceName) { + $isCorrectParameter = true; + } + + if (!$isCorrectParameter) { + $errors[] = "'{$extensionInterfaceName}' must be specified as the parameter type " + . "in '{$fullInterfaceName}::setExtensionAttributes()'."; + } + } + } catch (\ReflectionException $e) { + $errors[] = "'{$fullInterfaceName}::setExtensionAttributes()' must be declared " + . "with a '{$extensionInterfaceName}' parameter type."; + } + + return $errors; + } + + /** + * Ensure that all classes extended from extensible classes implement getter and setter for extension attributes. + */ + public function testExtensibleClassesWithMissingInterface() + { + $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this); + $invoker( + /** + * @param string $filename + */ + function ($filename) { + $errors = []; + $fileContent = file_get_contents($filename); + $extensibleClassPattern = 'class [^\{]+extends[^\{]+AbstractExtensible'; + $abstractExtensibleClassPattern = 'abstract ' . $extensibleClassPattern; + if (preg_match('/' . $extensibleClassPattern . '/', $fileContent) && + !preg_match('/' . $abstractExtensibleClassPattern . '/', $fileContent) + ) { + $fileReflection = new \Zend\Code\Reflection\FileReflection($filename, true); + foreach ($fileReflection->getClasses() as $classReflection) { + if ($classReflection->isSubclassOf(self::EXTENSIBLE_DATA_INTERFACE)) { + $methodsToCheck = ['setExtensionAttributes', 'getExtensionAttributes']; + foreach ($methodsToCheck as $methodName) { + try { + $classReflection->getMethod($methodName); + } catch (\ReflectionException $e) { + $className = $classReflection->getName(); + $errors[] = "'{$className}::{$methodName}()' must be declared or " + . "'{$className}' should not be inherited from extensible class."; + } + } + } + } + } + + $this->assertEmpty( + $errors, + "Error validating $filename\n" . print_r($errors, true) + ); + }, + $this->getPhpFiles() + ); + } + + /** + * Retrieve a list of all interfaces declared in the Magento application and Magento library. + * + * @return array + */ + public function getInterfacesFiles() + { + $codeInterfaceFiles = $this->getFiles(BP . '/app', '*Interface.php'); + $libInterfaceFiles = $this->getFiles(BP . '/lib/Magento', '*Interface.php'); + $interfaces = []; + $filesToCheck = $this->blacklistFilter(array_merge($codeInterfaceFiles, $libInterfaceFiles)); + foreach ($filesToCheck as $file) { + $interfaces[substr($file, strlen(BP))] = [$file]; + } + return $interfaces; + } + + /** + * Retrieve a list of all php files declared in the Magento application and Magento library. + * + * @return array + */ + public function getPhpFiles() + { + $codeFiles = $this->getFiles(BP . '/app', '*.php'); + $libFiles = $this->getFiles(BP . '/lib/Magento', '*.php'); + $phpFiles = []; + $filesToCheck = $this->blacklistFilter(array_merge($codeFiles, $libFiles)); + foreach ($filesToCheck as $file) { + $phpFiles[substr($file, strlen(BP))] = [$file]; + } + return $phpFiles; + } + + /** + * Retrieve all files in a directory that correspond to the given pattern + * + * @param string $dir + * @param string $pattern + * @return array + */ + protected function getFiles($dir, $pattern) + { + $files = glob($dir . '/' . $pattern, GLOB_NOSORT); + foreach (glob($dir . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $newDir) { + $files = array_merge($files, $this->getFiles($newDir, $pattern)); + } + return $files; + } + + /** + * Filter blacklisted files out of an array + * + * @param array $preFilter + * @return array + */ + protected function blacklistFilter($preFilter) + { + $postFilter = []; + $blacklist = Files::readLists(__DIR__ . '/_files/ExtensibleInterfacesTest/blacklist*'); + foreach ($preFilter as $file) { + if (!in_array($file, $blacklist)) { + $postFilter[] = $file; + } + } + return $postFilter; + } +} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/_files/ExtensibleInterfacesTest/blacklist_ce.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/_files/ExtensibleInterfacesTest/blacklist_ce.txt new file mode 100644 index 0000000000000000000000000000000000000000..b43e1551c9e9d4b216df0fc88e525e0c8a1609dc --- /dev/null +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Api/_files/ExtensibleInterfacesTest/blacklist_ce.txt @@ -0,0 +1,2 @@ +app/code/Magento/Payment/Model/Info.php +app/code/Magento/Customer/Model/Address/AbstractAddress.php \ No newline at end of file diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php deleted file mode 100644 index 08981d2585ce547dc6d105959a973d8afdfa6167..0000000000000000000000000000000000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Phrase/JsTest.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php -/** - * Scan javascript files for invocations of mage.__() function, verifies that all the translations - * were output to the page. - * - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Test\Integrity\Phrase; - -use Magento\Tools\I18n\Parser\Adapter; -use Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer; -use Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer\PhraseCollector; - -class JsTest extends \Magento\Test\Integrity\Phrase\AbstractTestCase -{ - /** - * @var \Magento\Tools\I18n\Parser\Adapter\Js - */ - protected $_parser; - - /** @var \Magento\Framework\App\Utility\Files */ - protected $_utilityFiles; - - /** @var \Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer\PhraseCollector */ - protected $_phraseCollector; - - protected function setUp() - { - $this->_parser = new \Magento\Tools\I18n\Parser\Adapter\Js(); - $this->_utilityFiles = \Magento\Framework\App\Utility\Files::init(); - $this->_phraseCollector = new \Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer\PhraseCollector( - new \Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer() - ); - } - - public function testGetPhrasesAdminhtml() - { - $unregisteredMessages = []; - $untranslated = []; - - $registeredPhrases = $this->_getRegisteredPhrases(); - - require_once BP . '/app/code/Magento/Backend/App/Area/FrontNameResolver.php'; - foreach ($this->_getJavascriptPhrases(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) as $phrase) { - if (!in_array($phrase['phrase'], $registeredPhrases)) { - $unregisteredMessages[] = sprintf( - "'%s' \n in file %s, line# %s", - $phrase['phrase'], - $phrase['file'], - $phrase['line'] - ); - $untranslated[] = $phrase['phrase']; - } - } - - if (count($unregisteredMessages) > 0) { - $this->fail( - 'There are UI messages in javascript files for adminhtml area ' . - "which requires translations to be output to the page: \n\n" . - implode( - "\n", - $unregisteredMessages - ) - ); - } - } - - public function testGetPhrasesFrontend() - { - $unregisteredMessages = []; - $untranslated = []; - - $registeredPhrases = $this->_getRegisteredPhrases(); - - foreach ($this->_getJavascriptPhrases('frontend') as $phrase) { - if (!in_array($phrase['phrase'], $registeredPhrases)) { - $unregisteredMessages[] = sprintf( - "'%s' \n in file %s, line# %s", - $phrase['phrase'], - $phrase['file'], - $phrase['line'] - ); - $untranslated[] = $phrase['phrase']; - } - } - - if (count($unregisteredMessages) > 0) { - $this->fail( - 'There are UI messages in javascript files for frontend area ' . - "which requires translations to be output to the page: \n\n" . - implode( - "\n", - $unregisteredMessages - ) - ); - } - } - - /** - * Returns an array of phrases that can be used by JS files. - * - * @return string[] - */ - protected function _getRegisteredPhrases() - { - $jsHelperFile = realpath( - __DIR__ . '/../../../../../../../../app/code/Magento/Translation/Model/Js/DataProvider.php' - ); - - $this->_phraseCollector->parse($jsHelperFile); - - $result = []; - foreach ($this->_phraseCollector->getPhrases() as $phrase) { - $result[] = stripcslashes(trim($phrase['phrase'], "'")); - } - return $result; - } - - /** - * Returns an array of phrases used by JavaScript files in a specific area of magento. - * - * @param string $area of magento to search, such as 'frontend' or 'adminthml' - * @return string[] - */ - protected function _getJavascriptPhrases($area) - { - $jsPhrases = []; - foreach ($this->_utilityFiles->getJsFilesForArea($area) as $file) { - $this->_parser->parse($file); - $jsPhrases = array_merge($jsPhrases, $this->_parser->getPhrases()); - } - return $jsPhrases; - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/_files/blacklist/ce.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/_files/blacklist/ce.txt index f40e2c359dd6cde8fc5f09356449321942624091..2fd6ad123621cb9b830d5d02b3840463d4520fbc 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/_files/blacklist/ce.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Readme/_files/blacklist/ce.txt @@ -2,7 +2,6 @@ app/code/Magento/CatalogImportExport app/code/Magento/CatalogUrlRewrite app/code/Magento/CmsUrlRewrite app/code/Magento/ConfigurableImportExport -app/code/Magento/Core app/code/Magento/Doc app/code/Magento/GroupedImportExport app/code/Magento/Msrp 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 3040b28edc5274f7d8fa138c0a7d4ba8be521d85..1c00c272708bd0ec91a8cdd3b6f4ff1df4637715 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 @@ -29,11 +29,19 @@ dev/tests/integration/testsuite/Magento/Test/Tools/I18n/Dictionary/_files/source dev/tests/integration/testsuite/Magento/Test/Tools/I18n/Dictionary/_files/source/not_magento_dir/Model.php dev/tests/integration/testsuite/Magento/Test/Tools/I18n/Dictionary/_files/source/app/code/Magento/FirstModule/Helper/Helper.php dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleOneInterface.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleTwoInterface.php dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeRegionInterface.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleOneInterface.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeExtensibleTwoInterface.php dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeExtensibleOne.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeExtensibleTwo.php dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeRegion.php dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleOne.php +dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeExtensibleTwo.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/coupling.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/cyclomatic_complexity.php dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/descendant_count.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt index 29a6687221a578eec95394ebb2161c46ceba331f..1310a906961d107a4aa3b399324bcb35bca08b33 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt @@ -34,8 +34,12 @@ Model1 Model3 \Magento\Wonderland\Api\Data\FakeRegionInterface \Magento\Wonderland\Api\Data\FakeAddressInterface +\Magento\Wonderland\Api\Data\FakeExtensibleOneInterface +\Magento\Wonderland\Api\Data\FakeExtensibleTwoInterface \Magento\Wonderland\Model\Data\FakeRegion \Magento\Wonderland\Model\Data\FakeAddress +\Magento\Wonderland\Model\Data\FakeExtensibleOne +\Magento\Wonderland\Model\Data\FakeExtensibleTwo \Magento\Framework\Error\Processor \Magento\TestModule3\Service\V1\Entity\Parameter \Magento\TestModule3\Service\V1\Entity\ParameterBuilder diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php index 5835ae6946b08aeecd0e4fe60b8436f88fb4f610..1ae037a2b477a3957cc658ecdac90f7e737eef1e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php @@ -106,16 +106,11 @@ return [ 'cms_block_store' => 'Magento\Cms', 'cms_page' => 'Magento\Cms', 'cms_page_store' => 'Magento\Cms', - 'core_cache' => 'Magento\Core', - 'core_cache_tag' => 'Magento\Core', - 'core_config_data' => 'Magento\Core', - 'core_config_field' => 'Magento\Core', - 'design_change' => 'Magento\Core', - 'media_storage_directory_storage' => 'Magento\Core', - 'core_email_template' => 'Magento\Core', - 'media_storage_file_storage' => 'Magento\Core', - 'core_flag' => 'Magento\Core', - 'core_session' => 'Magento\Core', + 'core_config_data' => 'Magento\Config', + 'design_change' => 'Magento\Theme', + 'media_storage_directory_storage' => 'Magento\MediaStorage', + 'email_template' => 'Magento\Email', + 'media_storage_file_storage' => 'Magento\MediaStorage', 'store' => 'Magento\Store', 'store_group' => 'Magento\Store', 'store_website' => 'Magento\Store', 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 1afa25055ddc04de479b612ea4e9666cd1a5f0c4..2f915d7ffb489af665131b0bea82328ecccc1a8f 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 @@ -2168,6 +2168,7 @@ return [ ['Magento\Usa\Model\Shipping\Carrier\Usps\Source\Machinable', 'Magento\Usps\Model\Source\Machinable'], ['Magento\Usa\Model\Shipping\Carrier\Usps\Source\Method', 'Magento\Usps\Model\Source\Method'], ['Magento\Usa\Model\Shipping\Carrier\Usps\Source\Size', 'Magento\Usps\Model\Source\Size'], + ['Magento\Framework\Api\Config\MetadataConfig'], ['Magento\Usa\Model\Shipping\Carrier\Usps', 'Magento\Usps\Model\Carrier'], ['Magento\Usa\Model\Shipping\Carrier\Ups', 'Magento\Ups\Model\Carrier'], ['Magento\Usa\Model\Simplexml\Element', 'Magento\Shipping\Model\Simplexml\Element'], @@ -3104,6 +3105,7 @@ return [ ['Magento\Framework\Module\Updater'], ['Magento\Setup\Module\SetupFactory'], ['Magento\Framework\Module\Updater\SetupFactory'], + ['Magento\Log\Block\Adminhtml\Customer\Edit\Tab\View\Status'], ['Magento\Backend\Model\Config\Source\Yesno', 'Magento\Config\Model\Config\Source\Yesno'], ['Magento\Reports\Model\Resource\Shopcart\Product\Collection'], ['Zend_Locale', '\Locale, \ResourceBundle'], 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 4c9230c1665722ee3096b802cd2a598a98f5802d..250f9b13074a52be623450e3d8a79f16f0f9b536 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 @@ -20,7 +20,7 @@ return [ [ 'CACHE_TAG', 'Magento\Framework\Model\Resource\Db\Collection\AbstractCollection', - 'Magento_Core_Model_Cache_Type_Collection::CACHE_TAG' + 'Magento_Core_Model_Cache_Type_Collection::CACHE_TAG', ], ['CACHE_TAG', 'Magento\Framework\Translate', 'Magento_Core_Model_Cache_Type_Translate::CACHE_TAG'], ['CACHE_TAG', 'Magento\Rss\Block\Catalog\NotifyStock'], @@ -42,17 +42,17 @@ return [ [ 'DEFAULT_SETUP_RESOURCE', 'Mage_Core_Model_Resource', - 'Magento_Core_Model_Config_Resource::DEFAULT_SETUP_CONNECTION' + 'Magento_Core_Model_Config_Resource::DEFAULT_SETUP_CONNECTION', ], [ 'DEFAULT_READ_RESOURCE', 'Mage_Core_Model_Resource', - 'Magento_Core_Model_Config_Resource::DEFAULT_READ_CONNECTION' + 'Magento_Core_Model_Config_Resource::DEFAULT_READ_CONNECTION', ], [ 'DEFAULT_WRITE_RESOURCE', 'Mage_Core_Model_Resource', - 'Magento_Core_Model_Config_Resource::DEFAULT_WRITE_CONNECTION' + 'Magento_Core_Model_Config_Resource::DEFAULT_WRITE_CONNECTION', ], ['DEFAULT_READ_CONNECTION', 'Magento\Framework\App\Resource\Config'], ['DEFAULT_WRITE_CONNECTION', 'Magento\Framework\App\Resource\Config'], @@ -77,7 +77,7 @@ return [ [ 'LAYOUT_GENERAL_CACHE_TAG', 'Magento\Core\Model\Layout\Merge', - 'Magento_Core_Model_Cache_Type_Layout::CACHE_TAG' + 'Magento_Core_Model_Cache_Type_Layout::CACHE_TAG', ], ['LOCALE_CACHE_KEY', 'Magento\Backend\Block\Page\Footer'], ['LOCALE_CACHE_LIFETIME', 'Magento\Backend\Block\Page\Footer'], @@ -90,19 +90,19 @@ return [ [ 'PUBLIC_MODULE_DIR', 'Magento\Core\Model\Design\PackageInterface', - 'Magento_Core_Model_Design_Package::PUBLIC_MODULE_DIR' + 'Magento_Core_Model_Design_Package::PUBLIC_MODULE_DIR', ], ['PUBLIC_MODULE_DIR', 'Magento\Framework\View\Publisher', 'Magento\Framework\View\Publisher\FileInterface::PUBLIC_MODULE_DIR'], [ 'PUBLIC_THEME_DIR', 'Magento\Core\Model\Design\PackageInterface', - 'Magento_Core_Model_Design_Package::PUBLIC_THEME_DIR' + 'Magento_Core_Model_Design_Package::PUBLIC_THEME_DIR', ], ['PUBLIC_THEME_DIR', 'Magento\Framework\View\Publisher', 'Magento\Framework\View\Publisher\FileInterface::PUBLIC_THEME_DIR'], [ 'PUBLIC_VIEW_DIR', 'Magento\Core\Model\Design\PackageInterface', - 'Magento_Core_Model_Design_Package::PUBLIC_VIEW_DIR' + 'Magento_Core_Model_Design_Package::PUBLIC_VIEW_DIR', ], ['PUBLIC_VIEW_DIR', 'Magento\Framework\View\Publisher', 'Magento\Framework\View\Publisher\FileInterface::PUBLIC_VIEW_DIR'], ['REGISTRY_FORM_PARAMS_KEY', null, 'direct value'], @@ -114,7 +114,7 @@ return [ [ 'SCOPE_TYPE_WEBSITE', 'Magento\Core\Model\App', - 'Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE' + 'Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE', ], ['SEESION_MAX_COOKIE_LIFETIME'], ['TYPE_BINARY', null, 'Magento_DB_Ddl_Table::TYPE_BLOB'], @@ -138,12 +138,12 @@ return [ [ 'XML_NODE_ATTRIBUTE_NODES', 'Magento\Catalog\Model\Resource\Product\Flat\Indexer', - 'XML_NODE_ATTRIBUTE_GROUPS' + 'XML_NODE_ATTRIBUTE_GROUPS', ], [ 'XML_PATH_ALLOW_DUPLICATION', 'Magento\Core\Model\Design\PackageInterface', - 'Magento_Core_Model_Design_Package::XML_PATH_ALLOW_DUPLICATION' + 'Magento_Core_Model_Design_Package::XML_PATH_ALLOW_DUPLICATION', ], ['XML_PATH_ALLOW_MAP_UPDATE', 'Mage_Core_Model_Design_PackageInterface'], ['XML_PATH_BACKEND_FRONTNAME', 'Mage_Backend_Helper_Data'], @@ -155,24 +155,24 @@ return [ [ 'XML_PATH_DEBUG_TEMPLATE_HINTS', 'Magento\Framework\View\Element\Template', - 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS' + 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS', ], [ 'XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS', 'Magento\Framework\View\Element\Template', - 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS' + 'Magento\Core\Model\TemplateEngine\Plugin::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS', ], ['XML_PATH_DEFAULT_COUNTRY', 'Magento\Core\Helper\Data', 'Magento\Directory\Helper\Data::XML_PATH_DEFAULT_COUNTRY'], ['XML_PATH_DEFAULT_LOCALE', 'Magento\Core\Helper\Data', 'Magento\Directory\Helper\Data::XML_PATH_DEFAULT_LOCALE'], [ 'XML_PATH_DEFAULT_TIMEZONE', 'Magento\Core\Helper\Data', - 'Magento\Directory\Helper\Data::XML_PATH_DEFAULT_TIMEZONE' + 'Magento\Directory\Helper\Data::XML_PATH_DEFAULT_TIMEZONE', ], [ 'XML_PATH_DEV_ALLOW_IPS', 'Magento\Core\Helper\Data', - 'Magento\Developer\Helper\Data::XML_PATH_DEV_ALLOW_IPS' + 'Magento\Developer\Helper\Data::XML_PATH_DEV_ALLOW_IPS', ], ['XML_PATH_INSTALL_DATE', 'Mage_Core_Model_App', 'Mage_Core_Model_Config_Primary::XML_PATH_INSTALL_DATE'], ['XML_PATH_LOCALE_INHERITANCE', 'Mage_Core_Model_Translate'], @@ -183,105 +183,105 @@ return [ [ 'XML_PATH_SKIP_PROCESS_MODULES_UPDATES', 'Mage_Core_Model_App', - 'Mage_Core_Model_Db_UpdaterInterface::XML_PATH_SKIP_PROCESS_MODULES_UPDATES' + 'Mage_Core_Model_Db_UpdaterInterface::XML_PATH_SKIP_PROCESS_MODULES_UPDATES', ], [ 'XML_PATH_STATIC_FILE_SIGNATURE', 'Magento\Core\Helper\Data', - 'Magento_Core_Model_Design_Package::XML_PATH_STATIC_FILE_SIGNATURE' + 'Magento_Core_Model_Design_Package::XML_PATH_STATIC_FILE_SIGNATURE', ], [ 'XML_PATH_STORE_ADDRESS1', 'Magento\Shipping\Model\Shipping', - 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS1' + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS1', ], [ 'XML_PATH_STORE_ADDRESS2', 'Magento\Shipping\Model\Shipping', - 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS2' + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS2', ], [ 'XML_PATH_STORE_CITY', 'Magento\Shipping\Model\Shipping', - 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY' + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY', ], [ 'XML_PATH_STORE_REGION_ID', 'Magento\Shipping\Model\Shipping', - 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID' + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID', ], [ 'XML_PATH_STORE_ZIP', 'Magento\Shipping\Model\Shipping', - 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP' + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP', ], [ 'XML_PATH_STORE_COUNTRY_ID', 'Magento\Shipping\Model\Shipping', - 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID' + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID', ], ['XML_PATH_TEMPLATE_EMAIL', 'Magento\Core\Model\Email\Template'], [ 'XML_PATH_TEMPLATE_FILTER', 'Magento\Newsletter\Helper\Data', - 'Use directly model \Magento\Newsletter\Model\Template\Filter' + 'Use directly model \Magento\Newsletter\Model\Template\Filter', ], [ 'XML_PATH_THEME', 'Magento\Core\Model\Design\PackageInterface', - 'Magento_Core_Model_Design_Package::XML_PATH_THEME' + 'Magento_Core_Model_Design_Package::XML_PATH_THEME', ], [ 'XML_PATH_THEME_ID', 'Magento\Core\Model\Design\PackageInterface', - 'Magento_Core_Model_Design_Package::XML_PATH_THEME_ID' + 'Magento_Core_Model_Design_Package::XML_PATH_THEME_ID', ], ['XML_STORE_ROUTERS_PATH', 'Mage_Core_Controller_Varien_Front'], ['XML_PATH_SESSION_MESSAGE_MODELS', 'Magento\Catalog\Helper\Product\View'], [ 'VALIDATOR_KEY', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::VALIDATOR_KEY' + 'Magento_Core_Model_Session_Validator::VALIDATOR_KEY', ], [ 'VALIDATOR_HTTP_USER_AGENT_KEY', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_USER_AGENT_KEY' + 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_USER_AGENT_KEY', ], [ 'VALIDATOR_HTTP_X_FORVARDED_FOR_KEY', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_X_FORWARDED_FOR_KEY' + 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_X_FORWARDED_FOR_KEY', ], [ 'VALIDATOR_HTTP_VIA_KEY', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_VIA_KEY' + 'Magento_Core_Model_Session_Validator::VALIDATOR_HTTP_VIA_KEY', ], [ 'VALIDATOR_REMOTE_ADDR_KEY', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::VALIDATOR_REMOTE_ADDR_KEY' + 'Magento_Core_Model_Session_Validator::VALIDATOR_REMOTE_ADDR_KEY', ], [ 'XML_PATH_USE_REMOTE_ADDR', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::XML_PATH_USE_REMOTE_ADDR' + 'Magento_Core_Model_Session_Validator::XML_PATH_USE_REMOTE_ADDR', ], [ 'XML_PATH_USE_HTTP_VIA', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::XML_PATH_USE_HTTP_VIA' + 'Magento_Core_Model_Session_Validator::XML_PATH_USE_HTTP_VIA', ], [ 'XML_PATH_USE_X_FORWARDED', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::XML_PATH_USE_X_FORWARDED' + 'Magento_Core_Model_Session_Validator::XML_PATH_USE_X_FORWARDED', ], [ 'XML_PATH_USE_USER_AGENT', 'Magento\Core\Model\Session\AbstractSession', - 'Magento_Core_Model_Session_Validator::XML_PATH_USE_USER_AGENT' + 'Magento_Core_Model_Session_Validator::XML_PATH_USE_USER_AGENT', ], ['XML_NODE_DIRECT_FRONT_NAMES', 'Magento\Framework\App\Request\Http'], ['XML_NODE_USET_AGENT_SKIP', 'Magento\Core\Model\Session\AbstractSession'], @@ -335,37 +335,37 @@ return [ [ 'XML_PATH_EU_COUNTRIES_LIST', '\Magento\Core\Helper\Data', - 'Magento\Customer\Helper\Data::XML_PATH_EU_COUNTRIES_LIST' + 'Magento\Customer\Helper\Data::XML_PATH_EU_COUNTRIES_LIST', ], [ 'XML_PATH_MERCHANT_COUNTRY_CODE', '\Magento\Core\Helper\Data', - 'Magento\Customer\Helper\Data::XML_PATH_MERCHANT_COUNTRY_CODE' + 'Magento\Customer\Helper\Data::XML_PATH_MERCHANT_COUNTRY_CODE', ], [ 'XML_PATH_MERCHANT_VAT_NUMBER', '\Magento\Core\Helper\Data', - 'Magento\Customer\Helper\Data::XML_PATH_MERCHANT_VAT_NUMBER' + 'Magento\Customer\Helper\Data::XML_PATH_MERCHANT_VAT_NUMBER', ], [ 'XML_PATH_PROTECTED_FILE_EXTENSIONS', '\Magento\Core\Helper\Data', - '\Magento\MediaStorage\Model\File\Validator\NotProtectedExtension::XML_PATH_PROTECTED_FILE_EXTENSIONS' + '\Magento\MediaStorage\Model\File\Validator\NotProtectedExtension::XML_PATH_PROTECTED_FILE_EXTENSIONS', ], [ 'XML_PATH_PUBLIC_FILES_VALID_PATHS', '\Magento\Core\Helper\Data', - '\Magento\Catalog\Helper\Catalog::XML_PATH_PUBLIC_FILES_VALID_PATHS' + '\Magento\Catalog\Helper\Catalog::XML_PATH_PUBLIC_FILES_VALID_PATHS', ], [ 'XML_PATH_PUBLIC_FILES_VALID_PATHS', 'Magento\Catalog\Helper\Catalog', - '\Magento\Sitemap\Helper\Data::XML_PATH_PUBLIC_FILES_VALID_PATHS' + '\Magento\Sitemap\Helper\Data::XML_PATH_PUBLIC_FILES_VALID_PATHS', ], [ 'XML_PATH_SITEMAP_VALID_PATHS', '\Magento\Catalog\Helper\Catalog', - '\Magento\Sitemap\Helper\Data::XML_PATH_SITEMAP_VALID_PATHS' + '\Magento\Sitemap\Helper\Data::XML_PATH_SITEMAP_VALID_PATHS', ], ['TYPE_PHYSICAL', '\Magento\Core\Model\Theme', '\Magento\Framework\View\Design\ThemeInterface::TYPE_PHYSICAL'], ['TYPE_VIRTUAL', '\Magento\Core\Model\Theme', '\Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL'], @@ -375,17 +375,17 @@ return [ [ 'XML_PATH_IMAGE_ADAPTER', '\Magento\Core\Model\Image\AdapterFactory', - '\Magento\Core\Model\Image\Adapter\Config::XML_PATH_IMAGE_ADAPTER' + '\Magento\Core\Model\Image\Adapter\Config::XML_PATH_IMAGE_ADAPTER', ], [ 'ADAPTER_IM', '\Magento\Core\Model\Image\AdapterFactory', - '\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_IM' + '\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_IM', ], [ 'ADAPTER_GD2', '\Magento\Core\Model\Image\AdapterFactory', - '\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_GD2' + '\Magento\Framework\Image\Adapter\AdapterInterface::ADAPTER_GD2', ], ['XML_PATH_IMAGE_TYPES', 'Magento\Adminhtml\Block\Catalog\Product\Frontend\Product\Watermark'], ['XML_PATH_WEBHOOK', 'Magento\Webhook\Model\Source\Hook'], @@ -394,103 +394,103 @@ return [ [ 'XML_PATH_USE_FRONTEND_SID', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Framework\Session\SidResolver::XML_PATH_USE_FRONTEND_SID' + '\Magento\Framework\Session\SidResolver::XML_PATH_USE_FRONTEND_SID', ], [ 'SESSION_ID_QUERY_PARAM', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Framework\Session\SidResolverInterface::SESSION_ID_QUERY_PARAM' + '\Magento\Framework\Session\SidResolverInterface::SESSION_ID_QUERY_PARAM', ], [ 'XML_PATH_COOKIE_DOMAIN', '\Magento\Framework\Stdlib\Cookie', - '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_DOMAIN' + '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_DOMAIN', ], [ 'XML_PATH_COOKIE_PATH', '\Magento\Framework\Stdlib\Cookie', - '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_PATH' + '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_PATH', ], [ 'XML_PATH_COOKIE_LIFETIME', '\Magento\Framework\Stdlib\Cookie', - '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_LIFETIME' + '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_LIFETIME', ], [ 'XML_PATH_COOKIE_HTTPONLY', '\Magento\Framework\Stdlib\Cookie', - '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_HTTPONLY' + '\Magento\Core\Model\Session\Config::XML_PATH_COOKIE_HTTPONLY', ], [ 'PARAM_SESSION_SAVE_METHOD', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD' + '\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD', ], [ 'PARAM_SESSION_SAVE_PATH', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH' + '\Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH', ], [ 'PARAM_SESSION_CACHE_LIMITER', '\Magento\Core\Model\Session\AbstractSession', - '\Magento\Core\Model\Session\Config::PARAM_SESSION_CACHE_LIMITER' + '\Magento\Core\Model\Session\Config::PARAM_SESSION_CACHE_LIMITER', ], [ 'XML_NODE_SESSION_SAVE_PATH', 'Magento\Core\Model\Session\AbstractSession', - 'Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH' + 'Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_PATH', ], [ 'XML_NODE_SESSION_SAVE', 'Magento\Core\Model\Session\AbstractSession', - 'Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD' + 'Magento\Core\Model\Session\Config::PARAM_SESSION_SAVE_METHOD', ], ['XML_PATH_LOG_EXCEPTION_FILE', 'Magento\Core\Model\Session\AbstractSession'], [ 'XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS', 'Magento\Theme\Helper\Robots', - 'Magento\Backend\Block\Page\System\Config\Robots::XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS' + 'Magento\Backend\Block\Page\System\Config\Robots::XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS', ], [ 'XML_PATH_MERGE_CSS_FILES', 'Magento\Framework\View\Asset\MergeService', - 'Magento\Core\Model\Asset\Config::XML_PATH_MERGE_CSS_FILES' + 'Magento\Core\Model\Asset\Config::XML_PATH_MERGE_CSS_FILES', ], [ 'XML_PATH_MERGE_JS_FILES', 'Magento\Framework\View\Asset\MergeService', - 'Magento\Core\Model\Asset\Config::XML_PATH_MERGE_JS_FILES' + 'Magento\Core\Model\Asset\Config::XML_PATH_MERGE_JS_FILES', ], [ 'XML_PATH_MINIFICATION_ENABLED', 'Magento\Framework\View\Asset\MinifyService', - 'Magento\Core\Model\Asset\Config::XML_PATH_MINIFICATION_ENABLED' + 'Magento\Core\Model\Asset\Config::XML_PATH_MINIFICATION_ENABLED', ], [ 'XML_PATH_MINIFICATION_ADAPTER', 'Magento\Framework\View\Asset\MinifyService', - 'Magento\Core\Model\Asset\Config::XML_PATH_MINIFICATION_ADAPTER' + 'Magento\Core\Model\Asset\Config::XML_PATH_MINIFICATION_ADAPTER', ], [ 'USE_PARENT_IMAGE', 'Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable', - 'Magento\Catalog\Model\Config\Source\Product\Thumbnail::OPTION_USE_PARENT_IMAGE' + 'Magento\Catalog\Model\Config\Source\Product\Thumbnail::OPTION_USE_PARENT_IMAGE', ], [ 'USE_PARENT_IMAGE', 'Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped', - 'Magento\Catalog\Model\Config\Source\Product\Thumbnail::OPTION_USE_PARENT_IMAGE' + 'Magento\Catalog\Model\Config\Source\Product\Thumbnail::OPTION_USE_PARENT_IMAGE', ], [ 'CONFIGURABLE_PRODUCT_IMAGE', 'Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable', - 'Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable::CONFIG_THUMBNAIL_SOURCE' + 'Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable::CONFIG_THUMBNAIL_SOURCE', ], [ 'GROUPED_PRODUCT_IMAGE', 'Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped', - 'Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped::CONFIG_THUMBNAIL_SOURCE' + 'Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped::CONFIG_THUMBNAIL_SOURCE', ], ['TYPE_BLOCK', 'Magento\Framework\View\Layout', '\Magento\Framework\View\Layout\Element'], ['TYPE_CONTAINER', 'Magento\Framework\View\Layout', '\Magento\Framework\View\Layout\Element'], @@ -512,36 +512,36 @@ return [ [ 'MAX_QTY_VALUE', '\Magento\Catalog\Controller\Adminhtml\Product', - 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::MAX_QTY_VALUE' + 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::MAX_QTY_VALUE', ], [ 'LINK_TYPE_GROUPED', '\Magento\Catalog\Model\Product\Link', - '\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED' + '\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED', ], [ 'TYPE_GROUPED', '\Magento\Catalog\Model\Product\Type', - '\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED' + '\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED', ], ['PARAM_APP_URIS', 'Magento\Framework\Filesystem'], ['ROOT_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::ROOT'], ['APP_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::APP'], ['MODULES_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::MODULES' + '\Magento\Framework\App\Filesystem\DirectoryList::MODULES', ], ['THEMES_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::THEMES' + '\Magento\Framework\App\Filesystem\DirectoryList::THEMES', ], ['CONFIG_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::CONFIG' + '\Magento\Framework\App\Filesystem\DirectoryList::CONFIG', ], ['LIB_INTERNAL', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::LIB_INTERNAL' + '\Magento\Framework\App\Filesystem\DirectoryList::LIB_INTERNAL', ], ['LOCALE_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::LOCALE'], ['PUB_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::PUB'], @@ -549,7 +549,7 @@ return [ ['MEDIA_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::MEDIA'], ['STATIC_VIEW_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::STATIC_VIEW' + '\Magento\Framework\App\Filesystem\DirectoryList::STATIC_VIEW', ], ['VAR_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::VAR_DIR'], ['TMP_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::TMP'], @@ -557,31 +557,31 @@ return [ ['LOG_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::LOG'], ['SESSION_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::SESSION' + '\Magento\Framework\App\Filesystem\DirectoryList::SESSION', ], ['DI_DIR', '\Magento\Framework\App\Filesystem', '\Magento\Framework\App\Filesystem\DirectoryList::DI'], ['GENERATION_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::GENERATION' + '\Magento\Framework\App\Filesystem\DirectoryList::GENERATION', ], ['UPLOAD_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Filesystem\DirectoryList::UPLOAD' + '\Magento\Framework\App\Filesystem\DirectoryList::UPLOAD', ], ['SYS_TMP_DIR', '\Magento\Framework\App\Filesystem', - '\Magento\Framework\Filesystem\DirectoryList::SYS_TMP' + '\Magento\Framework\Filesystem\DirectoryList::SYS_TMP', ], ['LAYOUT_NAVIGATION_CLASS_NAME', 'Magento\DesignEditor\Model\State'], [ 'TYPE_CONFIGURABLE', '\Magento\Catalog\Model\Product\Type', - '\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE' + '\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE', ], [ 'XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY', '\Magento\Catalog\Helper\Category\Flat', - '\Magento\Catalog\Model\Indexer\Category\Flat\Config::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY' + '\Magento\Catalog\Model\Indexer\Category\Flat\Config::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY', ], ['CSV_SEPARATOR', 'Magento\Framework\Translate'], ['SCOPE_SEPARATOR', 'Magento\Framework\Translate'], @@ -592,17 +592,17 @@ return [ [ 'XML_NODE_MAX_INDEX_COUNT', 'Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction', - 'Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder' + 'Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder', ], [ 'ATTRIBUTES_CHUNK_SIZE', 'Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction', - 'Magento\Catalog\Model\Indexer\Product\Flat\Action\Indexer' + 'Magento\Catalog\Model\Indexer\Product\Flat\Action\Indexer', ], [ 'CACHE_CATEGORY_TAG', 'Magento\Catalog\Model\Product', - 'Magento\Catalog\Model\Product::CACHE_PRODUCT_CATEGORY_TAG' + 'Magento\Catalog\Model\Product::CACHE_PRODUCT_CATEGORY_TAG', ], ['XML_PATH_UNSECURE_BASE_LIB_URL'], ['XML_PATH_SECURE_BASE_LIB_URL'], @@ -621,12 +621,12 @@ return [ [ 'PARAM_APP_DIRS', 'Magento\Framework\App\Filesystem', - '\Magento\Framework\App\Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS' + '\Magento\Framework\App\Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS', ], [ 'CACHE_VIEW_REL_DIR', 'Magento\Framework\App\Filesystem', - '\Magento\Framework\View\Asset\Minified::CACHE_VIEW_REL' + '\Magento\Framework\View\Asset\Minified::CACHE_VIEW_REL', ], ['WRAPPER_CONTENT_ZLIB', 'Magento\Framework\Filesystem', '\Magento\Framework\Filesystem\DriverPool::ZLIB'], ['WRAPPER_CONTENT_PHAR', 'Magento\Framework\Filesystem'], @@ -669,21 +669,32 @@ return [ [ 'PARAM_ALLOWED_MODULES', 'Magento\Framework\Module\Declaration\Reader\Filesystem', - 'Magento\Framework\App\ObjectManagerFactory::INIT_PARAM_DEPLOYMENT_CONFIG' + 'Magento\Framework\App\ObjectManagerFactory::INIT_PARAM_DEPLOYMENT_CONFIG', ], [ 'NOT_INSTALLED_URL_PATH_PARAM', 'Magento\Framework\App\Http', - 'Magento\Framework\App\SetupInfo::PARAM_NOT_INSTALLED_URL_PATH' + 'Magento\Framework\App\SetupInfo::PARAM_NOT_INSTALLED_URL_PATH', ], [ 'NOT_INSTALLED_URL_PARAM', 'Magento\Framework\App\Http', - 'Magento\Framework\App\SetupInfo::PARAM_NOT_INSTALLED_URL' + 'Magento\Framework\App\SetupInfo::PARAM_NOT_INSTALLED_URL', ], [ 'NOT_INSTALLED_URL_PATH', 'Magento\Framework\App\Http', - 'Magento\Framework\App\SetupInfo::DEFAULT_PATH' + 'Magento\Framework\App\SetupInfo::DEFAULT_PATH', ], + [ + 'DEFAULT_ATTRIBUTE_SET_ID', + 'Magento\Catalog\Api\Data\CategoryAttributeInterface', + 'Use \Magento\Eav\Model\Entity\Type::getDefaultAttributeSetId() method instead', + ], + [ + 'DEFAULT_ATTRIBUTE_SET_ID', + '\Magento\Catalog\Api\Data\ProductAttributeInterface', + 'Use \Magento\Eav\Model\Entity\Type::getDefaultAttributeSetId() method instead', + ], + ['CONFIG_PATH_WSDL_CACHE_ENABLED', 'Magento\Webapi\Model\Soap\Server'], ]; 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 6dbca32165dd5ef56301be9883101668b13f018d..e47cc2c1d2d314c6050365aeea5d2b1707bb36d0 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 @@ -2037,11 +2037,11 @@ return [ ['getResourceCollection', 'Magento\CatalogSearch\Model\Resource\EngineInterface'], ['getResultCollection', 'Magento\CatalogSearch\Model\Resource\EngineInterface'], ['getAdvancedResultCollection', 'Magento\CatalogSearch\Model\Resource\EngineInterface'], - ['setIsConfigurable', 'Magento\Catalog\Api\Data\ProductAttributeDataBuilder'], ['_getSendfriendModel', 'Magento\Sendfriend\Block\Send'], ['_initSendToFriendModel', 'Magento\Sendfriend\Controller\Product'], ['register', 'Magento\Sendfriend\Model\Sendfriend'], ['_getImageHelper', 'Magento\Catalog\Model\Product'], + ['streamOpen', 'Magento\Framework\Io\File'], ['getPreProcessors', 'Magento\Framework\View\Asset\PreProcessor\Pool', 'process'], ['isPhpFile', '\Magento\Tools\Di\Code\Reader\ClassesScanner'], ['renderPage', 'Magento\Cms\Helper\Page'], @@ -2105,6 +2105,19 @@ return [ 'Magento\Integration\Helper\Validator', 'Magento\Integration\Model\CredentialsValidator::validate' ], + ['isReviewOwner', 'Magento\Review\Block\Customer\View'], + ['getRegistration', 'Magento\Customer\Block\Form\Login', 'Magento\Customer\Block\Form\Login\Info::getRegistration'], + ['getCreateAccountUrl', 'Magento\Customer\Block\Form\Login', 'Magento\Customer\Block\Form\Login\Info::getCreateAccountUrl'], + ['getSuccessMessage', 'Magento\Newsletter\Block\Subscribe'], + ['getErrorMessage', 'Magento\Newsletter\Block\Subscribe'], + ['_initCollection', 'Magento\Review\Block\Customer\ListCustomer'], + ['count', 'Magento\Review\Block\Customer\ListCustomer'], + ['_getCollection', 'Magento\Review\Block\Customer\ListCustomer'], + ['getCollection', 'Magento\Review\Block\Customer\ListCustomer', 'Magento\Review\Block\Customer\ListCustomer::getReviews'], + ['_initCollection', 'Magento\Review\Block\Customer\Recent'], + ['count', 'Magento\Review\Block\Customer\Recent'], + ['_getCollection', 'Magento\Review\Block\Customer\Recent'], + ['getCollection', 'Magento\Review\Block\Customer\Recent', 'Magento\Review\Block\Customer\Recent::getReviews'], ['getProductEntityTypeId', 'Magento\Reports\Model\Resource\Product\Collection'], ['setProductEntityTypeId', 'Magento\Reports\Model\Resource\Product\Collection'], ['bindLocale', 'Magento\Backend\Model\Observer'], diff --git a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php index dd564c8fc6f9dd197646f78ee7b4a1ce894a6486..03153c58c0ff3900c187d3dc55d3e8b5989a13df 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php @@ -204,7 +204,7 @@ class LiveCodeTest extends PHPUnit_Framework_TestCase $copyPasteDetector->setBlackList($blackList); $this->assertTrue( - $copyPasteDetector->run(self::getWhitelist(['php'])), + $copyPasteDetector->run([BP]), "PHP Copy/Paste Detector has found error(s): See detailed report in {$reportFile}" ); } 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 cdb7b5313e3b6f4290bf2f99753d52018816724d..3b24b6214aa2026bbebee8fc505c49b1ef228535 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -1,3 +1,5 @@ +app/code/Magento +lib/internal/Magento Magento/Adminhtml Magento/Authorizenet/Model Magento/Backend @@ -130,6 +132,10 @@ Magento/Shipping/Model Magento/Ui Magento/Sales/Service/V1 Magento/Sales/Api +Magento/Eav/Api/Data +Magento/Customer/Api/Data +Magento/Quote/Api/Data +Magento/Catalog/Api/Data Magento/Sales/Spi Magento/Shipping/Controller/Adminhtml/Order/Shipment vendor 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 45009b54c364c8acbab9cb0f354c3f023dcc1a07..c682a1f5eff32ddb92c19cadd82af0c638940727 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 @@ -1,5 +1,9 @@ +app/code/Magento +lib/internal/Magento/Framework +dev/tools/Magento dev/tests/api-functional dev/tests/functional dev/tests/integration dev/tests/performance dev/tests/static +setup \ No newline at end of file diff --git a/dev/tests/unit/.gitignore b/dev/tests/unit/.gitignore index ace6e823e41a3ed294eb1ed9a1a14451bd3e2e8c..319b3826f933880445af33b78c1ee4e05666d321 100644 --- a/dev/tests/unit/.gitignore +++ b/dev/tests/unit/.gitignore @@ -1,2 +1 @@ /phpunit.xml -tmp diff --git a/dev/tests/unit/framework/autoload.php b/dev/tests/unit/framework/autoload.php new file mode 100644 index 0000000000000000000000000000000000000000..56021a2bb4acf835cf73ebb210789a84d77c2818 --- /dev/null +++ b/dev/tests/unit/framework/autoload.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +use Magento\Framework\Api\Code\Generator\DataBuilder; +use Magento\Framework\Api\Code\Generator\Mapper; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator; +use Magento\Framework\Api\Code\Generator\SearchResults; +use Magento\Framework\Api\Code\Generator\SearchResultsBuilder; +use Magento\Framework\Interception\Code\Generator\Interceptor; +use Magento\Framework\ObjectManager\Code\Generator\Converter; +use Magento\Framework\ObjectManager\Code\Generator\Factory; +use Magento\Framework\ObjectManager\Code\Generator\Persistor; +use Magento\Framework\ObjectManager\Code\Generator\Proxy; +use Magento\Framework\ObjectManager\Code\Generator\Repository; +use Magento\Tools\Di\Code\Scanner; +use Magento\Tools\Di\Compiler\Log\Writer; +use Magento\Tools\Di\Definition\Compressor; + +/** + * Enable code generation for the undeclared classes. + */ +$generationDir = TESTS_TEMP_DIR . '/var/generation'; +$generatorIo = new \Magento\Framework\Code\Generator\Io( + new \Magento\Framework\Filesystem\Driver\File(), + $generationDir +); +$generator = new \Magento\Framework\Code\Generator( + $generatorIo, + [ + Interceptor::ENTITY_TYPE => 'Magento\Framework\Interception\Code\Generator\Interceptor', + Proxy::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Proxy', + Factory::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Factory', + Mapper::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\Mapper', + Persistor::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Persistor', + Repository::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Repository', + Converter::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Converter', + SearchResults::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResults', + ExtensionAttributesInterfaceGenerator::ENTITY_TYPE => + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator', + ExtensionAttributesGenerator::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator' + ] +); +/** Initialize object manager for code generation based on configs */ +$magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); +$objectManager = $magentoObjectManagerFactory->create($_SERVER); +$generator->setObjectManager($objectManager); + +$autoloader = new \Magento\Framework\Code\Generator\Autoloader($generator); +spl_autoload_register([$autoloader, 'load']); +$autoloadWrapper = \Magento\Framework\Autoload\AutoloaderRegistry::getAutoloader(); +$autoloadWrapper->addPsr4('Magento\\', $generationDir . '/Magento/'); diff --git a/dev/tests/unit/framework/bootstrap.php b/dev/tests/unit/framework/bootstrap.php index afd5f88e899199d6db3934bb2d3e2d64431a972f..b30486b50a17dc3a6e0b67adaa072868b1747736 100755 --- a/dev/tests/unit/framework/bootstrap.php +++ b/dev/tests/unit/framework/bootstrap.php @@ -10,13 +10,9 @@ if (!defined('TESTS_TEMP_DIR')) { define('TESTS_TEMP_DIR', dirname(__DIR__) . '/tmp'); } +require_once __DIR__ . '/autoload.php'; require BP . '/app/functions.php'; -if (is_dir(TESTS_TEMP_DIR)) { - $filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File(); - $filesystemAdapter->deleteDirectory(TESTS_TEMP_DIR); -} -mkdir(TESTS_TEMP_DIR); \Magento\Framework\Phrase::setRenderer(new \Magento\Framework\Phrase\Renderer\Placeholder()); diff --git a/dev/tests/unit/tmp/.gitignore b/dev/tests/unit/tmp/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a68d087bfe51165cfcd71d2185d9d8a94855728a --- /dev/null +++ b/dev/tests/unit/tmp/.gitignore @@ -0,0 +1,2 @@ +/* +!/.gitignore diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php index 9f08a02568b5f6c771bd537799d3313719ec046c..bf5fc24e4749a2252511471bf3581476b9153d5e 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/PhpScanner.php @@ -6,6 +6,9 @@ namespace Magento\Tools\Di\Code\Scanner; use Magento\Tools\Di\Compiler\Log\Log; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator; +use Magento\Framework\ObjectManager\Code\Generator\Factory as FactoryGenerator; class PhpScanner implements ScannerInterface { @@ -23,86 +26,136 @@ class PhpScanner implements ScannerInterface } /** - * Fetch factories from class constructor + * Find classes which are used as parameters types of the specified method and are not declared. * - * @param $file string - * @param $reflectionClass mixed - * @return array + * @param string $file + * @param \ReflectionClass $classReflection + * @param string $methodName + * @param string $entityType + * @return string[] */ - protected function _fetchFactories($file, $reflectionClass) + protected function _findMissingClasses($file, $classReflection, $methodName, $entityType) { - $absentFactories = []; - if ($reflectionClass->hasMethod('__construct')) { - $constructor = $reflectionClass->getMethod('__construct'); + $missingClasses = []; + if ($classReflection->hasMethod($methodName)) { + $constructor = $classReflection->getMethod($methodName); $parameters = $constructor->getParameters(); /** @var $parameter \ReflectionParameter */ foreach ($parameters as $parameter) { preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches); - if (isset($matches[1]) && substr($matches[1], -7) == 'Factory') { - $factoryClassName = $matches[1]; - if (class_exists($factoryClassName)) { - continue; - } - $entityName = rtrim(substr($factoryClassName, 0, -7), '\\'); - if (!class_exists($entityName) && !interface_exists($entityName)) { - $this->_log->add( - Log::CONFIGURATION_ERROR, - $factoryClassName, - 'Invalid Factory for nonexistent class ' . $entityName . ' in file ' . $file - ); - continue; + if (isset($matches[1]) && substr($matches[1], -strlen($entityType)) == $entityType) { + $missingClassName = $matches[1]; + try { + if (class_exists($missingClassName)) { + continue; + } + } catch (\Magento\Framework\Exception $e) { } - - if (substr($factoryClassName, -8) == '\\Factory') { + $sourceClassName = $this->getSourceClassName($missingClassName, $entityType); + if (!class_exists($sourceClassName) && !interface_exists($sourceClassName)) { $this->_log->add( Log::CONFIGURATION_ERROR, - $factoryClassName, - 'Invalid Factory declaration for class ' . $entityName . ' in file ' . $file + $missingClassName, + "Invalid {$entityType} for nonexistent class {$sourceClassName} in file {$file}" ); continue; } - $absentFactories[] = $factoryClassName; + $missingClasses[] = $missingClassName; } } } - return $absentFactories; + return $missingClasses; + } + + /** + * Identify source class name for the provided class. + * + * @param string $missingClassName + * @param string $entityType + * @return string + */ + protected function getSourceClassName($missingClassName, $entityType) + { + $sourceClassName = rtrim(substr($missingClassName, 0, -strlen($entityType)), '\\'); + $entityType = lcfirst($entityType); + if ($entityType == ExtensionAttributesInterfaceGenerator::ENTITY_TYPE + || $entityType == ExtensionAttributesGenerator::ENTITY_TYPE + ) { + /** Process special cases for extension class and extension interface */ + return $sourceClassName . 'Interface'; + } else if ($entityType == FactoryGenerator::ENTITY_TYPE) { + $extensionAttributesSuffix = ucfirst(ExtensionAttributesGenerator::ENTITY_TYPE); + if (substr($sourceClassName, -strlen($extensionAttributesSuffix)) == $extensionAttributesSuffix) { + /** Process special case for extension factories */ + $extensionAttributesClass = substr( + $sourceClassName, + 0, + -strlen(ExtensionAttributesGenerator::ENTITY_TYPE) + ); + $sourceClassName = $extensionAttributesClass . 'Interface'; + } + } + return $sourceClassName; } /** * Fetch factories from class constructor * - * @param $file string - * @param $reflectionClass mixed - * @return array + * @param \ReflectionClass $reflectionClass + * @param string $file + * @return string[] */ - protected function _fetchDataBuilders($file, $reflectionClass) + protected function _fetchFactories($reflectionClass, $file) { - $absentDataBuilders = []; - if ($reflectionClass->hasMethod('__construct')) { - $constructor = $reflectionClass->getMethod('__construct'); - $parameters = $constructor->getParameters(); - /** @var $parameter \ReflectionParameter */ - foreach ($parameters as $parameter) { - preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches); - if (isset($matches[1]) && substr($matches[1], -11) == 'DataBuilder') { - $factoryClassName = $matches[1]; - if (class_exists($factoryClassName)) { - continue; - } - $entityName = rtrim(substr($factoryClassName, 0, -11), '\\'); - if (!class_exists($entityName) && !interface_exists($entityName . 'Interface')) { - $this->_log->add( - Log::CONFIGURATION_ERROR, - $factoryClassName, - 'Invalid DataBuilder for nonexistent class ' . $entityName . ' in file ' . $file - ); - continue; - } - $absentDataBuilders[] = $factoryClassName; - } + $factorySuffix = '\\'.ucfirst(FactoryGenerator::ENTITY_TYPE); + $absentFactories = $this->_findMissingClasses( + $file, + $reflectionClass, + '__construct', + ucfirst(FactoryGenerator::ENTITY_TYPE) + ); + foreach ($absentFactories as $key => $absentFactory) { + if (substr($absentFactory, -strlen($factorySuffix)) == $factorySuffix) { + $entityName = rtrim(substr($absentFactory, 0, -strlen($factorySuffix)), '\\'); + $this->_log->add( + Log::CONFIGURATION_ERROR, + $absentFactory, + 'Invalid Factory declaration for class ' . $entityName . ' in file ' . $file + ); + unset($absentFactories[$key]); } } - return $absentDataBuilders; + return $absentFactories; + } + + /** + * Find missing extension attributes related classes, interfaces and factories. + * + * @param \ReflectionClass $reflectionClass + * @param string $file + * @return string[] + */ + protected function _fetchMissingExtensionAttributesClasses($reflectionClass, $file) + { + $missingExtensionInterfaces = $this->_findMissingClasses( + $file, + $reflectionClass, + 'setExtensionAttributes', + ucfirst(\Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator::ENTITY_TYPE) + ); + $missingExtensionClasses = []; + $missingExtensionFactories = []; + foreach ($missingExtensionInterfaces as $missingExtensionInterface) { + $extension = rtrim(substr($missingExtensionInterface, 0, -strlen('Interface')), '\\'); + if (!class_exists($extension)) { + $missingExtensionClasses[] = $extension; + } + $extensionFactory = $extension . 'Factory'; + if (!class_exists($extensionFactory)) { + $missingExtensionFactories[] = $extensionFactory; + } + } + return array_merge($missingExtensionInterfaces, $missingExtensionClasses, $missingExtensionFactories); } /** @@ -118,11 +171,11 @@ class PhpScanner implements ScannerInterface $classes = $this->_getDeclaredClasses($file); foreach ($classes as $className) { $reflectionClass = new \ReflectionClass($className); - $absentFactories = $this->_fetchFactories($file, $reflectionClass); - $absentDataBuilders = $this->_fetchDataBuilders($file, $reflectionClass); - if (!empty($absentFactories)) { - $output = array_merge($output, $absentFactories, $absentDataBuilders); - } + $output = array_merge( + $output, + $this->_fetchFactories($reflectionClass, $file), + $this->_fetchMissingExtensionAttributesClasses($reflectionClass, $file) + ); } } return array_unique($output); @@ -166,7 +219,7 @@ class PhpScanner implements ScannerInterface } /** - * Get classes declared in the file + * Get classes and interfaces declared in the file * * @param string $file * @return array @@ -183,7 +236,9 @@ class PhpScanner implements ScannerInterface $namespace .= $this->_fetchNamespace($tokenIterator, $count, $tokens); } - if ($tokens[$tokenIterator][0] === T_CLASS) { + if ($tokens[$tokenIterator][0] === T_CLASS + || $tokens[$tokenIterator][0] === T_INTERFACE + ) { $classes = array_merge($classes, $this->_fetchClasses($namespace, $tokenIterator, $count, $tokens)); } } diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/RepositoryScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/RepositoryScanner.php index 9eb25fc1c50049ca0e8c5463205655df229bc5bd..9261e8d65022956c9aa1989f4a40f4ecfe8066fa 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/RepositoryScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/RepositoryScanner.php @@ -40,12 +40,10 @@ class RepositoryScanner implements ScannerInterface if (!class_exists($replacementType->nodeValue, $this->useAutoload)) { $persistor = str_replace('\\Repository', 'InterfacePersistor', $replacementType->nodeValue); $factory = str_replace('\\Repository', 'InterfaceFactory', $replacementType->nodeValue); - $dataBuilder = str_replace('\\Repository', 'DataBuilder', $replacementType->nodeValue); $searchResultFactory = str_replace('\\Repository', 'SearchResultInterfaceFactory', $replacementType->nodeValue); $repositoryClassNames[$persistor] = $persistor; $repositoryClassNames[$factory] = $factory; - $repositoryClassNames[$dataBuilder] = $dataBuilder; $repositoryClassNames[$searchResultFactory] = $searchResultFactory; $repositoryClassNames[$replacementType->nodeValue] = $replacementType->nodeValue; } diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php index 23ad5d57a25ef85c8a13b6234f4d83d91f3cc406..9f0b2ec3304b621728a6e94efb15f738b96170a9 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php @@ -5,6 +5,8 @@ */ namespace Magento\Tools\Di\Code\Scanner; +use Magento\Framework\ObjectManager\Code\Generator\Proxy as ProxyGenerator; + class XmlScanner implements ScannerInterface { /** @@ -57,10 +59,18 @@ class XmlScanner implements ScannerInterface */ protected function _filterEntities(array $output) { + $entitySuffix = '\\' . ucfirst(ProxyGenerator::ENTITY_TYPE); $filteredEntities = []; foreach ($output as $className) { - $entityName = substr($className, -6) === '\Proxy' ? substr($className, 0, -6) : $className; - if (false === class_exists($className)) { + $entityName = substr($className, -strlen($entitySuffix)) === $entitySuffix + ? substr($className, 0, -strlen($entitySuffix)) + : $className; + $isClassExists = false; + try { + $isClassExists = class_exists($className); + } catch (\Magento\Framework\Exception $e) { + } + if (false === $isClassExists) { if (class_exists($entityName) || interface_exists($entityName)) { array_push($filteredEntities, $className); } else { diff --git a/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/PluginScannerTest.php b/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/PluginScannerTest.php index 5f1d6f4b093b8f5683a9ed17d4aecf012206b2c7..adc1ebf2eaa69c83ebad7a3bba9926d09141ac49 100644 --- a/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/PluginScannerTest.php +++ b/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/PluginScannerTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Tools\Di\Test\Unit\Code\Scanner; class PluginScannerTest extends \PHPUnit_Framework_TestCase @@ -25,7 +28,7 @@ class PluginScannerTest extends \PHPUnit_Framework_TestCase public function testCollectEntities() { $actual = $this->_model->collectEntities($this->_testFiles); - $expected = ['Magento\Framework\App\Cache\TagPlugin', 'Magento\Core\Model\Action\Plugin']; + $expected = ['Magento\Framework\App\Cache\TagPlugin', 'Magento\Store\Model\Action\Plugin']; $this->assertEquals($expected, $actual); } } diff --git a/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/XmlScannerTest.php b/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/XmlScannerTest.php index b0dde77698a5b0e25b62cea423d959f616735628..b1cd9b3dac280b565d3d152a5c49c2d9b9da1688 100644 --- a/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/XmlScannerTest.php +++ b/dev/tools/Magento/Tools/Di/Test/Unit/Code/Scanner/XmlScannerTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Tools\Di\Test\Unit\Code\Scanner; class XmlScannerTest extends \PHPUnit_Framework_TestCase @@ -37,7 +40,7 @@ class XmlScannerTest extends \PHPUnit_Framework_TestCase public function testCollectEntities() { - $className = 'Magento\Core\Model\Config\Invalidator\Proxy'; + $className = 'Magento\Store\Model\Config\Invalidator\Proxy'; $this->_logMock->expects( $this->at(0) )->method( @@ -66,7 +69,7 @@ class XmlScannerTest extends \PHPUnit_Framework_TestCase 'Invalid proxy class for ' . substr('\Magento\SomeModule\Model\Nested\Element\Proxy', 0, -5) ); $actual = $this->_model->collectEntities($this->_testFiles); - $expected = ['Magento\Framework\App\Request\Http\Proxy']; + $expected = []; $this->assertEquals($expected, $actual); } } diff --git a/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/code/Magento/SomeModule/etc/di.xml b/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/code/Magento/SomeModule/etc/di.xml index 9e27e302529b55ca1826e7021f752f59024902bb..5466e9a385bc24a8e1766bf54613aae8c10701c1 100644 --- a/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/code/Magento/SomeModule/etc/di.xml +++ b/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/code/Magento/SomeModule/etc/di.xml @@ -7,7 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\Framework\App\RequestInterface" type="Magento\Framework\App\Request\Http\Proxy" /> - <preference for="Magento\Core\Model\Config\InvalidatorInterface" type="Magento\Core\Model\Config\Invalidator\Proxy" /> + <preference for="Magento\Store\Model\Config\InvalidatorInterface" type="Magento\Store\Model\Config\Invalidator\Proxy" /> <preference for="Magento\Framework\App\CacheInterface" type="Magento\Framework\App\Cache\Proxy" /> <virtualType name="custom_cache_instance" type="Magento\Framework\App\Cache"> <plugin name="tag" type="Magento\Framework\App\Cache\TagPlugin" /> diff --git a/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/config.xml b/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/config.xml index 1a33cc70899009144bbab6efd95df5dd01f7b834..2197266b7f07fd276114725c09ba157f35d60c57 100644 --- a/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/config.xml +++ b/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/config.xml @@ -6,5 +6,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> </config> diff --git a/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/di/config.xml b/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/di/config.xml index 4661287ae38cb1271db8638c12366b57f3bd0919..8638b10700e02310375a9dc43efe0a89b50eb15d 100644 --- a/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/di/config.xml +++ b/dev/tools/Magento/Tools/Di/Test/Unit/_files/app/etc/di/config.xml @@ -15,7 +15,7 @@ <arguments> <argument name="layoutFactory" xsi:type="object">customLayoutFactory</argument> </arguments> - <plugin name="first" type="Magento\Core\Model\Action\Plugin" /> + <plugin name="first" type="Magento\Store\Model\Action\Plugin" /> </type> <virtualType name="customStoreManagerProxy" type="Magento\Store\Model\StoreManager\Proxy" /> <virtualType name="customLayoutFactory" type="Magento\Framework\View\LayoutFactory" /> diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php index ccd484037efb1af292d05a6d28b5f3d4561571ac..fee6aa1320565f3f45bb6247e184ff5a756ae24c 100644 --- a/dev/tools/Magento/Tools/Di/compiler.php +++ b/dev/tools/Magento/Tools/Di/compiler.php @@ -6,10 +6,8 @@ require __DIR__ . '/../../../bootstrap.php'; $rootDir = realpath(__DIR__ . '/../../../../../'); -use Magento\Framework\Api\Code\Generator\DataBuilder; use Magento\Framework\Api\Code\Generator\Mapper; use Magento\Framework\Api\Code\Generator\SearchResults; -use Magento\Framework\Api\Code\Generator\SearchResultsBuilder; use Magento\Framework\Autoload\AutoloaderRegistry; use Magento\Framework\Interception\Code\Generator\Interceptor; use Magento\Framework\ObjectManager\Code\Generator\Converter; @@ -17,7 +15,8 @@ use Magento\Framework\ObjectManager\Code\Generator\Factory; use Magento\Framework\ObjectManager\Code\Generator\Proxy; use Magento\Framework\ObjectManager\Code\Generator\Repository; use Magento\Framework\ObjectManager\Code\Generator\Persistor; -use Magento\Framework\Api\Code\Generator\ObjectExtensionInterface; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator; use Magento\Tools\Di\Code\Scanner; use Magento\Tools\Di\Compiler\Log\Log; use Magento\Tools\Di\Compiler\Log\Writer; @@ -97,10 +96,7 @@ try { $generator = new \Magento\Framework\Code\Generator( $generatorIo, [ - DataBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\DataBuilder', Interceptor::ENTITY_TYPE => 'Magento\Framework\Interception\Code\Generator\Interceptor', - SearchResultsBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder', - DataBuilder::ENTITY_TYPE_BUILDER => 'Magento\Framework\Api\Code\Generator\DataBuilder', Proxy::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Proxy', Factory::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Factory', Mapper::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\Mapper', @@ -108,10 +104,16 @@ try { Repository::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Repository', Converter::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Converter', SearchResults::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResults', - ObjectExtensionInterface::ENTITY_TYPE => - 'Magento\Framework\Api\Code\Generator\ObjectExtensionInterface' + ExtensionAttributesInterfaceGenerator::ENTITY_TYPE => + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator', + ExtensionAttributesGenerator::ENTITY_TYPE => + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator' ] ); + /** Initialize object manager for code generation based on configs */ + $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); + $objectManager = $magentoObjectManagerFactory->create($_SERVER); + $generator->setObjectManager($objectManager); $generatorAutoloader = new \Magento\Framework\Code\Generator\Autoloader($generator); spl_autoload_register([$generatorAutoloader, 'load']); @@ -240,6 +242,17 @@ try { if ($log->hasError()) { exit(1); } + + echo 'On *nix systems, verify the Magento application has permissions to modify files created by the compiler' + . ' in the "var" directory. For instance, if you run the Magento application using Apache,' + . ' the owner of the files in the "var" directory should be the Apache user (example command:' + . ' "chown -R www-data:www-data <MAGENTO_ROOT>/var" where MAGENTO_ROOT is the Magento root directory).' . "\n"; + /** TODO: Temporary solution before having necessary changes on bamboo to overcome issue described above */ + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($rootDir . '/var')); + foreach ($iterator as $item) { + chmod($item, 0777); + } + } catch (Zend_Console_Getopt_Exception $e) { echo $e->getUsageMessage(); echo 'Please, use quotes(") for wrapping strings.' . "\n"; diff --git a/dev/tools/Magento/Tools/Di/entity_generator.php b/dev/tools/Magento/Tools/Di/entity_generator.php index 52594160c06f7432c38e92fad24e224798667d3a..4ab81346a4e3b3b555936a9ed1136ea163e28fb8 100644 --- a/dev/tools/Magento/Tools/Di/entity_generator.php +++ b/dev/tools/Magento/Tools/Di/entity_generator.php @@ -4,10 +4,8 @@ * See COPYING.txt for license details. */ -use Magento\Framework\Api\Code\Generator\DataBuilder; use Magento\Framework\Api\Code\Generator\Mapper; use Magento\Framework\Api\Code\Generator\SearchResults; -use Magento\Framework\Api\Code\Generator\SearchResultsBuilder; use Magento\Framework\Autoload\AutoloaderRegistry; use Magento\Framework\Code\Generator; use Magento\Framework\Code\Generator\Io; @@ -18,7 +16,8 @@ use Magento\Framework\ObjectManager\Code\Generator\Converter; use Magento\Framework\ObjectManager\Code\Generator\Factory; use Magento\Framework\ObjectManager\Code\Generator\Proxy; use Magento\Framework\ObjectManager\Code\Generator\Repository; -use Magento\Framework\Api\Code\Generator\ObjectExtensionInterface; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; require __DIR__ . '/../../../../../app/bootstrap.php'; @@ -72,12 +71,8 @@ try { //reinit generator with correct generation path $io = new Io(new File(), $generationDir); $generator = new Generator( - $validator, $io, [ - DataBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\DataBuilder', - SearchResultsBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder', - DataBuilder::ENTITY_TYPE_BUILDER => 'Magento\Framework\Api\Code\Generator\DataBuilder', Proxy::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Proxy', Factory::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Factory', Interceptor::ENTITY_TYPE => 'Magento\Framework\Interception\Code\Generator\Interceptor', @@ -85,10 +80,15 @@ $generator = new Generator( Repository::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Repository', Converter::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Converter', SearchResults::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResults', - ObjectExtensionInterface::ENTITY_TYPE => - 'Magento\Framework\Api\Code\Generator\ObjectExtensionInterface' + ExtensionAttributesInterfaceGenerator::ENTITY_TYPE => + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator', + ExtensionAttributesGenerator::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator' ] ); +/** Initialize object manager for code generation based on configs */ +$magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); +$objectManager = $magentoObjectManagerFactory->create($_SERVER); +$generator->setObjectManager($objectManager); try { if (Generator::GENERATION_SUCCESS == $generator->generateClass($className)) { diff --git a/dev/tools/Magento/Tools/I18n/Test/Unit/FactoryTest.php b/dev/tools/Magento/Tools/I18n/Test/Unit/FactoryTest.php index 742a8915e337a020bcd4477b01e3a54f79a61bd0..9d7b19a228b410627c063090415fa43932b97442 100644 --- a/dev/tools/Magento/Tools/I18n/Test/Unit/FactoryTest.php +++ b/dev/tools/Magento/Tools/I18n/Test/Unit/FactoryTest.php @@ -39,15 +39,15 @@ class FactoryTest extends \PHPUnit_Framework_TestCase return [ [ 'Magento\Tools\I18n\Dictionary\Writer\Csv', - 'filename.invalid_type', + TESTS_TEMP_DIR . '/filename.invalid_type', ], [ 'Magento\Tools\I18n\Dictionary\Writer\Csv', - 'filename' + TESTS_TEMP_DIR . '/filename' ], [ 'Magento\Tools\I18n\Dictionary\Writer\Csv', - 'filename.csv' + TESTS_TEMP_DIR . '/filename.csv' ], [ 'Magento\Tools\I18n\Dictionary\Writer\Csv\Stdo', 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 16a5a652c611981b722644302fd253217a6c3533..404a302306fe58864f083c64881fac381253eeb4 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 @@ -123,19 +123,18 @@ return [ 'cms/page' => 'cms_page', 'cms/page_store' => 'cms_page_store', 'compiler/configuration' => 'compiler_configuration', - 'core/cache' => 'core_cache', - 'core/cache_tag' => 'core_cache_tag', + 'core/cache' => 'cache', + 'core/cache_tag' => 'cache_tag', 'core/config_data' => 'core_config_data', - 'core/config_field' => 'core_config_field', 'core/design_change' => 'design_change', 'core/directory_storage' => 'media_storage_directory_storage', - 'core/email_template' => 'core_email_template', + 'core/email_template' => 'email_template', 'core/file_storage' => 'media_storage_file_storage', - 'core/flag' => 'core_flag', + 'core/flag' => 'flag', 'core/layout_link' => 'layout_link', 'core/layout_update' => 'layout_update', 'core_resource' => 'setup_module', - 'core/session' => 'core_session', + 'core/session' => 'session', 'core/store' => 'store', 'core/store_group' => 'store_group', 'core/variable' => 'variable', diff --git a/dev/tools/Magento/Tools/View/Deployer.php b/dev/tools/Magento/Tools/View/Deployer.php index fafd45319ff081370c89c805a89bcc870ca235b0..1549724017780a260891f4f386faf09962180a5d 100644 --- a/dev/tools/Magento/Tools/View/Deployer.php +++ b/dev/tools/Magento/Tools/View/Deployer.php @@ -10,6 +10,8 @@ use Magento\Framework\App\ObjectManagerFactory; use Magento\Framework\App\View\Deployment\Version; use Magento\Framework\App\View\Asset\Publisher; use Magento\Framework\App\Utility\Files; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Translate\Js\Config as JsTranslationConfig; /** * A service for deploying Magento static view files for production mode @@ -57,12 +59,23 @@ class Deployer /** @var \Magento\Framework\View\Asset\MinifyService */ protected $minifyService; + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var JsTranslationConfig + */ + protected $jsTranslationConfig; + /** * @param Files $filesUtil * @param Deployer\Log $logger * @param Version\StorageInterface $versionStorage * @param \Magento\Framework\Stdlib\DateTime $dateTime * @param \Magento\Framework\View\Asset\MinifyService $minifyService + * @param JsTranslationConfig $jsTranslationConfig * @param bool $isDryRun */ public function __construct( @@ -71,6 +84,7 @@ class Deployer Version\StorageInterface $versionStorage, \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Framework\View\Asset\MinifyService $minifyService, + JsTranslationConfig $jsTranslationConfig, $isDryRun = false ) { $this->filesUtil = $filesUtil; @@ -79,6 +93,7 @@ class Deployer $this->dateTime = $dateTime; $this->isDryRun = $isDryRun; $this->minifyService = $minifyService; + $this->jsTranslationConfig = $jsTranslationConfig; } /** @@ -87,6 +102,7 @@ class Deployer * @param ObjectManagerFactory $omFactory * @param array $locales * @return void + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function deploy(ObjectManagerFactory $omFactory, array $locales) { @@ -101,6 +117,7 @@ class Deployer foreach ($areas as $area => $themes) { $this->emulateApplicationArea($area); foreach ($locales as $locale) { + $this->emulateApplicationLocale($locale, $area); foreach ($themes as $themePath) { $this->logger->logMessage("=== {$area} -> {$themePath} -> {$locale} ==="); $this->count = 0; @@ -112,6 +129,15 @@ class Deployer foreach ($libFiles as $filePath) { $this->deployFile($filePath, $area, $themePath, $locale, null); } + if ($this->jsTranslationConfig->dictionaryEnabled()) { + $this->deployFile( + $this->jsTranslationConfig->getDictionaryFileName(), + $area, + $themePath, + $locale, + null + ); + } $this->bundleManager->flush(); $this->logger->logMessage("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n"); } @@ -176,19 +202,36 @@ class Deployer */ private function emulateApplicationArea($areaCode) { - $objectManager = $this->omFactory->create( + $this->objectManager = $this->omFactory->create( [\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT] ); /** @var \Magento\Framework\App\State $appState */ - $appState = $objectManager->get('Magento\Framework\App\State'); + $appState = $this->objectManager->get('Magento\Framework\App\State'); $appState->setAreaCode($areaCode); /** @var \Magento\Framework\App\ObjectManager\ConfigLoader $configLoader */ - $configLoader = $objectManager->get('Magento\Framework\App\ObjectManager\ConfigLoader'); - $objectManager->configure($configLoader->load($areaCode)); - $this->assetRepo = $objectManager->get('Magento\Framework\View\Asset\Repository'); - $this->assetPublisher = $objectManager->create('Magento\Framework\App\View\Asset\Publisher'); - $this->htmlMinifier = $objectManager->get('Magento\Framework\View\Template\Html\MinifierInterface'); - $this->bundleManager = $objectManager->get('Magento\Framework\View\Asset\Bundle\Manager'); + $configLoader = $this->objectManager->get('Magento\Framework\App\ObjectManager\ConfigLoader'); + $this->objectManager->configure($configLoader->load($areaCode)); + $this->assetRepo = $this->objectManager->get('Magento\Framework\View\Asset\Repository'); + + $this->assetPublisher = $this->objectManager->create('Magento\Framework\App\View\Asset\Publisher'); + $this->htmlMinifier = $this->objectManager->get('Magento\Framework\View\Template\Html\MinifierInterface'); + $this->bundleManager = $this->objectManager->get('Magento\Framework\View\Asset\Bundle\Manager'); + + } + + /** + * Set application locale and load translation for area + * + * @param string $locale + * @param string $area + * @return void + */ + protected function emulateApplicationLocale($locale, $area) + { + /** @var \Magento\Framework\TranslateInterface $translator */ + $translator = $this->objectManager->get('Magento\Framework\TranslateInterface'); + $translator->setLocale($locale); + $translator->loadData($area, true); } /** diff --git a/dev/tools/Magento/Tools/View/deploy.php b/dev/tools/Magento/Tools/View/deploy.php index 765ac7e4acaddb0e106bfa98f56e8eb96f11ddf3..f380efd3f360d68738842b900cc4372a0af2ddc4 100644 --- a/dev/tools/Magento/Tools/View/deploy.php +++ b/dev/tools/Magento/Tools/View/deploy.php @@ -43,7 +43,7 @@ $logger = new \Magento\Tools\View\Deployer\Log($verbosity); try { // run the deployment logic - $filesUtil = new \Magento\Framework\Test\Utility\Files(BP); + $filesUtil = new \Magento\Framework\App\Utility\Files(BP); $omFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []); $objectManager = $omFactory->create( [\Magento\Framework\App\State::PARAM_MODE => \Magento\Framework\App\State::MODE_DEFAULT] diff --git a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php index 0eb68d88fb4d0417bd91b40b5a41b01cd9c2cd8a..6455c7ca7f2cb2c9f3056910c1a594e5b95519aa 100644 --- a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php +++ b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php @@ -10,8 +10,9 @@ use \Magento\Framework\Api\AttributeValueFactory; /** * Base Class for extensible data Objects * @SuppressWarnings(PHPMD.NumberOfChildren) + * TODO: This class can be split into Custom attribute and Extension attribute implementation classes */ -abstract class AbstractExtensibleObject extends AbstractSimpleObject implements ExtensibleDataInterface +abstract class AbstractExtensibleObject extends AbstractSimpleObject implements CustomAttributesDataInterface { /** * Array key for custom attributes @@ -19,14 +20,14 @@ abstract class AbstractExtensibleObject extends AbstractSimpleObject implements const CUSTOM_ATTRIBUTES_KEY = 'custom_attributes'; /** - * @var AttributeValueFactory + * @var \Magento\Framework\Api\ExtensionAttributesFactory */ - protected $attributeValueFactory; + protected $extensionFactory; /** - * @var MetadataServiceInterface + * @var AttributeValueFactory */ - protected $metadataService; + protected $attributeValueFactory; /** * @var string[] @@ -36,16 +37,16 @@ abstract class AbstractExtensibleObject extends AbstractSimpleObject implements /** * Initialize internal storage * - * @param MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $attributeValueFactory * @param array $data */ public function __construct( - MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $attributeValueFactory, $data = [] ) { - $this->metadataService = $metadataService; + $this->extensionFactory = $extensionFactory; $this->attributeValueFactory = $attributeValueFactory; parent::__construct($data); } @@ -118,23 +119,57 @@ abstract class AbstractExtensibleObject extends AbstractSimpleObject implements } /** + * Get a list of custom attribute codes. + * + * By default, entity can be extended only using extension attributes functionality. * * @return string[] */ protected function getCustomAttributesCodes() { - if (!is_null($this->customAttributesCodes)) { - return $this->customAttributesCodes; - } + return isset($this->customAttributesCodes) ? $this->customAttributesCodes : []; + } + + /** + * Receive a list of EAV attributes using provided metadata service. + * + * Can be used in child classes, which represent EAV entities. + * + * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @return string[] + */ + protected function getEavAttributesCodes(\Magento\Framework\Api\MetadataServiceInterface $metadataService) + { $attributeCodes = []; - $customAttributesMetadata = $this->metadataService->getCustomAttributesMetadata(get_class($this)); + $customAttributesMetadata = $metadataService->getCustomAttributesMetadata(get_class($this)); if (is_array($customAttributesMetadata)) { /** @var $attribute \Magento\Framework\Api\MetadataObjectInterface */ foreach ($customAttributesMetadata as $attribute) { $attributeCodes[] = $attribute->getAttributeCode(); } } - $this->customAttributesCodes = $attributeCodes; return $attributeCodes; } + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Framework\Api\ExtensionAttributesInterface + */ + protected function _getExtensionAttributes() + { + return $this->_get(self::EXTENSION_ATTRIBUTES_KEY); + } + + /** + * Set an extension attributes object. + * + * @param \Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes + * @return $this + */ + protected function _setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes) + { + $this->_data[self::EXTENSION_ATTRIBUTES_KEY] = $extensionAttributes; + return $this; + } } diff --git a/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php b/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php deleted file mode 100644 index e26b83ab6ad04bbcf5eb4705a9f81e0bd3b4c4ac..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api; - -/** - * Builder for the SearchResults Service Data Object - * - * @method SearchResults create() - */ -abstract class AbstractSearchResultsBuilder extends ExtensibleObjectBuilder -{ - /** - * Search criteria builder - * - * @var SearchCriteriaBuilder - */ - protected $searchCriteriaBuilder; - - /** - * Item data object builder - * - * @var BuilderInterface $itemObjectBuilder - */ - protected $itemObjectBuilder; - - /** - * Constructor - * - * @param ObjectFactory $objectFactory - * @param AttributeValueFactory $valueFactory - * @param MetadataServiceInterface $metadataService - * @param SearchCriteriaBuilder $searchCriteriaBuilder - * @param BuilderInterface $itemObjectBuilder - */ - public function __construct( - ObjectFactory $objectFactory, - AttributeValueFactory $valueFactory, - MetadataServiceInterface $metadataService, - SearchCriteriaBuilder $searchCriteriaBuilder, - BuilderInterface $itemObjectBuilder - ) { - parent::__construct($objectFactory, $valueFactory, $metadataService); - $this->searchCriteriaBuilder = $searchCriteriaBuilder; - $this->itemObjectBuilder = $itemObjectBuilder; - } - - /** - * Set search criteria - * - * @param SearchCriteria $searchCriteria - * @return $this - */ - public function setSearchCriteria(SearchCriteria $searchCriteria) - { - return $this->_set(SearchResults::KEY_SEARCH_CRITERIA, $searchCriteria); - } - - /** - * Set total count - * - * @param int $totalCount - * @return $this - */ - public function setTotalCount($totalCount) - { - return $this->_set(SearchResults::KEY_TOTAL_COUNT, $totalCount); - } - - /** - * Set items - * - * @param \Magento\Framework\Api\AbstractExtensibleObject[] $items - * @return $this - */ - public function setItems($items) - { - return $this->_set(SearchResults::KEY_ITEMS, $items); - } - - /** - * {@inheritdoc} - */ - protected function _setDataValues(array $data) - { - if (array_key_exists(SearchResults::KEY_SEARCH_CRITERIA, $data)) { - $data[SearchResults::KEY_SEARCH_CRITERIA] = - $this->searchCriteriaBuilder->populateWithArray($data[SearchResults::KEY_SEARCH_CRITERIA])->create(); - } - if (array_key_exists(SearchResults::KEY_ITEMS, $data)) { - $items = []; - foreach ($data[SearchResults::KEY_ITEMS] as $itemArray) { - $items[] = $this->itemObjectBuilder->populateWithArray($itemArray)->create(); - } - $data[SearchResults::KEY_ITEMS] = $items; - } - return parent::_setDataValues($data); - } -} diff --git a/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php b/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php index d59c4461b3e3c8f263069802d3e6333e137babc3..3c511a75937082524aaf74544b3ba88dd4c436d8 100644 --- a/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php +++ b/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php @@ -30,28 +30,6 @@ abstract class AbstractSimpleObjectBuilder implements SimpleBuilderInterface $this->objectFactory = $objectFactory; } - /** - * Initializes Data Object with the data from array - * - * @param array $data - * @return $this - */ - protected function _setDataValues(array $data) - { - $dataObjectMethods = get_class_methods($this->_getDataObjectType()); - foreach ($data as $key => $value) { - /* First, verify is there any getter for the key on the Service Data Object */ - $possibleMethods = [ - 'get' . \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key), - 'is' . \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key), - ]; - if (array_intersect($possibleMethods, $dataObjectMethods)) { - $this->data[$key] = $value; - } - } - return $this; - } - /** * Builds the Data Object * @@ -85,13 +63,8 @@ abstract class AbstractSimpleObjectBuilder implements SimpleBuilderInterface protected function _getDataObjectType() { $currentClass = get_class($this); - $dataBuilderSuffix = 'DataBuilder'; - if (substr($currentClass, -strlen($dataBuilderSuffix)) === $dataBuilderSuffix) { - $dataObjectType = substr($currentClass, 0, -strlen($dataBuilderSuffix)) . 'Interface'; - } else { - $builderSuffix = 'Builder'; - $dataObjectType = substr($currentClass, 0, -strlen($builderSuffix)); - } + $builderSuffix = 'Builder'; + $dataObjectType = substr($currentClass, 0, -strlen($builderSuffix)); return $dataObjectType; } diff --git a/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php b/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php deleted file mode 100644 index b45520fbc8c70f7069627528bfaeb6f4ed37d7a1..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Api; - -/** - * Custom Attribute Data object builder - */ -class AttributeDataBuilder extends AbstractSimpleObjectBuilder -{ - /** - * Set attribute code - * - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode) - { - return $this->_set(AttributeValue::ATTRIBUTE_CODE, $attributeCode); - } - - /** - * Set attribute value - * - * @param string $value - * @return $this - */ - public function setValue($value) - { - return $this->_set(AttributeValue::VALUE, $value); - } - - /** - * Return the Data type class name - * - * @return string - */ - protected function _getDataObjectType() - { - return '\Magento\Framework\Api\AttributeValue'; - } -} diff --git a/lib/internal/Magento/Framework/Api/AttributeMetadata.php b/lib/internal/Magento/Framework/Api/AttributeMetadata.php index 8420b663b255b8770b93fda560abd9cabee3a9a4..ba8723230de9e423a04b7702b5f9b108518ed8b8 100644 --- a/lib/internal/Magento/Framework/Api/AttributeMetadata.php +++ b/lib/internal/Magento/Framework/Api/AttributeMetadata.php @@ -22,4 +22,15 @@ class AttributeMetadata extends AbstractSimpleObject implements MetadataObjectIn { return $this->_get(self::ATTRIBUTE_CODE); } + + /** + * Set code of the attribute. + * + * @param string $attributeCode + * @return $this + */ + public function setAttributeCode($attributeCode) + { + return $this->setData(self::ATTRIBUTE_CODE, $attributeCode); + } } diff --git a/lib/internal/Magento/Framework/Api/AttributeMetadataBuilder.php b/lib/internal/Magento/Framework/Api/AttributeMetadataBuilder.php deleted file mode 100644 index dd765d1f1adc58f2cce43d6f4a69f4f79e0092ea..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/AttributeMetadataBuilder.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api; - -/** - * Default implementation of the AttributeMetadataBuilderInterface - */ -class AttributeMetadataBuilder extends AbstractSimpleObjectBuilder implements AttributeMetadataBuilderInterface -{ - const ATTRIBUTE_CODE = 'attribute_code'; - - /** - * Set attribute code - * - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode) - { - return $this->_set(self::ATTRIBUTE_CODE, $attributeCode); - } -} diff --git a/lib/internal/Magento/Framework/Api/AttributeMetadataBuilderInterface.php b/lib/internal/Magento/Framework/Api/AttributeMetadataBuilderInterface.php deleted file mode 100644 index fef5d8e1e7d32b43b71c418c5cd82fdb522e434e..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/AttributeMetadataBuilderInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api; - -/** - * Attribute metadata object builder interface. - */ -interface AttributeMetadataBuilderInterface -{ - /** - * Set code of the attribute. - * - * @param string $attributeCode - * @return $this - */ - public function setAttributeCode($attributeCode); - - /** - * Build the attribute data object. - * - * @return AbstractSimpleObject - */ - public function create(); -} diff --git a/lib/internal/Magento/Framework/Api/Builder.php b/lib/internal/Magento/Framework/Api/Builder.php deleted file mode 100644 index 9b7338a54e2788624477f5131966860e36b4b845..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Builder.php +++ /dev/null @@ -1,406 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api; - -/** - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class Builder implements BuilderInterface -{ - /**#@+ - * Constant which defines if builder is created for building data objects or data models. - */ - const TYPE_DATA_OBJECT = 'data_object'; - const TYPE_EXTENSIBLE_DATA_OBJECT = 'extensible_data_object'; - const TYPE_DATA_MODEL = 'data_model'; - /**#@-*/ - - /** - * @var string - */ - protected $modelClassInterface; - - /** - * @var array - */ - protected $data; - - /** - * @var ObjectFactory - */ - protected $objectFactory; - - /** - * @var MetadataServiceInterface - */ - protected $metadataService; - - /** - * @var string[] - */ - protected $customAttributesCodes = null; - - /** - * @var \Magento\Framework\Api\AttributeValueFactory - */ - protected $attributeValueFactory; - - /** - * @var \Magento\Framework\Reflection\DataObjectProcessor - */ - protected $objectProcessor; - - /** - * @var array - */ - protected $interfaceMethodsDescription; - - /** - * @var \Magento\Framework\Reflection\TypeProcessor - */ - protected $typeProcessor; - - /** - * @var \Magento\Framework\Serialization\DataBuilderFactory - */ - protected $dataBuilderFactory; - - /** - * @var \Magento\Framework\ObjectManager\ConfigInterface - */ - protected $objectManagerConfig; - - /** - * @param ObjectFactory $objectFactory - * @param MetadataServiceInterface $metadataService - * @param AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string $modelClassInterface - */ - public function __construct( - ObjectFactory $objectFactory, - MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - $modelClassInterface = null - ) { - $this->objectFactory = $objectFactory; - $this->metadataService = $metadataService; - $this->modelClassInterface = $modelClassInterface; - $this->objectProcessor = $objectProcessor; - $this->attributeValueFactory = $attributeValueFactory; - $this->typeProcessor = $typeProcessor; - $this->dataBuilderFactory = $dataBuilderFactory; - $this->objectManagerConfig = $objectManagerConfig; - $this->data = []; - } - - /** - * {@inheritdoc} - */ - public function setCustomAttribute($attributeCode, $attributeValue) - { - $customAttributesCodes = $this->getCustomAttributesCodes(); - if (in_array($attributeCode, $customAttributesCodes)) { - $attribute = $this->attributeValueFactory->create() - ->setAttributeCode($attributeCode) - ->setValue($attributeValue); - //Stores as an associative array for easier lookup and processing - $this->data[ExtensibleDataInterface::CUSTOM_ATTRIBUTES][$attributeCode] = $attribute; - } - return $this; - } - - /** - * {@inheritdoc} - */ - public function setCustomAttributes(array $attributes) - { - $customAttributesCodes = $this->getCustomAttributesCodes(); - /** @var \Magento\Framework\Api\AttributeInterface $attribute */ - foreach ($attributes as $attribute) { - if (!$attribute instanceof AttributeValue) { - throw new \LogicException('Custom Attribute array elements can only be type of AttributeValue'); - } - $attributeCode = $attribute->getAttributeCode(); - if (in_array($attributeCode, $customAttributesCodes)) { - $this->data[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute; - } - } - return $this; - } - - /** - * {@inheritdoc} - */ - public function create() - { - $dataType = $this->getDataType(); - if ($dataType == self::TYPE_DATA_MODEL) { - /** @var \Magento\Framework\Model\AbstractExtensibleModel $dataObject */ - $dataObject = $this->objectFactory->create( - $this->_getDataObjectType(), - ['data' => $this->data] - ); - $dataObject->setDataChanges(true); - } elseif ($dataType == self::TYPE_EXTENSIBLE_DATA_OBJECT) { - $dataObjectType = $this->_getDataObjectType(); - $dataObject = $this->objectFactory->create( - $dataObjectType, - ['attributeValueFactory' => $this->attributeValueFactory, 'data' => $this->data] - ); - } else { - $dataObjectType = $this->_getDataObjectType(); - $dataObject = $this->objectFactory->create( - $dataObjectType, - ['data' => $this->data] - ); - } - if ($dataObject instanceof \Magento\Framework\Object) { - $dataObject->setDataChanges(true); - } - $this->data = []; - return $dataObject; - } - - /** - * {@inheritdoc} - */ - public function populateWithArray(array $data) - { - $this->data = []; - $this->_setDataValues($data); - return $this; - } - - /** - * {@inheritdoc} - */ - public function populate(ExtensibleDataInterface $prototype) - { - $objectType = $this->_getDataObjectType(); - if (!($prototype instanceof $objectType)) { - throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.'); - } - $prototypeArray = $this->objectProcessor->buildOutputDataArray($prototype, $objectType); - return $this->populateWithArray($prototypeArray); - } - - /** - * {@inheritdoc} - */ - public function mergeDataObjects( - ExtensibleDataInterface $firstDataObject, - ExtensibleDataInterface $secondDataObject - ) { - $objectType = $this->_getDataObjectType(); - if (!$firstDataObject instanceof $objectType || !$secondDataObject instanceof $objectType) { - throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.'); - } - $firstObjectArray = $this->objectProcessor->buildOutputDataArray($firstDataObject, $objectType); - $secondObjectArray = $this->objectProcessor->buildOutputDataArray($secondDataObject, $objectType); - $this->_setDataValues($firstObjectArray); - $this->_setDataValues($secondObjectArray); - return $this; - } - - /** - * {@inheritdoc} - */ - public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data) - { - $objectType = $this->_getDataObjectType(); - if (!($dataObject instanceof $objectType)) { - throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.'); - } - $dataArray = $this->objectProcessor->buildOutputDataArray($dataObject, $objectType); - $this->_setDataValues($dataArray); - $this->_setDataValues($data); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getData() - { - return $this->data; - } - - /** - * @param string $key - * @param mixed $value - * - * @return $this - */ - protected function _set($key, $value) - { - $this->data[$key] = $value; - return $this; - } - - /** - * Identify type of objects which should be built with generated builder. Value can be one of self::TYPE_DATA_*. - * - * @return string - * @throws \LogicException - */ - protected function getDataType() - { - $dataType = $this->_getDataObjectType(); - if (is_subclass_of($dataType, '\Magento\Framework\Api\AbstractExtensibleObject')) { - return self::TYPE_EXTENSIBLE_DATA_OBJECT; - } elseif (is_subclass_of($dataType, '\Magento\Framework\Api\AbstractSimpleObject')) { - return self::TYPE_DATA_OBJECT; - } elseif (is_subclass_of($dataType, '\Magento\Framework\Model\AbstractExtensibleModel')) { - return self::TYPE_DATA_MODEL; - } - $dataType = ltrim($dataType, '\\'); - $sourceClassPreference = $this->objectManagerConfig->getPreference($dataType); - if (empty($sourceClassPreference)) { - throw new \LogicException( - "Preference for {$this->_getDataObjectType()} is not defined." - ); - } - - if (is_subclass_of($dataType, '\Magento\Framework\Api\AbstractExtensibleObject')) { - return self::TYPE_EXTENSIBLE_DATA_OBJECT; - } elseif (is_subclass_of($sourceClassPreference, '\Magento\Framework\Api\AbstractSimpleObject')) { - return self::TYPE_DATA_OBJECT; - } elseif (is_subclass_of($sourceClassPreference, '\Magento\Framework\Model\AbstractExtensibleModel')) { - return self::TYPE_DATA_MODEL; - } else { - throw new \LogicException( - 'Preference of ' . $this->_getDataObjectType() - . ' must extend from AbstractSimpleObject or AbstractExtensibleModel' - ); - } - } - - /** - * Template method used to configure the attribute codes for the custom attributes - * - * @return string[] - */ - protected function getCustomAttributesCodes() - { - if (!is_null($this->customAttributesCodes)) { - return $this->customAttributesCodes; - } - $attributeCodes = []; - /** @var \Magento\Framework\Api\MetadataObjectInterface[] $customAttributesMetadata */ - $customAttributesMetadata = $this->metadataService - ->getCustomAttributesMetadata($this->_getDataObjectType()); - if (is_array($customAttributesMetadata)) { - foreach ($customAttributesMetadata as $attribute) { - $attributeCodes[] = $attribute->getAttributeCode(); - } - } - $this->customAttributesCodes = $attributeCodes; - return $attributeCodes; - } - - /** - * Initializes Data Object with the data from array - * - * @param array $data - * @return $this - */ - protected function _setDataValues(array $data) - { - $dataObjectMethods = get_class_methods($this->_getDataObjectType()); - foreach ($data as $key => $value) { - /* First, verify is there any getter for the key on the Service Data Object */ - $camelCaseKey = \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key); - $possibleMethods = [ - 'get' . $camelCaseKey, - 'is' . $camelCaseKey, - ]; - if ($key === ExtensibleDataInterface::CUSTOM_ATTRIBUTES - && is_array($data[$key]) - && !empty($data[$key]) - ) { - foreach ($data[$key] as $customAttribute) { - $this->setCustomAttribute( - $customAttribute[AttributeInterface::ATTRIBUTE_CODE], - $customAttribute[AttributeInterface::VALUE] - ); - } - } elseif ($methodName = array_intersect($possibleMethods, $dataObjectMethods)) { - if (!is_array($value)) { - $this->data[$key] = $value; - } else { - $this->setComplexValue($methodName[0], $key, $value); - } - } elseif (in_array($key, $this->getCustomAttributesCodes())) { - $this->setCustomAttribute($key, $value); - } - } - - return $this; - } - - /** - * @param string $methodName - * @param string $key - * @param array $value - * @return $this - */ - protected function setComplexValue($methodName, $key, array $value) - { - $returnType = $this->objectProcessor->getMethodReturnType($this->_getDataObjectType(), $methodName); - if ($this->typeProcessor->isTypeSimple($returnType)) { - $this->data[$key] = $value; - return $this; - } - - if ($this->typeProcessor->isArrayType($returnType)) { - $type = $this->typeProcessor->getArrayItemType($returnType); - $dataBuilder = $this->dataBuilderFactory->getDataBuilder($type); - $objects = []; - foreach ($value as $arrayElementData) { - $objects[] = $dataBuilder->populateWithArray($arrayElementData) - ->create(); - } - $this->data[$key] = $objects; - return $this; - } - - $dataBuilder = $this->dataBuilderFactory->getDataBuilder($returnType); - $object = $dataBuilder->populateWithArray($value) - ->create(); - $this->data[$key] = $object; - return $this; - } - - /** - * Get data object type based on suffix - * - * @return string - */ - protected function _getDataObjectType() - { - if ($this->modelClassInterface) { - return $this->modelClassInterface; - } - $currentClass = get_class($this); - $dataBuilderSuffix = 'DataBuilder'; - if (substr($currentClass, -strlen($dataBuilderSuffix)) === $dataBuilderSuffix) { - $dataObjectType = substr($currentClass, 0, -strlen($dataBuilderSuffix)) . 'Interface'; - } else { - $builderSuffix = 'Builder'; - $dataObjectType = substr($currentClass, 0, -strlen($builderSuffix)); - } - return $dataObjectType; - } -} diff --git a/lib/internal/Magento/Framework/Api/BuilderInterface.php b/lib/internal/Magento/Framework/Api/BuilderInterface.php deleted file mode 100644 index 1b89995f51af90a3a4154b1e75b9e3b8f510d807..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/BuilderInterface.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api; - -interface BuilderInterface extends SimpleBuilderInterface -{ - /** - * Set custom attribute value. - * - * @param string $attributeCode - * @param mixed $attributeValue - * @return $this - */ - public function setCustomAttribute($attributeCode, $attributeValue); - - /** - * Set array of custom attributes - * - * @param \Magento\Framework\Api\AttributeInterface[] $attributes - * @return $this - * @throws \LogicException If array elements are not of AttributeValue type - */ - public function setCustomAttributes(array $attributes); - - /** - * Return created ExtensibleDataInterface object - * - * @return \Magento\Framework\Api\ExtensibleDataInterface - */ - public function create(); - - /** - * Populates the fields with data from the array. - * - * Keys for the map are snake_case attribute/field names. - * - * @param array $data - * @return $this - */ - public function populateWithArray(array $data); - - /** - * Populates the fields with an existing entity. - * - * @param ExtensibleDataInterface $prototype the prototype to base on - * @return $this - * @throws \LogicException If $prototype object class is not the same type as object that is constructed - */ - public function populate(ExtensibleDataInterface $prototype); - - /** - * Populate builder with the two data interfaces, merging them - * - * @param ExtensibleDataInterface $firstDataObject - * @param ExtensibleDataInterface $secondDataObject - * @return $this - * @throws \LogicException - */ - public function mergeDataObjects( - ExtensibleDataInterface $firstDataObject, - ExtensibleDataInterface $secondDataObject - ); - - /** - * Populate builder with the data interface and array, merging them - * - * @param ExtensibleDataInterface $dataObject - * @param array $data - * @return $this - * @throws \LogicException - */ - public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data); -} diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php b/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php deleted file mode 100644 index 4dbbd72d071c8b061b53aae9c14af62e49c4165c..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php +++ /dev/null @@ -1,287 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api\Code\Generator; - -use Magento\Framework\Code\Generator\EntityAbstract; -use Magento\Framework\Code\Generator\Io; -use Zend\Code\Reflection\ClassReflection; - -/** - * Class Builder - */ -class DataBuilder extends EntityAbstract -{ - /** - * Builder Entity, used for a builders built based on Data Objects - */ - const ENTITY_TYPE = 'dataBuilder'; - - /** - * Builder Entity, used for a builders built based on API interfaces - */ - const ENTITY_TYPE_BUILDER = 'builder'; - - /** - * Data Model property name - */ - const DATA_PROPERTY_NAME = 'data'; - - /**#@+ - * Constant which defines if builder is created for building data objects or data models. - */ - const TYPE_DATA_OBJECT = 'data_object'; - const TYPE_DATA_MODEL = 'data_model'; - /**#@-*/ - - /** @var string */ - protected $currentDataType; - - /** @var string[] */ - protected $extensibleInterfaceMethods; - - /** - * @var \Magento\Framework\Reflection\TypeProcessor - */ - protected $typeProcessor = null; - - /** - * Initialize dependencies. - * - * @param string|null $sourceClassName - * @param string|null $resultClassName - * @param Io|null $ioObject - * @param \Magento\Framework\Code\Generator\CodeGeneratorInterface|null $classGenerator - * @param \Magento\Framework\Code\Generator\DefinedClasses|null $definedClasses - */ - public function __construct( - $sourceClassName = null, - $resultClassName = null, - Io $ioObject = null, - \Magento\Framework\Code\Generator\CodeGeneratorInterface $classGenerator = null, - \Magento\Framework\Code\Generator\DefinedClasses $definedClasses = null - ) { - $this->typeProcessor = new \Magento\Framework\Reflection\TypeProcessor(); - parent::__construct( - $sourceClassName, - $resultClassName, - $ioObject, - $classGenerator, - $definedClasses - ); - } - - /** - * Retrieve class properties - * - * @return array - */ - protected function _getClassProperties() - { - return []; - } - - /** - * Get default constructor definition for generated class - * - * @return array - */ - protected function _getDefaultConstructorDefinition() - { - $constructorDefinition = [ - 'name' => '__construct', - 'parameters' => [ - ['name' => 'objectFactory', 'type' => '\Magento\Framework\Api\ObjectFactory'], - ['name' => 'metadataService', 'type' => '\Magento\Framework\Api\MetadataServiceInterface'], - ['name' => 'attributeValueFactory', 'type' => '\Magento\Framework\Api\AttributeValueFactory'], - ['name' => 'objectProcessor', 'type' => '\Magento\Framework\Reflection\DataObjectProcessor'], - ['name' => 'typeProcessor', 'type' => '\Magento\Framework\Reflection\TypeProcessor'], - ['name' => 'dataBuilderFactory', 'type' => '\Magento\Framework\Serialization\DataBuilderFactory'], - ['name' => 'objectManagerConfig', 'type' => '\Magento\Framework\ObjectManager\ConfigInterface'], - [ - 'name' => 'modelClassInterface', - 'type' => 'string', - 'defaultValue' => $this->_getNullDefaultValue() - ], - ], - 'docblock' => [ - 'shortDescription' => 'Initialize the builder', - 'tags' => [ - [ - 'name' => 'param', - 'description' => '\Magento\Framework\Api\ObjectFactory $objectFactory', - ], - [ - 'name' => 'param', - 'description' => '\Magento\Framework\Api\MetadataServiceInterface $metadataService' - ], - [ - 'name' => 'param', - 'description' => '\Magento\Framework\Api\AttributeValueFactory $attributeValueFactory' - ], - [ - 'name' => 'param', - 'description' => '\Magento\Framework\Reflection\DataObjectProcessor $objectProcessor' - ], - [ - 'name' => 'param', - 'description' => '\Magento\Framework\Reflection\TypeProcessor $typeProcessor' - ], - [ - 'name' => 'param', - 'description' => '\Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory' - ], - [ - 'name' => 'param', - 'description' => '\Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig' - ], - [ - 'name' => 'param', - 'description' => 'string|null $modelClassInterface' - ], - ], - ], - 'body' => "parent::__construct(\$objectFactory, \$metadataService, \$attributeValueFactory, " - . "\$objectProcessor, \$typeProcessor, \$dataBuilderFactory, \$objectManagerConfig, " - . "'{$this->_getSourceClassName()}');", - ]; - return $constructorDefinition; - } - - /** - * Return a list of methods for class generator - * - * @return array - */ - protected function _getClassMethods() - { - $methods = []; - $className = $this->_getSourceClassName(); - $reflectionClass = new \ReflectionClass($className); - $publicMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC); - foreach ($publicMethods as $method) { - if ($this->canUseMethodForGeneration($method)) { - $methods[] = $this->_getMethodInfo($method); - } - } - $defaultConstructorDefinition = $this->_getDefaultConstructorDefinition(); - if (!empty($defaultConstructorDefinition)) { - $methods[] = $defaultConstructorDefinition; - } - return $methods; - } - - /** - * Check if the specified method should be used during generation builder generation. - * - * @param \ReflectionMethod $method - * @return bool - */ - protected function canUseMethodForGeneration($method) - { - $isGetter = substr($method->getName(), 0, 3) == 'get' || substr($method->getName(), 0, 2) == 'is'; - $isSuitableMethodType = !($method->isConstructor() || $method->isFinal() - || $method->isStatic() || $method->isDestructor()); - $isMagicMethod = in_array($method->getName(), ['__sleep', '__wakeup', '__clone']); - $isPartOfExtensibleInterface = in_array($method->getName(), $this->getExtensibleInterfaceMethods()); - return $isGetter && $isSuitableMethodType && !$isMagicMethod && !$isPartOfExtensibleInterface; - } - - /** - * Retrieve method info - * - * @param \ReflectionMethod $method - * @return array - */ - protected function _getMethodInfo(\ReflectionMethod $method) - { - if (substr($method->getName(), 0, 2) == 'is') { - $propertyName = substr($method->getName(), 2); - } else { - $propertyName = substr($method->getName(), 3); - } - $returnType = $this->typeProcessor->getGetterReturnType( - (new ClassReflection($this->_getSourceClassName())) - ->getMethod($method->getName()) - ); - $fieldName = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $propertyName)); - $methodInfo = [ - 'name' => 'set' . $propertyName, - 'parameters' => [ - ['name' => lcfirst($propertyName)], - ], - 'body' => "\$this->_set('{$fieldName}', \$" . lcfirst($propertyName) . ");" - . PHP_EOL . "return \$this;", - 'docblock' => [ - 'tags' => [ - ['name' => 'param', 'description' => $returnType['type'] . " \$" . lcfirst($propertyName)], - ['name' => 'return', 'description' => '$this'], - ], - ], - ]; - return $methodInfo; - } - - /** - * Generate code - * - * @return string - */ - protected function _generateCode() - { - $this->_classGenerator - ->setName($this->_getResultClassName()) - ->addProperties($this->_getClassProperties()) - ->addMethods($this->_getClassMethods()) - ->setClassDocBlock($this->_getClassDocBlock()) - ->setExtendedClass('\Magento\Framework\Api\Builder'); - return $this->_getGeneratedCode(); - } - - /** - * {@inheritdoc} - */ - protected function _getSourceClassName() - { - return $this->_getDataObjectType(); - } - - /** - * Get data object type based on suffix - * - * @return string - */ - protected function _getDataObjectType() - { - $currentBuilderClass = $this->_getResultClassName(); - $dataBuilderSuffix = 'DataBuilder'; - if (substr($currentBuilderClass, -strlen($dataBuilderSuffix)) === $dataBuilderSuffix) { - $dataObjectType = substr($currentBuilderClass, 0, -strlen($dataBuilderSuffix)) . 'Interface'; - } else { - $builderSuffix = 'Builder'; - $dataObjectType = substr($currentBuilderClass, 0, -strlen($builderSuffix)); - } - return $dataObjectType; - } - - /** - * Get a list of methods declared on extensible data interface. - * - * @return string[] - */ - protected function getExtensibleInterfaceMethods() - { - if ($this->extensibleInterfaceMethods === null) { - $interfaceReflection = new ClassReflection('Magento\Framework\Api\ExtensibleDataInterface'); - $methodsReflection = $interfaceReflection->getMethods(); - $this->extensibleInterfaceMethods = []; - foreach ($methodsReflection as $methodReflection) { - $this->extensibleInterfaceMethods[] = $methodReflection->getName(); - } - } - return $this->extensibleInterfaceMethods; - } -} diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/ObjectExtension.php b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php similarity index 72% rename from lib/internal/Magento/Framework/Api/Code/Generator/ObjectExtension.php rename to lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php index 28569195579c975131e800fe687ac45dfa88cb12..98f5dc5d5e07250fe7b427ca68286cb99c22ee35 100644 --- a/lib/internal/Magento/Framework/Api/Code/Generator/ObjectExtension.php +++ b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php @@ -12,7 +12,7 @@ use Magento\Framework\Api\SimpleDataObjectConverter; /** * Code generator for data object extensions. */ -class ObjectExtension extends \Magento\Framework\Code\Generator\EntityAbstract +class ExtensionAttributesGenerator extends \Magento\Framework\Code\Generator\EntityAbstract { const ENTITY_TYPE = 'extension'; @@ -70,16 +70,7 @@ class ObjectExtension extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getClassProperties() { - $properties = []; - foreach ($this->getCustomAttributes() as $attributeName => $attributeType) { - $propertyName = SimpleDataObjectConverter::snakeCaseToCamelCase($attributeName); - $properties[] = [ - 'name' => $propertyName, - 'visibility' => 'protected', - 'docblock' => ['tags' => [['name' => 'var', 'description' => $attributeType]]], - ]; - } - return $properties; + return []; } /** @@ -94,13 +85,13 @@ class ObjectExtension extends \Magento\Framework\Code\Generator\EntityAbstract $setterName = 'set' . ucfirst($propertyName); $methods[] = [ 'name' => $getterName, - 'body' => "return \$this->{$propertyName};", + 'body' => "return \$this->_get('{$attributeName}');", 'docblock' => ['tags' => [['name' => 'return', 'description' => $attributeType]]], ]; $methods[] = [ 'name' => $setterName, 'parameters' => [['name' => $propertyName]], - 'body' => "\$this->{$propertyName} = \${$propertyName};" . PHP_EOL . "return \$this;", + 'body' => "\$this->setData('{$attributeName}', \${$propertyName});" . PHP_EOL . "return \$this;", 'docblock' => [ 'tags' => [ [ @@ -123,18 +114,8 @@ class ObjectExtension extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _validateData() { - $result = true; - $sourceClassName = $this->_getSourceClassName(); - $resultClassName = $this->_getResultClassName(); - $interfaceSuffix = 'Interface'; - $expectedResultClassName = substr($sourceClassName, 0, -strlen($interfaceSuffix)) . self::EXTENSION_SUFFIX; - if ($resultClassName !== $expectedResultClassName) { - $this->_addError( - 'Invalid extension name [' . $resultClassName . ']. Use ' . $expectedResultClassName - ); - $result = false; - } - return parent::_validateData() && $result; + $classNameValidationResults = $this->validateResultClassName(); + return parent::_validateData() && $classNameValidationResults; } /** @@ -143,9 +124,20 @@ class ObjectExtension extends \Magento\Framework\Code\Generator\EntityAbstract protected function _generateCode() { $this->_classGenerator->setImplementedInterfaces([$this->_getResultClassName() . 'Interface']); + $this->_classGenerator->setExtendedClass($this->getExtendedClass()); return parent::_generateCode(); } + /** + * Get class, which should be used as a parent for generated class. + * + * @return string + */ + protected function getExtendedClass() + { + return '\Magento\Framework\Api\AbstractSimpleObject'; + } + /** * Retrieve a list of attributes associated with current source class. * @@ -156,11 +148,40 @@ class ObjectExtension extends \Magento\Framework\Code\Generator\EntityAbstract if (!isset($this->allCustomAttributes)) { $this->allCustomAttributes = $this->configReader->read(); } - $dataInterface = ltrim($this->_getSourceClassName(), '\\'); + $dataInterface = ltrim($this->getSourceClassName(), '\\'); if (isset($this->allCustomAttributes[$dataInterface])) { + foreach ($this->allCustomAttributes[$dataInterface] as $attributeName => $attributeType) { + if (strpos($attributeType, '\\') !== false) { + /** Add preceding slash to class names, while leaving primitive types as is */ + $attributeType = $this->_getFullyQualifiedClassName($attributeType); + $this->allCustomAttributes[$dataInterface][$attributeName] = + $this->_getFullyQualifiedClassName($attributeType); + } + } return $this->allCustomAttributes[$dataInterface]; } else { return []; } } + + /** + * Ensure that result class name corresponds to the source class name. + * + * @return bool + */ + protected function validateResultClassName() + { + $result = true; + $sourceClassName = $this->getSourceClassName(); + $resultClassName = $this->_getResultClassName(); + $interfaceSuffix = 'Interface'; + $expectedResultClassName = substr($sourceClassName, 0, -strlen($interfaceSuffix)) . self::EXTENSION_SUFFIX; + if ($resultClassName !== $expectedResultClassName) { + $this->_addError( + 'Invalid extension name [' . $resultClassName . ']. Use ' . $expectedResultClassName + ); + $result = false; + } + return $result; + } } diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/ObjectExtensionInterface.php b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesInterfaceGenerator.php similarity index 83% rename from lib/internal/Magento/Framework/Api/Code/Generator/ObjectExtensionInterface.php rename to lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesInterfaceGenerator.php index 73fb6556c2c0191a28b4c94e6f99f4754a631e55..59b6f225bb6c1d84acdfb20d96880980712b1bd2 100644 --- a/lib/internal/Magento/Framework/Api/Code/Generator/ObjectExtensionInterface.php +++ b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesInterfaceGenerator.php @@ -11,7 +11,7 @@ use Magento\Framework\Code\Generator\Io; /** * Code generator for data object extension interfaces. */ -class ObjectExtensionInterface extends \Magento\Framework\Api\Code\Generator\ObjectExtension +class ExtensionAttributesInterfaceGenerator extends \Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator { const ENTITY_TYPE = 'extensionInterface'; @@ -51,10 +51,18 @@ class ObjectExtensionInterface extends \Magento\Framework\Api\Code\Generator\Obj /** * {@inheritdoc} */ - protected function _validateData() + protected function getExtendedClass() + { + return '\Magento\Framework\Api\ExtensionAttributesInterface'; + } + + /** + * {@inheritdoc} + */ + protected function validateResultClassName() { $result = true; - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); $interfaceSuffix = 'Interface'; $expectedResultClassName = substr($sourceClassName, 0, -strlen($interfaceSuffix)) @@ -65,6 +73,6 @@ class ObjectExtensionInterface extends \Magento\Framework\Api\Code\Generator\Obj ); $result = false; } - return parent::_validateData() && $result; + return $result; } } diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/Mapper.php b/lib/internal/Magento/Framework/Api/Code/Generator/Mapper.php index 64d511448c03ff46aa1404b0d598721075c35f85..edd460f42bfd9deb68128a99da7f76353f290d68 100644 --- a/lib/internal/Magento/Framework/Api/Code/Generator/Mapper.php +++ b/lib/internal/Magento/Framework/Api/Code/Generator/Mapper.php @@ -31,7 +31,7 @@ class Mapper extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'var', - 'description' => $this->_getSourceClassName() . 'Builder', + 'description' => $this->getSourceClassName() . 'Builder', ], ], ], @@ -41,7 +41,7 @@ class Mapper extends \Magento\Framework\Code\Generator\EntityAbstract 'visibility' => 'protected', 'defaultValue' => [], 'docblock' => [ - 'shortDescription' => $this->_getSourceClassName() . '[]', + 'shortDescription' => $this->getSourceClassName() . '[]', 'tags' => [['name' => 'var', 'description' => 'array']], ] ], @@ -56,8 +56,7 @@ class Mapper extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getSourceBuilderPropertyName() { - $parts = explode('\\', ltrim($this->_getSourceClassName(), '\\')); - return lcfirst(end($parts)) . 'Builder'; + return lcfirst($this->getSourceClassNameWithoutNamespace()) . 'Builder'; } /** @@ -72,7 +71,7 @@ class Mapper extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => $this->_getSourceBuilderPropertyName(), - 'type' => $this->_getSourceClassName() . 'Builder', + 'type' => $this->getSourceClassName() . 'Builder', ], ], 'body' => "\$this->" @@ -83,7 +82,7 @@ class Mapper extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . " \$" . $this->_getSourceBuilderPropertyName(), + 'description' => $this->getSourceClassName() . " \$" . $this->_getSourceBuilderPropertyName(), ], ], ] @@ -118,7 +117,7 @@ class Mapper extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => 'return', - 'description' => $this->_getSourceClassName(), + 'description' => $this->getSourceClassName(), ], ], ], @@ -134,7 +133,7 @@ class Mapper extends \Magento\Framework\Code\Generator\EntityAbstract $result = parent::_validateData(); if ($result) { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== $sourceClassName . 'Mapper') { diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResults.php b/lib/internal/Magento/Framework/Api/Code/Generator/SearchResults.php index c1613b0628dc93bcc9334438f45f47952521996c..32a4071ebf0c7aaa15f45c2a6cf966c91313472c 100644 --- a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResults.php +++ b/lib/internal/Magento/Framework/Api/Code/Generator/SearchResults.php @@ -51,7 +51,7 @@ class SearchResults extends EntityAbstract 'tags' => [ [ 'name' => 'return', - 'description' => $this->_getSourceClassName() . '[]', + 'description' => $this->getSourceClassName() . '[]', ], ], ], diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php b/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php deleted file mode 100644 index 0e7d054a9840339ce017a772c95c63cb171e4ef8..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php +++ /dev/null @@ -1,130 +0,0 @@ -<?php -/** - * @category Magento - * @package Magento_Code - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Api\Code\Generator; - -use Magento\Framework\Code\Generator\EntityAbstract; - -/** - * Class Builder - */ -class SearchResultsBuilder extends EntityAbstract -{ - /** - * Entity type - */ - const ENTITY_TYPE = 'searchResultsBuilder'; - - /** - * Search result builder abstract class - */ - const SEARCH_RESULT_BUILDER = '\\Magento\Framework\Api\AbstractSearchResultsBuilder'; - - /** - * Retrieve class properties - * - * @return array - */ - protected function _getClassProperties() - { - return []; - } - - /** - * Get default constructor definition for generated class - * - * @return array - */ - protected function _getDefaultConstructorDefinition() - { - return [ - 'name' => '__construct', - 'parameters' => [ - [ - 'name' => 'objectFactory', - 'type' => '\\Magento\Framework\Api\ObjectFactory', - ], - [ - 'name' => 'valueFactory', - 'type' => '\\Magento\Framework\Api\AttributeValueFactory' - ], - [ - 'name' => 'metadataService', - 'type' => '\\Magento\Framework\Api\Config\MetadataConfig' - ], - [ - 'name' => 'searchCriteriaBuilder', - 'type' => '\\Magento\Framework\Api\SearchCriteriaBuilder' - ], - [ - 'name' => 'itemObjectBuilder', - 'type' => $this->_getSourceClassName() . 'Builder' - ], - ], - 'body' => "parent::__construct(\$objectFactory, \$valueFactory, \$metadataService, " . - "\$searchCriteriaBuilder, \$itemObjectBuilder);", - 'docblock' => [ - 'shortDescription' => ucfirst(static::ENTITY_TYPE) . ' constructor', - 'tags' => [ - [ - 'name' => 'param', - 'description' => '', - ], - ], - ] - ]; - } - - /** - * Returns list of methods for class generator - * - * @return array - */ - protected function _getClassMethods() - { - return [$this->_getDefaultConstructorDefinition()]; - } - - /** - * {@inheritdoc} - */ - protected function _validateData() - { - $result = parent::_validateData(); - - if ($result) { - $sourceClassName = $this->_getSourceClassName(); - $resultClassName = $this->_getResultClassName(); - - if ($resultClassName !== $sourceClassName . 'SearchResultsBuilder') { - $this->_addError( - 'Invalid Result class name [' . $resultClassName . ']. Use ' - . $sourceClassName . 'SearchResultsBuilder' - ); - $result = false; - } - } - return $result; - } - - /** - * Generate code - * - * @return string - */ - protected function _generateCode() - { - $this->_classGenerator->setName( - $this->_getResultClassName() - )->addMethods( - $this->_getClassMethods() - )->setClassDocBlock( - $this->_getClassDocBlock() - )->setExtendedClass(self::SEARCH_RESULT_BUILDER); - return $this->_getGeneratedCode(); - } -} diff --git a/lib/internal/Magento/Framework/Api/Config/MetadataConfig.php b/lib/internal/Magento/Framework/Api/Config/MetadataConfig.php deleted file mode 100644 index 59f39f342cae672126b81a222788d4ea309b1092..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Config/MetadataConfig.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api\Config; - -use Magento\Framework\Api\AttributeMetadataBuilderInterface; -use Magento\Framework\Api\Config\Reader as ServiceConfigReader; -use Magento\Framework\Api\MetadataServiceInterface; - -/** - * Class which allows to get a metadata of the attributes declared in a config. - */ -class MetadataConfig implements MetadataServiceInterface -{ - /** - * @var ServiceConfigReader - */ - private $serviceConfigReader; - - /** - * @var AttributeMetadataBuilderInterface - */ - private $attributeMetadataBuilder; - - /** - * @var array - */ - private $allAttributes = []; - - /** - * Initialize dependencies. - * - * @param ServiceConfigReader $serviceConfigReader - * @param AttributeMetadataBuilderInterface $attributeMetadataBuilder - */ - public function __construct( - ServiceConfigReader $serviceConfigReader, - AttributeMetadataBuilderInterface $attributeMetadataBuilder - ) { - $this->serviceConfigReader = $serviceConfigReader; - $this->attributeMetadataBuilder = $attributeMetadataBuilder; - } - - /** - * {@inheritdoc} - */ - public function getCustomAttributesMetadata($dataObjectClassName = null) - { - $attributes = []; - if (!is_null($this->attributeMetadataBuilder) && !is_null($dataObjectClassName)) { - /** - * Attribute metadata builder and data object class name are expected to be configured - * via DI using virtual types. If configuration is missing, empty array should be returned. - */ - $attributes = $this->getAttributesMetadata($dataObjectClassName); - $implementedInterfaces = (new \ReflectionClass($dataObjectClassName))->getInterfaceNames(); - foreach ($implementedInterfaces as $interfaceName) { - $attributes = array_merge($attributes, $this->getAttributesMetadata($interfaceName)); - } - } - return $attributes; - } - - /** - * Get custom attribute metadata for the given class/interface. - * - * @param string $dataObjectClassName - * @return \Magento\Framework\Api\MetadataObjectInterface[] - */ - protected function getAttributesMetadata($dataObjectClassName) - { - $attributes = []; - if (empty($this->allAttributes)) { - $this->allAttributes = $this->serviceConfigReader->read(); - } - $dataObjectClassName = ltrim($dataObjectClassName, '\\'); - if (isset($this->allAttributes[$dataObjectClassName]) - && is_array($this->allAttributes[$dataObjectClassName]) - ) { - $attributeCodes = array_keys($this->allAttributes[$dataObjectClassName]); - foreach ($attributeCodes as $attributeCode) { - $this->attributeMetadataBuilder->setAttributeCode($attributeCode); - $attributes[$attributeCode] = $this->attributeMetadataBuilder->create(); - } - } - return $attributes; - } -} diff --git a/lib/internal/Magento/Framework/Api/CustomAttributesDataInterface.php b/lib/internal/Magento/Framework/Api/CustomAttributesDataInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..239066d34c0f9515b83a771f2d4711620e0309c6 --- /dev/null +++ b/lib/internal/Magento/Framework/Api/CustomAttributesDataInterface.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Api; + +/** + * Interface for entities which can be extended with custom attributes. + */ +interface CustomAttributesDataInterface extends ExtensibleDataInterface +{ + /** + * Array key for custom attributes + */ + const CUSTOM_ATTRIBUTES = 'custom_attributes'; + + /** + * Get an attribute value. + * + * @param string $attributeCode + * @return \Magento\Framework\Api\AttributeInterface|null + */ + public function getCustomAttribute($attributeCode); + + /** + * Set an attribute value for a given attribute code + * + * @param string $attributeCode + * @param mixed $attributeValue + * @return $this + */ + public function setCustomAttribute($attributeCode, $attributeValue); + + /** + * Retrieve custom attributes values. + * + * @return \Magento\Framework\Api\AttributeInterface[]|null + */ + public function getCustomAttributes(); + + /** + * Set array of custom attributes + * + * @param \Magento\Framework\Api\AttributeInterface[] $attributes + * @return $this + * @throws \LogicException + */ + public function setCustomAttributes(array $attributes); +} diff --git a/lib/internal/Magento/Framework/Api/DataObjectHelper.php b/lib/internal/Magento/Framework/Api/DataObjectHelper.php index 371b610c59c23972694d5b96d711d51ac7aa8a68..f7d16e57321607846234dcda516586e873ad75c2 100644 --- a/lib/internal/Magento/Framework/Api/DataObjectHelper.php +++ b/lib/internal/Magento/Framework/Api/DataObjectHelper.php @@ -23,19 +23,27 @@ class DataObjectHelper */ protected $typeProcessor; + /** + * @var \Magento\Framework\Api\ExtensionAttributesFactory + */ + protected $extensionFactory; + /** * @param ObjectFactory $objectFactory * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory */ public function __construct( ObjectFactory $objectFactory, \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor + \Magento\Framework\Reflection\TypeProcessor $typeProcessor, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory ) { $this->objectFactory = $objectFactory; $this->objectProcessor = $objectProcessor; $this->typeProcessor = $typeProcessor; + $this->extensionFactory = $extensionFactory; } /** @@ -44,7 +52,7 @@ class DataObjectHelper * @param string $interfaceName * @return $this */ - public function populateWithArray($dataObject, array $data, $interfaceName = null) + public function populateWithArray($dataObject, array $data, $interfaceName) { $this->_setDataValues($dataObject, $data, $interfaceName); return $this; @@ -69,7 +77,7 @@ class DataObjectHelper 'set' . $camelCaseKey, 'setIs' . $camelCaseKey, ]; - if ($key === ExtensibleDataInterface::CUSTOM_ATTRIBUTES + if ($key === CustomAttributesDataInterface::CUSTOM_ATTRIBUTES && ($dataObject instanceof ExtensibleDataInterface) && is_array($data[$key]) && !empty($data[$key]) @@ -83,7 +91,11 @@ class DataObjectHelper } elseif ($methodNames = array_intersect($possibleMethods, $dataObjectMethods)) { $methodName = array_values($methodNames)[0]; if (!is_array($value)) { - $dataObject->$methodName($value); + if ($methodName === 'setExtensionAttributes' && is_null($value)) { + // Cannot pass a null value to a method with a typed parameter + } else { + $dataObject->$methodName($value); + } } else { $getterMethodName = 'get' . $camelCaseKey; $this->setComplexValue($dataObject, $getterMethodName, $methodName, $value, $interfaceName); @@ -137,6 +149,8 @@ class DataObjectHelper if (is_subclass_of($returnType, '\Magento\Framework\Api\ExtensibleDataInterface')) { $object = $this->objectFactory->create($returnType, []); $this->populateWithArray($object, $value, $returnType); + } else if (is_subclass_of($returnType, '\Magento\Framework\Api\ExtensionAttributesInterface')) { + $object = $this->extensionFactory->create(get_class($dataObject), $value); } else { $object = $this->objectFactory->create($returnType, $value); } diff --git a/lib/internal/Magento/Framework/Api/DefaultMetadataService.php b/lib/internal/Magento/Framework/Api/DefaultMetadataService.php new file mode 100644 index 0000000000000000000000000000000000000000..5a5d2e6a9e23365ad3f59c3ee9995e7269dbf2f9 --- /dev/null +++ b/lib/internal/Magento/Framework/Api/DefaultMetadataService.php @@ -0,0 +1,21 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Api; + +/** + * Default implementation of metadata service, which does not return any real attributes. + */ +class DefaultMetadataService implements MetadataServiceInterface +{ + /** + * {@inheritdoc} + */ + public function getCustomAttributesMetadata($dataObjectClassName = null) + { + return []; + } +} diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php b/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php index ba6efb39290912c10079cf2d9a3cb0bc83339f4c..6dd8f258b4db78768cf90ca0b9fd182d33f47587 100644 --- a/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php +++ b/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php @@ -7,45 +7,12 @@ namespace Magento\Framework\Api; /** - * Interface for entities which can be extended with custom attributes. + * Interface for entities which can be extended with extension attributes. */ interface ExtensibleDataInterface { /** - * Array key for custom attributes + * Key for extension attributes object */ - const CUSTOM_ATTRIBUTES = 'custom_attributes'; - - /** - * Get an attribute value. - * - * @param string $attributeCode - * @return \Magento\Framework\Api\AttributeInterface|null - */ - public function getCustomAttribute($attributeCode); - - /** - * Set an attribute value for a given attribute code - * - * @param string $attributeCode - * @param mixed $attributeValue - * @return $this - */ - public function setCustomAttribute($attributeCode, $attributeValue); - - /** - * Retrieve custom attributes values. - * - * @return \Magento\Framework\Api\AttributeInterface[]|null - */ - public function getCustomAttributes(); - - /** - * Set array of custom attributes - * - * @param \Magento\Framework\Api\AttributeInterface[] $attributes - * @return $this - * @throws \LogicException - */ - public function setCustomAttributes(array $attributes); + const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'; } diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php b/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php index 22cad52d286c54b40ee7c5546e49990d0772a0c6..2ad42cac8b20c4a49347928a84811aa788797c90 100644 --- a/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php +++ b/lib/internal/Magento/Framework/Api/ExtensibleDataObjectConverter.php @@ -31,13 +31,13 @@ class ExtensibleDataObjectConverter * Convert AbstractExtensibleObject into a nested array. * * @param ExtensibleDataInterface $dataObject - * @param string[] $skipCustomAttributes + * @param string[] $skipAttributes * @param string $dataObjectType * @return array */ public function toNestedArray( ExtensibleDataInterface $dataObject, - $skipCustomAttributes = [], + $skipAttributes = [], $dataObjectType = null ) { if ($dataObjectType == null) { @@ -50,12 +50,22 @@ class ExtensibleDataObjectConverter $customAttributes = $dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]; unset ($dataObjectArray[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY]); foreach ($customAttributes as $attributeValue) { - if (!in_array($attributeValue[AttributeValue::ATTRIBUTE_CODE], $skipCustomAttributes)) { + if (!in_array($attributeValue[AttributeValue::ATTRIBUTE_CODE], $skipAttributes)) { $dataObjectArray[$attributeValue[AttributeValue::ATTRIBUTE_CODE]] = $attributeValue[AttributeValue::VALUE]; } } } + if (!empty($dataObjectArray[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY])) { + /** @var array $extensionAttributes */ + $extensionAttributes = $dataObjectArray[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]; + unset ($dataObjectArray[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]); + foreach ($extensionAttributes as $attributeKey => $attributeValue) { + if (!in_array($attributeKey, $skipAttributes)) { + $dataObjectArray[$attributeKey] = $attributeValue; + } + } + } return $dataObjectArray; } diff --git a/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php b/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php deleted file mode 100644 index fcd13b96d9e437c35d465a35d49929a0e0fab604..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php +++ /dev/null @@ -1,239 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Api; - -/** - * Base Builder Class for extensible data Objects - * @SuppressWarnings(PHPMD.NumberOfChildren) - */ -class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements BuilderInterface -{ - /** - * @var \Magento\Framework\Api\AttributeValueFactory - */ - protected $attributeValueFactory; - - /** - * @var MetadataServiceInterface - */ - protected $metadataService; - - /** - * @var string[] - */ - protected $customAttributesCodes = null; - - /** - * @var string - */ - protected $modelClassInterface; - - /** - * @param \Magento\Framework\Api\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\AttributeValueFactory $valueFactory - * @param MetadataServiceInterface $metadataService - * @param string|null $modelClassInterface - */ - public function __construct( - \Magento\Framework\Api\ObjectFactory $objectFactory, - \Magento\Framework\Api\AttributeValueFactory $valueFactory, - MetadataServiceInterface $metadataService, - $modelClassInterface = null - ) { - $this->attributeValueFactory = $valueFactory; - $this->metadataService = $metadataService; - $this->modelClassInterface = $modelClassInterface; - parent::__construct($objectFactory); - } - - /** - * Builds the Data Object - * - * @return AbstractExtensibleObject - */ - public function create() - { - $dataObjectType = $this->_getDataObjectType(); - $dataObject = $this->objectFactory->create( - $dataObjectType, - ['attributeValueFactory' => $this->attributeValueFactory, 'data' => $this->getData()] - ); - $this->data = []; - return $dataObject; - } - - /** - * {@inheritdoc} - */ - public function setCustomAttributes(array $attributes) - { - $customAttributesCodes = $this->getCustomAttributesCodes(); - foreach ($attributes as $attribute) { - if (!$attribute instanceof AttributeValue) { - throw new \LogicException('Custom Attribute array elements can only be type of AttributeValue'); - } - $attributeCode = $attribute->getAttributeCode(); - if (in_array($attributeCode, $customAttributesCodes)) { - $this->data[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute; - } - } - return $this; - } - - /** - * {@inheritdoc} - */ - public function setCustomAttribute($attributeCode, $attributeValue) - { - $customAttributesCodes = $this->getCustomAttributesCodes(); - /* If key corresponds to custom attribute code, populate custom attributes */ - if (in_array($attributeCode, $customAttributesCodes)) { - $attribute = $this->attributeValueFactory->create() - ->setAttributeCode($attributeCode) - ->setValue($attributeValue); - $this->data[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute; - } - return $this; - } - - /** - * Populates the fields with an existing entity. - * - * @param ExtensibleDataInterface $prototype the prototype to base on - * @return $this - * @throws \LogicException If $prototype object class is not the same type as object that is constructed - */ - public function populate(ExtensibleDataInterface $prototype) - { - $objectType = $this->_getDataObjectType(); - if (!($prototype instanceof $objectType)) { - throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.'); - } - return $this->populateWithArray($prototype->__toArray()); - } - - /** - * Populates the fields with data from the array. - * - * Keys for the map are snake_case attribute/field names. - * - * @param array $data - * @return $this - */ - public function populateWithArray(array $data) - { - $this->data = []; - $this->_setDataValues($data); - return $this; - } - - /** - * Merge second Data Object data with first Data Object data and create new Data Object object based on merge - * result. - * - * @param ExtensibleDataInterface $firstDataObject - * @param ExtensibleDataInterface $secondDataObject - * @return $this - * @throws \LogicException - */ - public function mergeDataObjects( - ExtensibleDataInterface $firstDataObject, - ExtensibleDataInterface $secondDataObject - ) { - $objectType = $this->_getDataObjectType(); - if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) { - throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.'); - } - $this->_setDataValues($firstDataObject->__toArray()); - $this->_setDataValues($secondDataObject->__toArray()); - return $this; - } - - /** - * Merged data provided in array format with Data Object data and create new Data Object object based on merge - * result. - * - * @param ExtensibleDataInterface $dataObject - * @param array $data - * @return $this - * @throws \LogicException - */ - public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data) - { - $objectType = $this->_getDataObjectType(); - if (!($dataObject instanceof $objectType)) { - throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.'); - } - $this->_setDataValues($dataObject->__toArray()); - $this->_setDataValues($data); - return $this; - } - - /** - * Template method used to configure the attribute codes for the custom attributes - * - * @return string[] - */ - protected function getCustomAttributesCodes() - { - if (!is_null($this->customAttributesCodes)) { - return $this->customAttributesCodes; - } - $attributeCodes = []; - $customAttributesMetadata = $this->metadataService->getCustomAttributesMetadata($this->_getDataObjectType()); - if (is_array($customAttributesMetadata)) { - foreach ($customAttributesMetadata as $attribute) { - $attributeCodes[] = $attribute->getAttributeCode(); - } - } - $this->customAttributesCodes = $attributeCodes; - return $attributeCodes; - } - - /** - * Initializes Data Object with the data from array - * - * @param array $data - * @return $this - */ - protected function _setDataValues(array $data) - { - $dataObjectMethods = get_class_methods($this->_getDataObjectType()); - foreach ($data as $key => $value) { - /* First, verify is there any getter for the key on the Service Data Object */ - $camelCaseKey = \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key); - $possibleMethods = [ - 'get' . $camelCaseKey, - 'is' . $camelCaseKey, - ]; - if ($key == AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY - && is_array($data[$key]) - && !empty($data[$key]) - ) { - foreach ($data[$key] as $customAttribute) { - $this->setCustomAttribute( - $customAttribute[AttributeValue::ATTRIBUTE_CODE], - $customAttribute[AttributeValue::VALUE] - ); - } - } elseif (array_intersect($possibleMethods, $dataObjectMethods)) { - $this->data[$key] = $value; - } else { - $this->setCustomAttribute($key, $value); - } - } - return $this; - } - - /** - * {@inheritdoc} - */ - protected function _getDataObjectType() - { - return $this->modelClassInterface ?: parent::_getDataObjectType(); - } -} diff --git a/lib/internal/Magento/Framework/Api/ExtensionAttributesFactory.php b/lib/internal/Magento/Framework/Api/ExtensionAttributesFactory.php new file mode 100644 index 0000000000000000000000000000000000000000..e50b83d11c7a95758ed9d8f07a4231419018e43a --- /dev/null +++ b/lib/internal/Magento/Framework/Api/ExtensionAttributesFactory.php @@ -0,0 +1,87 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Api; + +/** + * Factory class for instantiation of extension attributes objects. + */ +class ExtensionAttributesFactory +{ + /** + * Object Manager instance + * + * @var \Magento\Framework\ObjectManagerInterface + */ + protected $_objectManager = null; + + /** + * Factory constructor + * + * @param \Magento\Framework\ObjectManagerInterface $objectManager + */ + public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager) + { + $this->_objectManager = $objectManager; + } + + /** + * Create extension attributes object, custom for each extensible class. + * + * @param string $extensibleClassName + * @param array $data + * @return object + */ + public function create($extensibleClassName, $data = []) + { + $modelReflection = new \ReflectionClass($extensibleClassName); + + $implementsExtensibleInterface = false; + $extensibleInterfaceName = 'Magento\Framework\Api\ExtensibleDataInterface'; + foreach ($modelReflection->getInterfaces() as $interfaceReflection) { + if ($interfaceReflection->isSubclassOf($extensibleInterfaceName) + && $interfaceReflection->hasMethod('getExtensionAttributes') + ) { + $implementsExtensibleInterface = true; + break; + } + } + if (!$implementsExtensibleInterface) { + throw new \LogicException( + "Class '{$extensibleClassName}' must implement an interface, " + . "which extends from 'Magento\\Framework\\Api\\ExtensibleDataInterface'" + ); + } + + $methodReflection = $interfaceReflection->getMethod('getExtensionAttributes'); + if ($methodReflection->getDeclaringClass() == $extensibleInterfaceName) { + throw new \LogicException( + "Method 'getExtensionAttributes' must be overridden in the interfaces " + . "which extend 'Magento\\Framework\\Api\\ExtensibleDataInterface'. " + . "Concrete return type should be specified." + ); + } + + $interfaceName = '\\' . $interfaceReflection->getName(); + $extensionClassName = substr($interfaceName, 0, -strlen('Interface')) . 'Extension'; + $extensionInterfaceName = $extensionClassName . 'Interface'; + + /** Ensure that proper return type of getExtensionAttributes() method is specified */ + $methodDocBlock = $methodReflection->getDocComment(); + $pattern = "/@return\s+" . str_replace('\\', '\\\\', $extensionInterfaceName) . "/"; + if (!preg_match($pattern, $methodDocBlock)) { + throw new \LogicException( + "Method 'getExtensionAttributes' must be overridden in the interfaces " + . "which extend 'Magento\\Framework\\Api\\ExtensibleDataInterface'. " + . "Concrete return type must be specified. Please fix :" . $interfaceName + ); + } + + $extensionFactoryName = $extensionClassName . 'Factory'; + $extensionFactory = $this->_objectManager->create($extensionFactoryName); + return $extensionFactory->create($data); + } +} diff --git a/lib/internal/Magento/Framework/Api/SearchCriteriaDataBuilder.php b/lib/internal/Magento/Framework/Api/ExtensionAttributesInterface.php similarity index 52% rename from lib/internal/Magento/Framework/Api/SearchCriteriaDataBuilder.php rename to lib/internal/Magento/Framework/Api/ExtensionAttributesInterface.php index bbd5f434dc6d202330e806cd13ae3f4ea8b70e5c..aef1607c31dae9747711da2459a0fffabf4028c8 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteriaDataBuilder.php +++ b/lib/internal/Magento/Framework/Api/ExtensionAttributesInterface.php @@ -7,8 +7,8 @@ namespace Magento\Framework\Api; /** - * TODO: Temporary search criteria builder builder + * Marker interface for all extension attributes interfaces. */ -class SearchCriteriaDataBuilder extends \Magento\Framework\Api\SearchCriteriaBuilder +interface ExtensionAttributesInterface { } diff --git a/lib/internal/Magento/Framework/Api/Filter.php b/lib/internal/Magento/Framework/Api/Filter.php index df982867020c24d045d823b44184cacbb5d666c3..b803e5fe926241667b8e1ae04969b6bc36e8fb23 100644 --- a/lib/internal/Magento/Framework/Api/Filter.php +++ b/lib/internal/Magento/Framework/Api/Filter.php @@ -6,11 +6,21 @@ namespace Magento\Framework\Api; +use Magento\Framework\Api\AbstractSimpleObject; + /** * Filter which can be used by any methods from service layer. + * @codeCoverageIgnore */ -class Filter extends AbstractExtensibleObject +class Filter extends AbstractSimpleObject { + /**#@+ + * Constants for Data Object keys + */ + const KEY_FIELD = 'field'; + const KEY_VALUE = 'value'; + const KEY_CONDITION_TYPE = 'condition_type'; + /** * Get field * @@ -18,7 +28,18 @@ class Filter extends AbstractExtensibleObject */ public function getField() { - return $this->_get('field'); + return $this->_get(self::KEY_FIELD); + } + + /** + * Set field + * + * @param string $field + * @return $this + */ + public function setField($field) + { + return $this->setData(self::KEY_FIELD, $field); } /** @@ -28,7 +49,18 @@ class Filter extends AbstractExtensibleObject */ public function getValue() { - return $this->_get('value'); + return $this->_get(self::KEY_VALUE); + } + + /** + * Set value + * + * @param string $value + * @return $this + */ + public function setValue($value) + { + return $this->setData(self::KEY_VALUE, $value); } /** @@ -38,6 +70,17 @@ class Filter extends AbstractExtensibleObject */ public function getConditionType() { - return $this->_get('condition_type'); + return $this->_get(self::KEY_CONDITION_TYPE); + } + + /** + * Set condition type + * + * @param string $conditionType + * @return $this + */ + public function setConditionType($conditionType) + { + return $this->setData(self::KEY_CONDITION_TYPE, $conditionType); } } diff --git a/lib/internal/Magento/Framework/Api/FilterBuilder.php b/lib/internal/Magento/Framework/Api/FilterBuilder.php index 598e9c48315fd479087639c93eda6d6e3f25bf3a..7bd8ceba85a89ae9119b508353b319f8437dfd5a 100644 --- a/lib/internal/Magento/Framework/Api/FilterBuilder.php +++ b/lib/internal/Magento/Framework/Api/FilterBuilder.php @@ -11,7 +11,7 @@ namespace Magento\Framework\Api; * * @method Filter create() */ -class FilterBuilder extends \Magento\Framework\Api\Builder +class FilterBuilder extends AbstractSimpleObjectBuilder { /** * Set field diff --git a/lib/internal/Magento/Framework/Api/MetadataObjectInterface.php b/lib/internal/Magento/Framework/Api/MetadataObjectInterface.php index 8a333df1e6729791118889225468f53f27c02728..3d752ed3e558ca03b3d80a2d52f2033cce358a68 100644 --- a/lib/internal/Magento/Framework/Api/MetadataObjectInterface.php +++ b/lib/internal/Magento/Framework/Api/MetadataObjectInterface.php @@ -14,4 +14,12 @@ interface MetadataObjectInterface * @return string */ public function getAttributeCode(); + + /** + * Set code of the attribute. + * + * @param string $attributeCode + * @return $this + */ + public function setAttributeCode($attributeCode); } diff --git a/lib/internal/Magento/Framework/Api/Search/FilterGroup.php b/lib/internal/Magento/Framework/Api/Search/FilterGroup.php index d48e11851fb5bab51b7d94daa50d6f1302acd34b..ae1dd308b647b51505a176987ec1ba8d2b6363c2 100644 --- a/lib/internal/Magento/Framework/Api/Search/FilterGroup.php +++ b/lib/internal/Magento/Framework/Api/Search/FilterGroup.php @@ -6,12 +6,12 @@ namespace Magento\Framework\Api\Search; -use Magento\Framework\Api\AbstractExtensibleObject; +use Magento\Framework\Api\AbstractSimpleObject; /** * Groups two or more filters together using a logical OR */ -class FilterGroup extends AbstractExtensibleObject +class FilterGroup extends AbstractSimpleObject { const FILTERS = 'filters'; @@ -25,4 +25,16 @@ class FilterGroup extends AbstractExtensibleObject $filters = $this->_get(self::FILTERS); return is_null($filters) ? [] : $filters; } + + /** + * Set filters + * + * @param \Magento\Framework\Api\Filter[] $filters + * @return $this + * @codeCoverageIgnore + */ + public function setFilters(array $filters = null) + { + return $this->setData(self::FILTERS, $filters); + } } diff --git a/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php b/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php index a9c68bf8dd2622c6b18895d00700c880c6ec9c34..afc1dca15ffbfb7b4451be38939aa6c6ea9326be 100644 --- a/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php +++ b/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php @@ -6,15 +6,14 @@ namespace Magento\Framework\Api\Search; -use Magento\Framework\Api\Builder; +use Magento\Framework\Api\AbstractSimpleObjectBuilder; use Magento\Framework\Api\FilterBuilder; -use Magento\Framework\Api\MetadataServiceInterface; use Magento\Framework\Api\ObjectFactory; /** * Builder for FilterGroup Data. */ -class FilterGroupBuilder extends Builder +class FilterGroupBuilder extends AbstractSimpleObjectBuilder { /** * @var FilterBuilder @@ -23,35 +22,14 @@ class FilterGroupBuilder extends Builder /** * @param ObjectFactory $objectFactory - * @param MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig * @param FilterBuilder $filterBuilder - * @param string|null $modelClassInterface */ public function __construct( ObjectFactory $objectFactory, - MetadataServiceInterface $metadataService, - \Magento\Framework\Api\AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - FilterBuilder $filterBuilder, - $modelClassInterface = null + FilterBuilder $filterBuilder ) { parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - $modelClassInterface + $objectFactory ); $this->_filterBuilder = $filterBuilder; } @@ -78,19 +56,4 @@ class FilterGroupBuilder extends Builder { return $this->_set(FilterGroup::FILTERS, $filters); } - - /** - * {@inheritdoc} - */ - protected function _setDataValues(array $data) - { - if (isset($data[FilterGroup::FILTERS])) { - $filters = []; - foreach ($data[FilterGroup::FILTERS] as $filter) { - $filters[] = $this->_filterBuilder->populateWithArray($filter)->create(); - } - $data[FilterGroup::FILTERS] = $filters; - } - return parent::_setDataValues($data); - } } diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria.php b/lib/internal/Magento/Framework/Api/SearchCriteria.php index 0a704699494bc84bb6df3ac15b8fd6d7142f5c36..727be2cac88b47b98e73fc919a2cb47057997433 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria.php @@ -6,11 +6,11 @@ namespace Magento\Framework\Api; - /** * Data Object for SearchCriteria + * @codeCoverageIgnore */ -class SearchCriteria extends AbstractExtensibleObject implements SearchCriteriaInterface +class SearchCriteria extends AbstractSimpleObject implements SearchCriteriaInterface { /**#@+ * Constants for Data Object keys @@ -59,4 +59,48 @@ class SearchCriteria extends AbstractExtensibleObject implements SearchCriteriaI { return $this->_get(self::CURRENT_PAGE); } + + /** + * Set a list of filter groups. + * + * @param \Magento\Framework\Api\Search\FilterGroup[] $filterGroups + * @return $this + */ + public function setFilterGroups(array $filterGroups = null) + { + return $this->setData(self::FILTER_GROUPS, $filterGroups); + } + + /** + * Set sort order. + * + * @param \Magento\Framework\Api\SortOrder[] $sortOrders + * @return $this + */ + public function setSortOrders(array $sortOrders = null) + { + return $this->setData(self::SORT_ORDERS, $sortOrders); + } + + /** + * Set page size. + * + * @param int $pageSize + * @return $this + */ + public function setPageSize($pageSize) + { + return $this->setData(self::PAGE_SIZE, $pageSize); + } + + /** + * Set current page. + * + * @param int $currentPage + * @return $this + */ + public function setCurrentPage($currentPage) + { + return $this->setData(self::CURRENT_PAGE, $currentPage); + } } diff --git a/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php b/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php index 84edfa1a2f3205fd3d71de20e4dd240e36489d20..faec4510efc5c8c0a0f77bef7929fe387b4ec60a 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php @@ -11,7 +11,7 @@ use Magento\Framework\Api\Search\FilterGroupBuilder; /** * Builder for SearchCriteria Service Data Object */ -class SearchCriteriaBuilder extends Builder +class SearchCriteriaBuilder extends AbstractSimpleObjectBuilder { /** * @var FilterGroupBuilder @@ -20,35 +20,14 @@ class SearchCriteriaBuilder extends Builder /** * @param ObjectFactory $objectFactory - * @param MetadataServiceInterface $metadataService - * @param AttributeValueFactory $attributeValueFactory - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig * @param FilterGroupBuilder $filterGroupBuilder - * @param string|null $modelClassInterface */ public function __construct( ObjectFactory $objectFactory, - MetadataServiceInterface $metadataService, - AttributeValueFactory $attributeValueFactory, - \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, - \Magento\Framework\Reflection\TypeProcessor $typeProcessor, - \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, - \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, - FilterGroupBuilder $filterGroupBuilder, - $modelClassInterface = null + FilterGroupBuilder $filterGroupBuilder ) { parent::__construct( - $objectFactory, - $metadataService, - $attributeValueFactory, - $objectProcessor, - $typeProcessor, - $dataBuilderFactory, - $objectManagerConfig, - $modelClassInterface + $objectFactory ); $this->_filterGroupBuilder = $filterGroupBuilder; } diff --git a/lib/internal/Magento/Framework/Api/SearchCriteriaInterface.php b/lib/internal/Magento/Framework/Api/SearchCriteriaInterface.php index 87e57f53aa35034c2f1c40d6eb7b433ade582343..96535d03e30d512a41edc60638e398fc3b8dacc7 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteriaInterface.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteriaInterface.php @@ -21,6 +21,14 @@ interface SearchCriteriaInterface */ public function getFilterGroups(); + /** + * Set a list of filter groups. + * + * @param \Magento\Framework\Api\Search\FilterGroup[] $filterGroups + * @return $this + */ + public function setFilterGroups(array $filterGroups = null); + /** * Get sort order. * @@ -28,6 +36,14 @@ interface SearchCriteriaInterface */ public function getSortOrders(); + /** + * Set sort order. + * + * @param \Magento\Framework\Api\SortOrder[] $sortOrders + * @return $this + */ + public function setSortOrders(array $sortOrders = null); + /** * Get page size. * @@ -35,10 +51,26 @@ interface SearchCriteriaInterface */ public function getPageSize(); + /** + * Set page size. + * + * @param int $pageSize + * @return $this + */ + public function setPageSize($pageSize); + /** * Get current page. * * @return int|null */ public function getCurrentPage(); + + /** + * Set current page. + * + * @param int $currentPage + * @return $this + */ + public function setCurrentPage($currentPage); } diff --git a/lib/internal/Magento/Framework/Api/SearchResults.php b/lib/internal/Magento/Framework/Api/SearchResults.php index ad1481e9dde6afbc0b84349a111498e52913615a..8d5b998e99a6de80cdc0377230e58b6c36efe8a1 100644 --- a/lib/internal/Magento/Framework/Api/SearchResults.php +++ b/lib/internal/Magento/Framework/Api/SearchResults.php @@ -9,7 +9,7 @@ namespace Magento\Framework\Api; /** * SearchResults Service Data Object used for the search service requests */ -class SearchResults extends \Magento\Framework\Api\AbstractExtensibleObject +class SearchResults extends AbstractSimpleObject { const KEY_ITEMS = 'items'; const KEY_SEARCH_CRITERIA = 'search_criteria'; diff --git a/lib/internal/Magento/Framework/Api/SearchResultsInterface.php b/lib/internal/Magento/Framework/Api/SearchResultsInterface.php index 03806a89948c07e219729ada16996ee4c97aa9c4..fdf4bce22dc9f5ba200bf4e0628ccf27501681e1 100644 --- a/lib/internal/Magento/Framework/Api/SearchResultsInterface.php +++ b/lib/internal/Magento/Framework/Api/SearchResultsInterface.php @@ -18,6 +18,14 @@ interface SearchResultsInterface */ public function getItems(); + /** + * Set items list. + * + * @param \Magento\Framework\Api\ExtensibleDataInterface[] $items + * @return $this + */ + public function setItems(array $items = null); + /** * Get search criteria. * @@ -25,10 +33,26 @@ interface SearchResultsInterface */ public function getSearchCriteria(); + /** + * Set search criteria. + * + * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @return $this + */ + public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null); + /** * Get total count. * * @return int */ public function getTotalCount(); + + /** + * Set total count. + * + * @param int $totalCount + * @return $this + */ + public function setTotalCount($totalCount); } diff --git a/lib/internal/Magento/Framework/Api/SortOrder.php b/lib/internal/Magento/Framework/Api/SortOrder.php index aae092060225f9d1fbf0cccba5ba204b2ba9678d..f328b93aa176399e1673206e4e58a0935d10d324 100644 --- a/lib/internal/Magento/Framework/Api/SortOrder.php +++ b/lib/internal/Magento/Framework/Api/SortOrder.php @@ -6,11 +6,11 @@ namespace Magento\Framework\Api; - /** * Data object for sort order. + * @codeCoverageIgnore */ -class SortOrder extends AbstractExtensibleObject +class SortOrder extends AbstractSimpleObject { const FIELD = 'field'; const DIRECTION = 'direction'; @@ -25,6 +25,17 @@ class SortOrder extends AbstractExtensibleObject return $this->_get(SortOrder::FIELD); } + /** + * Set sorting field. + * + * @param string $field + * @return $this + */ + public function setField($field) + { + return $this->setData(SortOrder::FIELD, $field); + } + /** * Get sorting direction. * @@ -34,4 +45,15 @@ class SortOrder extends AbstractExtensibleObject { return $this->_get(SortOrder::DIRECTION); } + + /** + * Set sorting direction. + * + * @param string $direction + * @return $this + */ + public function setDirection($direction) + { + return $this->setData(SortOrder::DIRECTION, $direction); + } } diff --git a/lib/internal/Magento/Framework/Api/SortOrderBuilder.php b/lib/internal/Magento/Framework/Api/SortOrderBuilder.php index 59653270ee57d5147fe523c47aec772501c34b12..2f02c1c129a3b8c5f330b4e1739194f005f5ca47 100644 --- a/lib/internal/Magento/Framework/Api/SortOrderBuilder.php +++ b/lib/internal/Magento/Framework/Api/SortOrderBuilder.php @@ -10,9 +10,8 @@ namespace Magento\Framework\Api; /** * Builder for sort order data object. * - * @method SortOrder create() */ -class SortOrderBuilder extends ExtensibleObjectBuilder +class SortOrderBuilder extends AbstractSimpleObjectBuilder { /** * Set sorting field. diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php similarity index 88% rename from lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionGeneratorTest.php rename to lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php index a7ae7e8a0b37dc4be67f76e8462211cb0eedaf89..5207a20588c73dcbf83aa767b907f585db8bb114 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionGeneratorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php @@ -3,10 +3,10 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ - +// @codingStandardsIgnoreFile namespace Magento\Framework\Api\Test\Unit\Code\Generator; -class ExtensionGeneratorTest extends \PHPUnit_Framework_TestCase +class ExtensionAttributesGeneratorTest extends \PHPUnit_Framework_TestCase { /** * @var \Magento\Framework\Api\Config\Reader|\PHPUnit_Framework_MockObject_MockObject @@ -14,7 +14,7 @@ class ExtensionGeneratorTest extends \PHPUnit_Framework_TestCase protected $configReaderMock; /** - * @var \Magento\Framework\Api\Code\Generator\ObjectExtension|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator|\PHPUnit_Framework_MockObject_MockObject */ protected $model; @@ -26,7 +26,7 @@ class ExtensionGeneratorTest extends \PHPUnit_Framework_TestCase $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->model = $objectManager->getObject( - 'Magento\Framework\Api\Code\Generator\ObjectExtension', + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator', [ 'configReader' => $this->configReaderMock, 'sourceClassName' => '\Magento\Catalog\Api\Data\Product', @@ -68,9 +68,9 @@ class ExtensionGeneratorTest extends \PHPUnit_Framework_TestCase public function testValidateException() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - /** @var \Magento\Framework\Api\Code\Generator\ObjectExtension $model */ + /** @var \Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator $model */ $model = $objectManager->getObject( - 'Magento\Framework\Api\Code\Generator\ObjectExtension', + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator', [ 'sourceClassName' => '\Magento\Catalog\Api\Data\Product', 'resultClassName' => '\Magento\Catalog\Api\Data\ProductInterface' diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionInterfaceGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php similarity index 84% rename from lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionInterfaceGeneratorTest.php rename to lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php index 80ee07f036b1d67cf546c9740cd23361e798ceaf..8f80baf39beeeec1955800e7ea4a51ac12d02382 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionInterfaceGeneratorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php @@ -3,10 +3,10 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ - +// @codingStandardsIgnoreFile namespace Magento\Framework\Api\Test\Unit\Code\Generator; -class ExtensionInterfaceGeneratorTest extends \PHPUnit_Framework_TestCase +class ExtensionAttributesInterfaceGeneratorTest extends \PHPUnit_Framework_TestCase { public function testGenerate() { @@ -28,9 +28,9 @@ class ExtensionInterfaceGeneratorTest extends \PHPUnit_Framework_TestCase ] ); - /** @var \Magento\Framework\Api\Code\Generator\ObjectExtensionInterface $model */ + /** @var \Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator $model */ $model = $objectManager->getObject( - 'Magento\Framework\Api\Code\Generator\ObjectExtensionInterface', + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator', [ 'configReader' => $configReaderMock, 'sourceClassName' => '\Magento\Catalog\Api\Data\Product', @@ -49,9 +49,9 @@ class ExtensionInterfaceGeneratorTest extends \PHPUnit_Framework_TestCase public function testValidateException() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - /** @var \Magento\Framework\Api\Code\Generator\ObjectExtensionInterface $model */ + /** @var \Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator $model */ $model = $objectManager->getObject( - 'Magento\Framework\Api\Code\Generator\ObjectExtensionInterface', + 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator', [ 'sourceClassName' => '\Magento\Catalog\Api\Data\Product', 'resultClassName' => '\Magento\Catalog\Api\Data\ProductInterface' diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsBuilderTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsBuilderTest.php deleted file mode 100644 index eba4aa8c768f6b3a7a35e70c5225099c95bc1399..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/GenerateSearchResultsBuilderTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Api\Test\Unit\Code\Generator; - - -/** - * Class SearchResultBuilderTest - */ -class GenerateSearchResultsBuilderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $ioObjectMock; - - /** - * Create mock for class \Magento\Framework\Code\Generator\Io - */ - protected function setUp() - { - $this->ioObjectMock = $this->getMock( - '\Magento\Framework\Code\Generator\Io', - [], - [], - '', - false - ); - } - - /** - * generate SearchResultBuilder class - */ - public function testGenerate() - { - require_once __DIR__ . '/Sample.php'; - /** @var \Magento\Framework\Api\Code\Generator\SearchResultsBuilder $model */ - $model = $this->getMock( - 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder', - [ - '_validateData' - ], - [ - '\Magento\Framework\Api\Code\Generator\Sample', - null, - $this->ioObjectMock, - null, - null, - $this->getMock('Magento\Framework\Filesystem\FileResolver') - ] - ); - $sampleSearchResultBuilderCode = file_get_contents(__DIR__ . '/_files/SampleSearchResultsBuilder.txt'); - $this->ioObjectMock->expects($this->once()) - ->method('getResultFileName') - ->with('\Magento\Framework\Api\Code\Generator\SampleSearchResultsBuilder') - ->will($this->returnValue('SampleSearchResultsBuilder.php')); - $this->ioObjectMock->expects($this->once()) - ->method('writeResultFile') - ->with('SampleSearchResultsBuilder.php', $sampleSearchResultBuilderCode); - - $model->expects($this->once()) - ->method('_validateData') - ->will($this->returnValue(true)); - $this->assertEquals('SampleSearchResultsBuilder.php', $model->generate(), implode("\n", $model->getErrors())); - } -} diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/ExtensibleSampleDataBuilder.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/ExtensibleSampleDataBuilder.txt deleted file mode 100644 index f1150ba27db5dafe5b6e0c5ea36c9a6021df480b..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/ExtensibleSampleDataBuilder.txt +++ /dev/null @@ -1,65 +0,0 @@ -namespace Magento\Framework\Api\Code\Generator; - -/** - * DataBuilder class for - * \Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface - */ -class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\Builder -{ - /** - * @param array $items - * @return $this - */ - public function setItems($items) - { - $this->_set('items', $items); - return $this; - } - - /** - * @param string $name - * @return $this - */ - public function setName($name) - { - $this->_set('name', $name); - return $this; - } - - /** - * @param int $count - * @return $this - */ - public function setCount($count) - { - $this->_set('count', $count); - return $this; - } - - /** - * @param int $createdAt - * @return $this - */ - public function setCreatedAt($createdAt) - { - $this->_set('created_at', $createdAt); - return $this; - } - - /** - * Initialize the builder - * - * @param \Magento\Framework\Api\ObjectFactory $objectFactory - * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService - * @param \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder - * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor - * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor - * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory - * @param \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig - * @param string|null $modelClassInterface - */ - public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder, \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, \Magento\Framework\Reflection\TypeProcessor $typeProcessor, \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, \Magento\Framework\ObjectManager\ConfigInterface $objectManagerConfig, $modelClassInterface = null) - { - parent::__construct($objectFactory, $metadataService, $attributeValueBuilder, $objectProcessor, $typeProcessor, $dataBuilderFactory, $objectManagerConfig, 'Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface'); - } -} diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleBuilder.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleBuilder.txt deleted file mode 100644 index cfc1250701c346a9f514b7a6214edd9e276b3320..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleBuilder.txt +++ /dev/null @@ -1,15 +0,0 @@ -namespace Magento\Framework\Api\Code\Generator; - -/** - * Builder class for @see \Magento\Framework\Api\Code\Generator\Sample - */ -class SampleBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder -{ - /** - * {@inheritdoc} - */ - public function setMessages($messages) - { - return $this->_set(\Magento\Framework\Api\Code\Generator\Sample::MESSAGES, $messages); - } -} diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleEmptyExtension.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleEmptyExtension.txt index 9cd99093c935725a6c8a9ba357b2ca7c508ddfe3..1605dad849f045361e5a4858b70d216bc8879c56 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleEmptyExtension.txt +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleEmptyExtension.txt @@ -3,6 +3,6 @@ namespace Magento\Catalog\Api\Data; /** * Extension class for @see \Magento\Catalog\Api\Data\ProductInterface */ -class ProductExtension implements \Magento\Catalog\Api\Data\ProductExtensionInterface +class ProductExtension extends \Magento\Framework\Api\AbstractSimpleObject implements \Magento\Catalog\Api\Data\ProductExtensionInterface { } diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt index 3ea82ea52c4c8d54079ef305f9a8c32d7c641711..8b5caad1ecc4456ae51380e25c735be8f2660d37 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt @@ -3,24 +3,14 @@ namespace Magento\Catalog\Api\Data; /** * Extension class for @see \Magento\Catalog\Api\Data\ProductInterface */ -class ProductExtension implements \Magento\Catalog\Api\Data\ProductExtensionInterface +class ProductExtension extends \Magento\Framework\Api\AbstractSimpleObject implements \Magento\Catalog\Api\Data\ProductExtensionInterface { - /** - * @var string - */ - protected $stringAttribute = null; - - /** - * @var \Magento\Bundle\Api\Data\OptionInterface[] - */ - protected $complexObjectAttribute = null; - /** * @return string */ public function getStringAttribute() { - return $this->stringAttribute; + return $this->_get('string_attribute'); } /** @@ -29,7 +19,7 @@ class ProductExtension implements \Magento\Catalog\Api\Data\ProductExtensionInte */ public function setStringAttribute($stringAttribute) { - $this->stringAttribute = $stringAttribute; + $this->setData('string_attribute', $stringAttribute); return $this; } @@ -38,7 +28,7 @@ class ProductExtension implements \Magento\Catalog\Api\Data\ProductExtensionInte */ public function getComplexObjectAttribute() { - return $this->complexObjectAttribute; + return $this->_get('complex_object_attribute'); } /** @@ -47,7 +37,7 @@ class ProductExtension implements \Magento\Catalog\Api\Data\ProductExtensionInte */ public function setComplexObjectAttribute($complexObjectAttribute) { - $this->complexObjectAttribute = $complexObjectAttribute; + $this->setData('complex_object_attribute', $complexObjectAttribute); return $this; } } diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt index a16dd05799e00b7be507c5abcce788400c292a1d..ec9edd7affc2d68e5444d914b833bff81ccc1d4d 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt @@ -3,7 +3,7 @@ namespace Magento\Catalog\Api\Data; /** * ExtensionInterface class for @see \Magento\Catalog\Api\Data\ProductInterface */ -interface ProductExtensionInterface +interface ProductExtensionInterface extends \Magento\Framework\Api\ExtensionAttributesInterface { /** * @return string diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleSearchResultsBuilder.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleSearchResultsBuilder.txt deleted file mode 100644 index 209dd9b054922d9736e7ea47f794ec1f00482052..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleSearchResultsBuilder.txt +++ /dev/null @@ -1,17 +0,0 @@ -namespace Magento\Framework\Api\Code\Generator; - -/** - * SearchResultsBuilder class for @see \Magento\Framework\Api\Code\Generator\Sample - */ -class SampleSearchResultsBuilder extends \Magento\Framework\Api\AbstractSearchResultsBuilder -{ - /** - * SearchResultsBuilder constructor - * - * @param - */ - public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\AttributeValueFactory $valueFactory, \Magento\Framework\Api\Config\MetadataConfig $metadataService, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\Code\Generator\SampleBuilder $itemObjectBuilder) - { - parent::__construct($objectFactory, $valueFactory, $metadataService, $searchCriteriaBuilder, $itemObjectBuilder); - } -} diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Config/MetadataConfigTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Config/MetadataConfigTest.php deleted file mode 100644 index d98b9db25a87c6bb0f556b672e4c280280ecf1ad..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Config/MetadataConfigTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Api\Test\Unit\Config; - -class MetadataConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Framework\Api\Config\MetadataConfig - */ - protected $metadataConfig; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\Config\Reader - */ - protected $serviceConfigReaderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\AttributeMetadataBuilderInterface - */ - protected $attributeMetadataBuilderMock; - - /** - * Prepare parameters - */ - public function setUp() - { - $this->serviceConfigReaderMock = $this->getMockBuilder('\Magento\Framework\Api\Config\Reader') - ->disableOriginalConstructor() - ->getMock(); - $this->attributeMetadataBuilderMock = $this->getMockBuilder( - '\Magento\Framework\Api\AttributeMetadataBuilderInterface' - )->disableOriginalConstructor()->getMock(); - - $this->metadataConfig = new \Magento\Framework\Api\Config\MetadataConfig( - $this->serviceConfigReaderMock, - $this->attributeMetadataBuilderMock - ); - } - - /** - * Test caching - */ - public function testCaching() - { - $dataObjectClassName = 'Magento\Customer\Model\Data\Address'; - $attributeCode = 'street'; - $allAttributes = [ - $dataObjectClassName => [ - $attributeCode => 'value', - ] - ]; - $this->serviceConfigReaderMock->expects($this->once()) - ->method('read') - ->willReturn($allAttributes); - - $attributeMock = $this->getMock('\Magento\Framework\Api\MetadataObjectInterface'); - $this->attributeMetadataBuilderMock->expects($this->exactly(2)) - ->method('setAttributeCode') - ->with($attributeCode); - $this->attributeMetadataBuilderMock->expects($this->exactly(2)) - ->method('create') - ->willReturn($attributeMock); - - $attributes = $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName); - $this->assertEquals($attributeMock, $attributes[$attributeCode]); - $attributes = $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName); - $this->assertEquals($attributeMock, $attributes[$attributeCode]); - } -} diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php index 2437d84880bce65045045b303dbea41f15b74b37..be70bc717d963e8d1b1e2035288dc44c48eb5e38 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Data/AttributeValueTest.php @@ -21,12 +21,12 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithString() { - $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeBuilder */ - $attributeBuilder = $helper->getObject('Magento\Framework\Api\AttributeDataBuilder') - ->setAttributeCode(self::ATTRIBUTE_CODE) - ->setValue(self::STRING_VALUE); - $attribute = new AttributeValue($attributeBuilder->getData()); + $attribute = new AttributeValue( + [ + AttributeValue::ATTRIBUTE_CODE => self::ATTRIBUTE_CODE, + AttributeValue::VALUE => self::STRING_VALUE + ] + ); $this->assertSame(self::ATTRIBUTE_CODE, $attribute->getAttributeCode()); $this->assertSame(self::STRING_VALUE, $attribute->getValue()); @@ -34,12 +34,12 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithInteger() { - $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeBuilder */ - $attributeBuilder = $helper->getObject('Magento\Framework\Api\AttributeDataBuilder') - ->setAttributeCode(self::ATTRIBUTE_CODE) - ->setValue(self::INTEGER_VALUE); - $attribute = new AttributeValue($attributeBuilder->getData()); + $attribute = new AttributeValue( + [ + AttributeValue::ATTRIBUTE_CODE => self::ATTRIBUTE_CODE, + AttributeValue::VALUE => self::INTEGER_VALUE + ] + ); $this->assertSame(self::ATTRIBUTE_CODE, $attribute->getAttributeCode()); $this->assertSame(self::INTEGER_VALUE, $attribute->getValue()); @@ -47,12 +47,12 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithFloat() { - $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeBuilder */ - $attributeBuilder = $helper->getObject('Magento\Framework\Api\AttributeDataBuilder') - ->setAttributeCode(self::ATTRIBUTE_CODE) - ->setValue(self::FLOAT_VALUE); - $attribute = new AttributeValue($attributeBuilder->getData()); + $attribute = new AttributeValue( + [ + AttributeValue::ATTRIBUTE_CODE => self::ATTRIBUTE_CODE, + AttributeValue::VALUE => self::FLOAT_VALUE + ] + ); $this->assertSame(self::ATTRIBUTE_CODE, $attribute->getAttributeCode()); $this->assertSame(self::FLOAT_VALUE, $attribute->getValue()); @@ -60,12 +60,12 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase public function testConstructorAndGettersWithBoolean() { - $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeBuilder */ - $attributeBuilder = $helper->getObject('Magento\Framework\Api\AttributeDataBuilder') - ->setAttributeCode(self::ATTRIBUTE_CODE) - ->setValue(self::BOOLEAN_VALUE); - $attribute = new AttributeValue($attributeBuilder->getData()); + $attribute = new AttributeValue( + [ + AttributeValue::ATTRIBUTE_CODE => self::ATTRIBUTE_CODE, + AttributeValue::VALUE => self::BOOLEAN_VALUE + ] + ); $this->assertSame(self::ATTRIBUTE_CODE, $attribute->getAttributeCode()); $this->assertSame(self::BOOLEAN_VALUE, $attribute->getValue()); diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php index 30afec4acdccafb21a94fe796924e86a2e91ec79..ff229abd7d22e9be0f810da4034336e5e9631f63 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/DataObjectHelperTest.php @@ -3,10 +3,13 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\Api\Test\Unit; -use \Magento\Framework\Api\ExtensibleDataInterface; -use \Magento\Framework\Api\AttributeInterface; +use Magento\Framework\Api\CustomAttributesDataInterface; +use Magento\Framework\Api\AttributeInterface; class DataObjectHelperTest extends \PHPUnit_Framework_TestCase { @@ -102,18 +105,22 @@ class DataObjectHelperTest extends \PHPUnit_Framework_TestCase $this->objectProcessorMock->expects($this->at(0)) ->method('getMethodReturnType') - ->with('Magento\Customer\Model\Data\Address', 'getStreet') + ->with('\Magento\Customer\Api\Data\AddressInterface', 'getStreet') ->willReturn('string[]'); $this->objectProcessorMock->expects($this->at(1)) ->method('getMethodReturnType') - ->with('Magento\Customer\Model\Data\Address', 'getRegion') + ->with('\Magento\Customer\Api\Data\AddressInterface', 'getRegion') ->willReturn('\Magento\Customer\Api\Data\RegionInterface'); $this->objectFactoryMock->expects($this->once()) ->method('create') ->with('\Magento\Customer\Api\Data\RegionInterface', []) ->willReturn($regionDataObject); - $this->dataObjectHelper->populateWithArray($addressDataObject, $data); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $data, + '\Magento\Customer\Api\Data\AddressInterface' + ); $this->assertEquals($id, $addressDataObject->getId()); $this->assertEquals($countryId, $addressDataObject->getCountryId()); @@ -164,7 +171,11 @@ class DataObjectHelperTest extends \PHPUnit_Framework_TestCase $this->attributeValueFactoryMock->expects($this->once()) ->method('create') ->willReturn($customAttribute); - $this->dataObjectHelper->populateWithArray($addressDataObject, $data); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $data, + '\Magento\Customer\Api\Data\AddressInterface' + ); $this->assertEquals($id, $addressDataObject->getId()); $this->assertEquals( @@ -211,7 +222,7 @@ class DataObjectHelperTest extends \PHPUnit_Framework_TestCase $data = [ 'id' => $id, - ExtensibleDataInterface::CUSTOM_ATTRIBUTES => [ + CustomAttributesDataInterface::CUSTOM_ATTRIBUTES => [ [ AttributeInterface::ATTRIBUTE_CODE => $customAttributeCode, AttributeInterface::VALUE => $customAttributeValue, @@ -223,7 +234,11 @@ class DataObjectHelperTest extends \PHPUnit_Framework_TestCase $this->attributeValueFactoryMock->expects($this->once()) ->method('create') ->willReturn($customAttribute); - $this->dataObjectHelper->populateWithArray($addressDataObject, $data); + $this->dataObjectHelper->populateWithArray( + $addressDataObject, + $data, + '\Magento\Customer\Api\Data\AddressInterface' + ); $this->assertEquals($id, $addressDataObject->getId()); $this->assertEquals( diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/StubAbstractSimpleObjectBuilder.php b/lib/internal/Magento/Framework/Api/Test/Unit/StubAbstractSimpleObjectBuilder.php deleted file mode 100644 index c387049951dc8f41a25154e1abc5ae256e84d7c7..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Api/Test/Unit/StubAbstractSimpleObjectBuilder.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Api\Test\Unit; - -use Magento\Framework\Api\AbstractSimpleObjectBuilder; - -/** - * Class Stub for testing AbstractSimpleObjectBuilder class - */ -class StubAbstractSimpleObjectBuilder extends AbstractSimpleObjectBuilder -{ -} diff --git a/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php b/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php index 16575b0885528edfab6ebf502e6ae5c8b692bf46..75f139317ba10653d759e95b7f7e41a7b6347fbe 100644 --- a/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php +++ b/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php @@ -303,10 +303,10 @@ class Factory return $this->_resource->getConnection('core_write'); }; $options['data_table_callback'] = function () { - return $this->_resource->getTableName('core_cache'); + return $this->_resource->getTableName('cache'); }; $options['tags_table_callback'] = function () { - return $this->_resource->getTableName('core_cache_tag'); + return $this->_resource->getTableName('cache_tag'); }; return $options; } diff --git a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php index 8c777c869e82417a90e684ed24db56a204feac2e..ddb68b8583ac41420e46d57f04302efd43797d4c 100644 --- a/lib/internal/Magento/Framework/App/ObjectManagerFactory.php +++ b/lib/internal/Magento/Framework/App/ObjectManagerFactory.php @@ -163,6 +163,7 @@ class ObjectManagerFactory $this->factory->setObjectManager($objectManager); ObjectManager::setInstance($objectManager); + $definitionFactory->getCodeGenerator()->setObjectManager($objectManager); $diConfig->setCache( $objectManager->get('Magento\Framework\App\ObjectManager\ConfigCache') diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php index 34400821cc90dc368b9fadad8020965c36af6dc6..3c54962e2f5966ad8409d78d8af371ab7711d073 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/XsdTest.php @@ -21,7 +21,7 @@ class XsdTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_xsdSchema = BP . '/app/code/Magento/Core/etc/config.xsd'; + $this->_xsdSchema = BP . '/app/code/Magento/Store/etc/config.xsd'; $this->_xsdValidator = new \Magento\Framework\TestFramework\Unit\Utility\XsdValidator(); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xml b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xml index 64a48ac3e9498e535c60ff3e6f81737be6685dd2..c0d6f535bcaa634059f38914bce449b9b1929e67 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> <default> <payment> <payment_method> diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config1.xml b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config1.xml index 36c221dcbfecab3a7afd7f726386d87477eb88aa..0268e0a19ea007e138ea3079dd4af00077b750a6 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config1.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config1.xml @@ -5,5 +5,5 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> </config> diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml index 36c221dcbfecab3a7afd7f726386d87477eb88aa..0268e0a19ea007e138ea3079dd4af00077b750a6 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/initial_config2.xml @@ -5,5 +5,5 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> </config> diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalid_config.xml b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalid_config.xml index 07a89760bb4c4ef7a66d1fae4281121d2c34df91..803d1ef87c4d1471f6618fecf572ccde7dade9ce 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalid_config.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/invalid_config.xml @@ -5,6 +5,6 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> <invalid></invalid> </config> diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml index e884c48e0f0ff95d386525c551d139cfb2c95d63..da8b5603b23f196a48eb04dea6d077e98acf1ed4 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml +++ b/lib/internal/Magento/Framework/App/Test/Unit/Config/Initial/_files/valid_config.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Core/etc/config.xsd"> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../app/code/Magento/Store/etc/config.xsd"> <default> <some></some> </default> diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php index c3e0a80553329159193d625c2dc2ec516cc58152..acd44af1d90654b77d62b2230fd3ce0c9dfe653f 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ReinitableConfigTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\App\Test\Unit; class ReinitableConfigTest extends \PHPUnit_Framework_TestCase @@ -12,7 +15,7 @@ class ReinitableConfigTest extends \PHPUnit_Framework_TestCase $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $scopePool = $this->getMock('\Magento\Framework\App\Config\ScopePool', ['clean'], [], '', false); $scopePool->expects($this->once())->method('clean'); - /** @var \Magento\Core\Model\ReinitableConfig $config */ + /** @var \Magento\Framework\App\ReinitableConfig $config */ $config = $helper->getObject('Magento\Framework\App\ReinitableConfig', ['scopePool' => $scopePool]); $this->assertInstanceOf('\Magento\Framework\App\Config\ReinitableConfigInterface', $config->reinit()); } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php index 973f461ee88b54e8ed4fa815d11af70c170f66c6..26d126e7b5692febfe28dcad162c56fabd99d20b 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\App\Test\Unit\Response; use \Magento\Framework\App\Response\Http; @@ -53,6 +56,9 @@ class HttpTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->model); + $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); + $objectManager = $magentoObjectManagerFactory->create($_SERVER); + \Magento\Framework\App\ObjectManager::setInstance($objectManager); } public function testSendVary() @@ -114,13 +120,12 @@ class HttpTest extends \PHPUnit_Framework_TestCase $ttl = 120; $pragma = 'cache'; $cacheControl = 'max-age=' . $ttl . ', public, s-maxage=' . $ttl; - $between = 1000; + $expiresResult = gmdate('D, d M Y H:i:s T', time() + $ttl); $this->model->setPublicHeaders($ttl); $this->assertEquals($pragma, $this->model->getHeader('Pragma')->getFieldValue()); $this->assertEquals($cacheControl, $this->model->getHeader('Cache-Control')->getFieldValue()); - $expiresResult = time($this->model->getHeader('Expires')->getFieldValue()); - $this->assertTrue($expiresResult > $between || $expiresResult < $between); + $this->assertLessThanOrEqual($expiresResult, $this->model->getHeader('Expires')->getFieldValue()); } /** diff --git a/app/code/Magento/Core/Test/Unit/Model/NoRouteHandlerListTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php similarity index 95% rename from app/code/Magento/Core/Test/Unit/Model/NoRouteHandlerListTest.php rename to lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php index 4673d2f03048c8ef4bb5c97c881eddf5b1771cae..23ae614a3673a52ea658c3770457b4b20f2a7fba 100644 --- a/app/code/Magento/Core/Test/Unit/Model/NoRouteHandlerListTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php @@ -3,7 +3,10 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Unit\Model; + +// @codingStandardsIgnoreFile + +namespace Magento\Framework\App\Test\Unit\Router; class NoRouteHandlerListTest extends \PHPUnit_Framework_TestCase { diff --git a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php index db3f0e7e6c82ec5b421b88d793762a18db00b884..e8066f086c37b02ba2a8c15caaedfb323d891c7c 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/StateTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\App\Test\Unit; class StateTest extends \PHPUnit_Framework_TestCase @@ -95,4 +98,41 @@ class StateTest extends \PHPUnit_Framework_TestCase { throw new \Exception('Some error'); } + + /** + * @param string $mode + * @dataProvider constructorDataProvider + */ + public function testConstructor($mode) + { + $model = new \Magento\Framework\App\State( + $this->getMockForAbstractClass('Magento\Framework\Config\ScopeInterface', [], '', false), + $mode + ); + $this->assertEquals($mode, $model->getMode()); + } + + /** + * @return array + */ + public static function constructorDataProvider() + { + return [ + 'default mode' => [\Magento\Framework\App\State::MODE_DEFAULT], + 'production mode' => [\Magento\Framework\App\State::MODE_PRODUCTION], + 'developer mode' => [\Magento\Framework\App\State::MODE_DEVELOPER] + ]; + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage Unknown application mode: unknown mode + */ + public function testConstructorException() + { + new \Magento\Framework\App\State( + $this->getMockForAbstractClass('Magento\Framework\Config\ScopeInterface', [], '', false), + "unknown mode" + ); + } } diff --git a/lib/internal/Magento/Framework/App/Utility/Classes.php b/lib/internal/Magento/Framework/App/Utility/Classes.php index 197efbc95fb0a88104b727c3c3fbc53ce9184ba3..6671bd6a0464da30ef79dd001742cd2ff6ad43ef 100644 --- a/lib/internal/Magento/Framework/App/Utility/Classes.php +++ b/lib/internal/Magento/Framework/App/Utility/Classes.php @@ -272,7 +272,11 @@ class Classes */ public static function isAutogenerated($className) { - if (preg_match('/.*\\\\[a-zA-Z0-9]{1,}(Factory|Proxy|SearchResults|DataBuilder)$/', $className) + if ( + preg_match( + '/.*\\\\[a-zA-Z0-9]{1,}(Factory|Proxy|SearchResults|DataBuilder|Extension|ExtensionInterface)$/', + $className + ) || preg_match('/Magento\\\\[\w]+\\\\(Test\\\\(Page|Fixture))\\\\/', $className) ) { return true; diff --git a/lib/internal/Magento/Framework/App/Utility/Files.php b/lib/internal/Magento/Framework/App/Utility/Files.php index 97b389f125f278e3d7f67176894ab2ec0905f06c..15869c4be7c49c67c886bab1b14484c2f5b1b5ea 100644 --- a/lib/internal/Magento/Framework/App/Utility/Files.php +++ b/lib/internal/Magento/Framework/App/Utility/Files.php @@ -490,18 +490,18 @@ class Files /** * Returns list of Javascript files in Magento * + * @param string $area + * @param string $themePath + * @param string $namespace + * @param string $module * @return array */ - public function getJsFiles() + public function getJsFiles($area = '*', $themePath = '*/*', $namespace = '*', $module = '*') { - $key = __METHOD__ . $this->_path; + $key = $area . $themePath . $namespace . $module . __METHOD__ . $this->_path; if (isset(self::$_cache[$key])) { return self::$_cache[$key]; } - $namespace = '*'; - $module = '*'; - $area = '*'; - $themePath = '*/*'; $files = self::getFiles( [ "{$this->_path}/app/code/{$namespace}/{$module}/view/{$area}/web", diff --git a/lib/internal/Magento/Framework/Cache/Backend/Database.php b/lib/internal/Magento/Framework/Cache/Backend/Database.php index b1233e1301b24e981d92dd8a0c98c02217390225..bac1d79525dac3bc49f89537303f4af2d1a17f38 100644 --- a/lib/internal/Magento/Framework/Cache/Backend/Database.php +++ b/lib/internal/Magento/Framework/Cache/Backend/Database.php @@ -9,7 +9,7 @@ /** Tables declaration: -CREATE TABLE IF NOT EXISTS `core_cache` ( +CREATE TABLE IF NOT EXISTS `cache` ( `id` VARCHAR(255) NOT NULL, `data` mediumblob, `create_time` int(11), @@ -19,12 +19,12 @@ CREATE TABLE IF NOT EXISTS `core_cache` ( KEY `IDX_EXPIRE_TIME` (`expire_time`) )ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE IF NOT EXISTS `core_cache_tag` ( +CREATE TABLE IF NOT EXISTS `cache_tag` ( `tag` VARCHAR(255) NOT NULL, `cache_id` VARCHAR(255) NOT NULL, KEY `IDX_TAG` (`tag`), KEY `IDX_CACHE_ID` (`cache_id`), - CONSTRAINT `FK_CORE_CACHE_TAG` FOREIGN KEY (`cache_id`) REFERENCES `core_cache` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `FK_CORE_CACHE_TAG` FOREIGN KEY (`cache_id`) REFERENCES `cache` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; */ diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php index 5f6b0c6221c0705107eba10c0ed1e16d55f9113c..84ec6cf98539214addb0e08193fb73e728a28c75 100644 --- a/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php +++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Config/ConverterTest.php @@ -27,24 +27,4 @@ class ConverterTest extends \PHPUnit_Framework_TestCase $expectedResult = include $convertedFile; $this->assertEquals($expectedResult, $this->_model->convert($dom)); } - - /** - * @param string $xmlData - * @dataProvider wrongXmlDataProvider - * @expectedException \Exception - */ - public function testMapThrowsExceptionWhenXmlHasWrongFormat($xmlData) - { - $dom = new \DOMDocument(); - $dom->loadXML($xmlData); - $this->_model->convert($dom); - } - - /** - * @return array - */ - public function wrongXmlDataProvider() - { - return [['<?xml version="1.0"?><config>']]; - } } diff --git a/lib/internal/Magento/Framework/Code/Generator.php b/lib/internal/Magento/Framework/Code/Generator.php index 1339a790efc9b6fa0bdf67a1c9a65a234ef8d759..35026a88b69d1d66c4e10d913ea5b5fa35e2d155 100644 --- a/lib/internal/Magento/Framework/Code/Generator.php +++ b/lib/internal/Magento/Framework/Code/Generator.php @@ -31,6 +31,11 @@ class Generator */ protected $definedClasses; + /** + * @var \Magento\Framework\ObjectManagerInterface + */ + protected $objectManager; + /** * @param Generator\Io $ioObject * @param array $generatedEntities @@ -86,18 +91,15 @@ class Generator } if (!$entity || !$entityName) { return self::GENERATION_ERROR; - } - - if ($this->definedClasses->classLoadable($className)) { + } else if ($this->definedClasses->classLoadable($className)) { return self::GENERATION_SKIP; - } - - if (!isset($this->_generatedEntities[$entity])) { + } else if (!isset($this->_generatedEntities[$entity])) { throw new \InvalidArgumentException('Unknown generation entity.'); } $generatorClass = $this->_generatedEntities[$entity]; /** @var EntityAbstract $generator */ $generator = $this->createGeneratorInstance($generatorClass, $entityName, $className); + $this->tryToLoadSourceClass($className, $generator); if (!($file = $generator->generate())) { $errors = $generator->getErrors(); throw new \Magento\Framework\Exception(implode(' ', $errors)); @@ -125,6 +127,57 @@ class Generator */ protected function createGeneratorInstance($generatorClass, $entityName, $className) { - return new $generatorClass($entityName, $className, $this->_ioObject); + return $this->getObjectManager()->create( + $generatorClass, + ['sourceClassName' => $entityName, 'resultClassName' => $className, 'ioObject' => $this->_ioObject] + ); + } + + /** + * Set object manager instance. + * + * @param \Magento\Framework\ObjectManagerInterface $objectManager + * @return $this + */ + public function setObjectManager(\Magento\Framework\ObjectManagerInterface $objectManager) + { + $this->objectManager = $objectManager; + return $this; + } + + /** + * Get object manager instance. + * + * @return \Magento\Framework\ObjectManagerInterface + */ + public function getObjectManager() + { + if (!($this->objectManager instanceof \Magento\Framework\ObjectManagerInterface)) { + throw new \LogicException( + "Object manager was expected to be set using setObjectManger() " + . "before getObjectManager() invocation." + ); + } + return $this->objectManager; + } + + /** + * Try to load/generate source class to check if it is valid or not. + * + * @param string $className + * @param \Magento\Framework\Code\Generator\EntityAbstract $generator + * @return void + * @throws \Magento\Framework\Exception + */ + protected function tryToLoadSourceClass($className, $generator) + { + $sourceClassName = $generator->getSourceClassName(); + if (!$this->definedClasses->classLoadable($sourceClassName)) { + if ($this->generateClass($sourceClassName) !== self::GENERATION_SUCCESS) { + throw new \Magento\Framework\Exception( + sprintf('Source class "%s" for "%s" generation does not exist.', $sourceClassName, $className) + ); + } + } } } diff --git a/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php b/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php index f98c4d689653fb007b7eec15e8ceec8228de39f1..20da9af1a5aaff1fa2904dac17a5f65f00069aea 100644 --- a/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php +++ b/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php @@ -121,15 +121,26 @@ abstract class EntityAbstract } /** - * Get source class name + * Get full source class name, with namespace * * @return string */ - protected function _getSourceClassName() + public function getSourceClassName() { return $this->_sourceClassName; } + /** + * Get source class without namespace. + * + * @return string + */ + public function getSourceClassNameWithoutNamespace() + { + $parts = explode('\\', ltrim($this->getSourceClassName(), '\\')); + return end($parts); + } + /** * Get fully qualified class name * @@ -234,7 +245,7 @@ abstract class EntityAbstract */ protected function _validateData() { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); $resultFileName = $this->_ioObject->getResultFileName($resultClassName); @@ -292,7 +303,7 @@ abstract class EntityAbstract */ protected function _getClassDocBlock() { - $description = ucfirst(static::ENTITY_TYPE) . ' class for @see ' . $this->_getSourceClassName(); + $description = ucfirst(static::ENTITY_TYPE) . ' class for @see ' . $this->getSourceClassName(); return ['shortDescription' => $description]; } diff --git a/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php b/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php index 98eafe0f910928432718435f533c032980bd8e38..c26f31283ddb0a747cdcb0c51b32927e6e0e8001 100644 --- a/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php +++ b/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php @@ -47,12 +47,10 @@ class ArgumentsReader } elseif (true == is_int($value)) { $default = $value; } else { - $default = is_null( - $parameter->getDefaultValue() - ) ? 'null' : "'" . $parameter->getDefaultValue() . "'"; + $default = $parameter->getDefaultValue(); } } elseif ($parameter->allowsNull()) { - $default = 'null'; + $default = null; } } diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php index 3e7d273a24d5c152dd778f824e538331c54e79de..efa21cde844f603a7e347bf46002d9b77312e529 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/GeneratorTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\Code\Test\Unit; class GeneratorTest extends \PHPUnit_Framework_TestCase @@ -70,8 +73,12 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase 'interceptor' => '\Magento\Framework\Interception\Code\Generator\Interceptor' ] ); - - $this->model->generateClass($className . $entityType); + $objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface'); + $fullClassName = $className . $entityType; + $entityGeneratorMock = $this->getMockBuilder($fullClassName)->disableOriginalConstructor()->getMock(); + $objectManagerMock->expects($this->once())->method('create')->willReturn($entityGeneratorMock); + $this->model->setObjectManager($objectManagerMock); + $this->model->generateClass($fullClassName); } /** @@ -125,7 +132,10 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $expectedEntities = array_values($this->expectedEntities); $resultClassName = self::SOURCE_CLASS . ucfirst(array_shift($expectedEntities)); - + $objectManagerMock = $this->getMock('Magento\Framework\ObjectManagerInterface'); + $entityGeneratorMock = $this->getMockBuilder($resultClassName)->disableOriginalConstructor()->getMock(); + $objectManagerMock->expects($this->once())->method('create')->willReturn($entityGeneratorMock); + $this->model->setObjectManager($objectManagerMock); $this->model->generateClass($resultClassName); } diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php index 412c5dc49df9d8bf239cdb9802d208074c9b5e8e..8c5e45a18732f91d8d004bfe64fe057a20cc032e 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/ArgumentsReaderTest.php @@ -48,7 +48,7 @@ class ArgumentsReaderTest extends \PHPUnit_Framework_TestCase 'position' => 3, 'type' => null, 'isOptional' => true, - 'default' => "'Const Value'", + 'default' => 'Const Value', ], 'optionalNumValue' => [ 'name' => 'optionalNumValue', @@ -62,7 +62,7 @@ class ArgumentsReaderTest extends \PHPUnit_Framework_TestCase 'position' => 5, 'type' => null, 'isOptional' => true, - 'default' => "'optional string'", + 'default' => 'optional string', ], 'optionalArrayValue' => [ 'name' => 'optionalArrayValue', @@ -115,7 +115,7 @@ class ArgumentsReaderTest extends \PHPUnit_Framework_TestCase 'position' => 3, 'type' => null, 'isOptional' => true, - 'default' => "'Const Value'", + 'default' => 'Const Value', ], 'optionalNumValue' => [ 'name' => 'optionalNumValue', @@ -129,7 +129,7 @@ class ArgumentsReaderTest extends \PHPUnit_Framework_TestCase 'position' => 5, 'type' => null, 'isOptional' => true, - 'default' => "'optional string'", + 'default' => 'optional string', ], 'optionalArrayValue' => [ 'name' => 'optionalArrayValue', @@ -177,24 +177,24 @@ class ArgumentsReaderTest extends \PHPUnit_Framework_TestCase 'position' => 0, 'type' => null, 'isOptional' => true, - 'default' => null, + 'default' => '', ], 'code' => [ 'name' => 'code', 'position' => 1, 'type' => null, 'isOptional' => true, - 'default' => null, + 'default' => 0, ], 'previous' => [ 'name' => 'previous', 'position' => 2, - 'type' => null, + 'type' => '\Exception', 'isOptional' => true, 'default' => null, ], ]; - $class = new \ReflectionClass('ClassExtendsDefaultPhpType'); + $class = new \ReflectionClass('ClassExtendsDefaultPhpTypeWithIOverrideConstructor'); $actualResult = $this->_model->getConstructorArguments($class, false, true); $this->assertEquals($expectedResult, $actualResult); diff --git a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php index 9987087c3d3ee84189eccab7a076f3ec2dc51972..9ce41a9fe3c73dfc3592b113f35a78f22a63aa24 100644 --- a/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php +++ b/lib/internal/Magento/Framework/Code/Test/Unit/Reader/_files/ClassesForArgumentsReader.php @@ -82,6 +82,22 @@ class ClassWithoutConstruct class ClassExtendsDefaultPhpType extends \RuntimeException { } +class ClassExtendsDefaultPhpTypeWithIOverrideConstructor extends \RuntimeException +{ + /** + * Override constructor due to Reflection API incorrect work with internal PHP classes. + * Obtaining of default argument value and default argument type is incorrect + * + * @param string $message + * @param int $code + * @param Exception $previous + */ + public function __construct($message = '', $code = 0, Exception $previous = null) + { + parent::__construct($message, $code, $previous); + } +} + class FirstClassForParentCall { /** diff --git a/app/code/Magento/Core/Controller/Index/Index.php b/lib/internal/Magento/Framework/Controller/Index/Index.php similarity index 84% rename from app/code/Magento/Core/Controller/Index/Index.php rename to lib/internal/Magento/Framework/Controller/Index/Index.php index 85ff6a6af433749971148420bc95dcc6fc9cf837..bc8b9d70810a6fa660f8868044c344c02ea41c0e 100644 --- a/app/code/Magento/Core/Controller/Index/Index.php +++ b/lib/internal/Magento/Framework/Controller/Index/Index.php @@ -4,7 +4,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Controller\Index; +namespace Magento\Framework\Controller\Index; class Index extends \Magento\Framework\App\Action\Action { diff --git a/app/code/Magento/Core/Controller/Noroute/Index.php b/lib/internal/Magento/Framework/Controller/Noroute/Index.php similarity index 96% rename from app/code/Magento/Core/Controller/Noroute/Index.php rename to lib/internal/Magento/Framework/Controller/Noroute/Index.php index 4d8887573d65775ef4cbe7c9dc10cb7376912675..2d4da914cd00450a19fa2889bc489f7561ba4b77 100644 --- a/app/code/Magento/Core/Controller/Noroute/Index.php +++ b/lib/internal/Magento/Framework/Controller/Noroute/Index.php @@ -4,7 +4,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Controller\Noroute; +namespace Magento\Framework\Controller\Noroute; class Index extends \Magento\Framework\App\Action\Action { diff --git a/app/code/Magento/Core/Test/Unit/Controller/Index/IndexTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/Index/IndexTest.php similarity index 70% rename from app/code/Magento/Core/Test/Unit/Controller/Index/IndexTest.php rename to lib/internal/Magento/Framework/Controller/Test/Unit/Controller/Index/IndexTest.php index 9353ed854e497eb10e4cc660922680cf33301ac1..aac2c071fb0a4322ed0437bd84ac3efc4046f8a9 100644 --- a/app/code/Magento/Core/Test/Unit/Controller/Index/IndexTest.php +++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/Index/IndexTest.php @@ -3,7 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Unit\Controller\Index; +namespace Magento\Framework\Controller\Test\Unit\Controller\Index; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; @@ -13,9 +13,9 @@ class IndexTest extends \PHPUnit_Framework_TestCase { $objectManager = new ObjectManager($this); /** - * @var \Magento\Core\Controller\Index\Index + * @var \Magento\Framework\Controller\Index\Index */ - $controller = $objectManager->getObject('Magento\Core\Controller\Index\Index'); + $controller = $objectManager->getObject('Magento\Framework\Controller\Index\Index'); // The execute method is empty and returns void, just calling to verify // the method exists and does not throw an exception diff --git a/app/code/Magento/Core/Test/Unit/Controller/NorouteTest.php b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php similarity index 94% rename from app/code/Magento/Core/Test/Unit/Controller/NorouteTest.php rename to lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php index e8fa0f8df15a7325fdca4234d423af3a02549276..e1224c5ff7f80ed4ceec7bdb91671a9449865a0b 100644 --- a/app/code/Magento/Core/Test/Unit/Controller/NorouteTest.php +++ b/lib/internal/Magento/Framework/Controller/Test/Unit/Controller/NorouteTest.php @@ -3,12 +3,12 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Unit\Controller; +namespace Magento\Framework\Controller\Test\Unit\Controller; class NorouteTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Controller\Noroute\Index + * @var \Magento\Framework\Controller\Noroute */ protected $_controller; @@ -34,7 +34,7 @@ class NorouteTest extends \PHPUnit_Framework_TestCase $this->_viewMock = $this->getMock('\Magento\Framework\App\ViewInterface'); $this->_statusMock = $this->getMock('Magento\Framework\Object', ['getLoaded'], [], '', false); $this->_controller = $helper->getObject( - 'Magento\Core\Controller\Noroute\Index', + 'Magento\Framework\Controller\Noroute\Index', ['request' => $this->_requestMock, 'view' => $this->_viewMock] ); } diff --git a/lib/internal/Magento/Framework/Convert/ConvertArray.php b/lib/internal/Magento/Framework/Convert/ConvertArray.php index bf9fa3110998d548374f234ea82748b2af4c253e..902c7c99dee79309cb3af33e4c03fbcdbd130d73 100644 --- a/lib/internal/Magento/Framework/Convert/ConvertArray.php +++ b/lib/internal/Magento/Framework/Convert/ConvertArray.php @@ -67,7 +67,7 @@ XML; * @return \SimpleXMLElement * @throws Exception */ - private function _assocToXml(array $array, $rootName, \SimpleXMLElement &$xml) + private function _assocToXml(array $array, $rootName, \SimpleXMLElement $xml) { $hasNumericKey = false; $hasStringKey = false; @@ -78,12 +78,13 @@ XML; throw new Exception('Associative key must not be the same as its parent associative key.'); } $hasStringKey = true; - $xml->{$key} = $value; + $xml->addChild($key, $value); } elseif (is_int($key)) { $hasNumericKey = true; - $xml->{$rootName}[$key] = $value; + $xml->addChild($key, $value); } } else { + $xml->addChild($key); self::_assocToXml($value, $key, $xml->{$key}); } } diff --git a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php index 5b23d07bc05c3c2d82e5baca6486b5d600cffca2..994b3a2c25f9c8b2cf378f55d7ef9367ff474a5f 100644 --- a/lib/internal/Magento/Framework/Data/AbstractSearchResult.php +++ b/lib/internal/Magento/Framework/Data/AbstractSearchResult.php @@ -103,6 +103,16 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search return $this->data['items']; } + /** + * @param \Magento\Framework\Object[] $items + * @return $this + */ + public function setItems(array $items = null) + { + $this->data['items'] = $items; + return $this; + } + /** * @return int */ @@ -114,6 +124,16 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search return $this->data['total_count']; } + /** + * @param int $totalCount + * @return $this + */ + public function setTotalCount($totalCount) + { + $this->data['total_count'] = $totalCount; + return $this; + } + /** * @return \Magento\Framework\Api\CriteriaInterface */ @@ -125,6 +145,16 @@ abstract class AbstractSearchResult extends AbstractDataObject implements Search return $this->data['search_criteria']; } + /** + * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @return $this + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function setSearchCriteria(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null) + { + return $this; + } + /** * @return \Magento\Framework\Data\SearchResultIterator */ diff --git a/lib/internal/Magento/Framework/Data/Collection.php b/lib/internal/Magento/Framework/Data/Collection.php index c8ab80c82f3d2674e4fa500afd343eb2d349c5bf..2ba01363659041e1916b2dd9de9f33e613b13563 100644 --- a/lib/internal/Magento/Framework/Data/Collection.php +++ b/lib/internal/Magento/Framework/Data/Collection.php @@ -15,8 +15,7 @@ use Magento\Framework\Option\ArrayInterface; */ /** - * TODO: Refactor use of \Magento\Framework\Option\ArrayInterface in library. Probably will be refactored while - * moving \Magento\Core to library + * TODO: Refactor use of \Magento\Framework\Option\ArrayInterface in library. */ class Collection implements \IteratorAggregate, \Countable, ArrayInterface, CollectionDataSourceInterface { diff --git a/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php b/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php index 3341e32d209d0f4ecac8ef55bd9bed4d15308595..6ab0ab7e5d21f1da09d0a54b320969a03d401701 100644 --- a/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php +++ b/lib/internal/Magento/Framework/Data/Collection/EntityFactory.php @@ -35,9 +35,9 @@ class EntityFactory implements EntityFactoryInterface public function create($className, array $data = []) { $model = $this->_objectManager->create($className, $data); - //TODO: fix that when this factory used only for \Magento\Core\Model\Abstract - //if (!$model instanceof \Magento\Core\Model\Abstract) { - // throw new \LogicException($className . ' doesn\'t implement \Magento\Core\Model\Abstract'); + //TODO: fix that when this factory used only for \Magento\Framework\Model\AbstractModel + //if (!$model instanceof \Magento\Framework\Model\AbstractModel) { + // throw new \LogicException($className . ' doesn\'t implement \Magento\Framework\Model\AbstractModel'); //} return $model; } diff --git a/lib/internal/Magento/Framework/Filesystem/Io/File.php b/lib/internal/Magento/Framework/Filesystem/Io/File.php index bda846e3ce5e310614266bdb7271050a259c173d..947409e10c185e4c50d22cfeb99bff839ee142b5 100644 --- a/lib/internal/Magento/Framework/Filesystem/Io/File.php +++ b/lib/internal/Magento/Framework/Filesystem/Io/File.php @@ -88,39 +88,6 @@ class File extends AbstractIo } } - /** - * Open file in stream mode - * For set folder for file use open method - * - * @param string $fileName - * @param string $mode - * @param int $chmod - * @return true - * @throws \Exception - */ - public function streamOpen($fileName, $mode = 'w+', $chmod = 0666) - { - $writeableMode = preg_match('#^[wax]#i', $mode); - if ($writeableMode && !is_writeable($this->_cwd)) { - throw new \Exception('Permission denied for write to ' . $this->_cwd); - } - - if (!ini_get('auto_detect_line_endings')) { - ini_set('auto_detect_line_endings', 1); - } - - $this->_cwd(); - $this->_streamHandler = @fopen($fileName, $mode); - $this->_iwd(); - if ($this->_streamHandler === false) { - throw new \Exception('Error write to file ' . $fileName); - } - - $this->_streamFileName = $fileName; - $this->_streamChmod = $chmod; - return true; - } - /** * Lock file * diff --git a/lib/internal/Magento/Framework/Flag/Resource.php b/lib/internal/Magento/Framework/Flag/Resource.php index 1f8014ba0acb97520faaa154bc7aee198cf6f6a3..c1f4a1079841be17b74d6b85aa99d0001bea2436 100644 --- a/lib/internal/Magento/Framework/Flag/Resource.php +++ b/lib/internal/Magento/Framework/Flag/Resource.php @@ -17,6 +17,6 @@ class Resource extends \Magento\Framework\Model\Resource\Db\AbstractDb */ protected function _construct() { - $this->_init('core_flag', 'flag_id'); + $this->_init('flag', 'flag_id'); } } diff --git a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php index 1d3b133279ae43d9439bc1fa521854c926f66e3c..25fcd6ac2f4f51f4bba579aeb064a6d6368824bb 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php +++ b/lib/internal/Magento/Framework/Image/Adapter/ImageMagick.php @@ -130,7 +130,7 @@ class ImageMagick extends \Magento\Framework\Image\Adapter\AbstractAdapter public function getImage() { $this->_applyOptions(); - return (string)$this->_imageHandler; + return $this->_imageHandler->getImageBlob(); } /** @@ -316,7 +316,7 @@ class ImageMagick extends \Magento\Framework\Image\Adapter\AbstractAdapter } // merge layers - $this->_imageHandler->flattenImages(); + $this->_imageHandler->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN); $watermark->clear(); $watermark->destroy(); } diff --git a/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php b/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php index f0cb7cd637c48d9331fad0f8d0f4e6a890eb3389..2458a3cbd7518252b1d5671a5ec379445b87f0c1 100644 --- a/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php +++ b/lib/internal/Magento/Framework/Interception/Code/Generator/Interceptor.php @@ -83,7 +83,7 @@ class Interceptor extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getDefaultConstructorDefinition() { - $reflectionClass = new \ReflectionClass($this->_getSourceClassName()); + $reflectionClass = new \ReflectionClass($this->getSourceClassName()); $constructor = $reflectionClass->getConstructor(); $parameters = []; if ($constructor) { @@ -201,7 +201,7 @@ class Interceptor extends \Magento\Framework\Code\Generator\EntityAbstract "return \$result;\n", ]; - $reflectionClass = new \ReflectionClass($this->_getSourceClassName()); + $reflectionClass = new \ReflectionClass($this->getSourceClassName()); $publicMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($publicMethods as $method) { if ($this->isInterceptedMethod($method)) { @@ -283,7 +283,7 @@ class Interceptor extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _generateCode() { - $typeName = $this->_getSourceClassName(); + $typeName = $this->getSourceClassName(); $reflection = new \ReflectionClass($typeName); if ($reflection->isInterface()) { @@ -302,7 +302,7 @@ class Interceptor extends \Magento\Framework\Code\Generator\EntityAbstract $result = parent::_validateData(); if ($result) { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== $sourceClassName . '\\Interceptor') { diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php index f35ef42d6dc435af0b689f597276d22e4cdf9962..6c12758905634c325153a2b588ee72d08c5ad108 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Config/ConfigTest.php @@ -3,6 +3,7 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile namespace Magento\Framework\Interception\Test\Unit\Config; require_once __DIR__ . '/../Custom/Module/Model/Item.php'; @@ -40,6 +41,11 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected $definitionMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $relationsMock; + protected function setUp() { $this->readerMock = $this->getMock( @@ -55,6 +61,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'Magento\Framework\Interception\ObjectManager\ConfigInterface' ); $this->definitionMock = $this->getMock('Magento\Framework\ObjectManager\DefinitionInterface'); + $this->relationsMock = $this->getMockForAbstractClass('Magento\Framework\ObjectManager\RelationsInterface'); } /** @@ -62,7 +69,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase * @param string $type * @dataProvider hasPluginsDataProvider */ - public function testHasPluginsWhenDataIsNotCached($expectedResult, $type) + public function testHasPluginsWhenDataIsNotCached($expectedResult, $type, $entityParents) { $readerMap = include __DIR__ . '/../_files/reader_mock_map.php'; $this->readerMock->expects($this->any()) @@ -112,14 +119,17 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->definitionMock->expects($this->any())->method('getClasses')->will($this->returnValue( [ 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy', - '\Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy', + 'Magento\Framework\Interception\Custom\Module\Model\Backslash\ItemProxy', ] )); + $this->relationsMock->expects($this->any())->method('has')->will($this->returnValue($expectedResult)); + $this->relationsMock->expects($this->any())->method('getParents')->will($this->returnValue($entityParents)); + $model = new \Magento\Framework\Interception\Config\Config( $this->readerMock, $this->configScopeMock, $this->cacheMock, - new \Magento\Framework\ObjectManager\Relations\Runtime(), + $this->relationsMock, $this->omConfigMock, $this->definitionMock, 'interception' @@ -170,27 +180,33 @@ class ConfigTest extends \PHPUnit_Framework_TestCase [ true, 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer', + [], ], [ true, 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item', + [], ], [ true, 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\Item\Enhanced', + [], ], [ // the following model has only inherited plugins true, 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer\Enhanced', + ['Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemContainer'], ], [ false, 'Magento\Framework\Interception\Test\Unit\Custom\Module\Model\ItemProxy', + [], ], [ true, 'virtual_custom_item', + [], ] ]; } diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php index d69723ea8c5cef32357ea7e8766c24a69cf3bbb3..e5a84c89fa4ef60da3c42df09584990a53a1cced 100644 --- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php @@ -6,11 +6,7 @@ namespace Magento\Framework\Model; -use Magento\Framework\Api\ExtensibleDataInterface; -use Magento\Framework\Api\MetadataServiceInterface; -use Magento\Framework\Api\AttributeValue; use Magento\Framework\Api\AttributeValueFactory; -use Symfony\Component\DependencyInjection\Exception\LogicException; /** * Abstract model with custom attributes support. @@ -19,12 +15,18 @@ use Symfony\Component\DependencyInjection\Exception\LogicException; * Implementations may choose to process custom attributes as their persistence requires them to. * @SuppressWarnings(PHPMD.NumberOfChildren) */ -abstract class AbstractExtensibleModel extends AbstractModel implements ExtensibleDataInterface +abstract class AbstractExtensibleModel extends AbstractModel implements + \Magento\Framework\Api\CustomAttributesDataInterface { /** - * @var MetadataServiceInterface + * @var \Magento\Framework\Api\ExtensionAttributesFactory */ - protected $metadataService; + protected $extensionAttributesFactory; + + /** + * @var \Magento\Framework\Api\ExtensionAttributesInterface + */ + protected $extensionAttributes; /** * @var AttributeValueFactory @@ -39,7 +41,7 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry - * @param MetadataServiceInterface $metadataService + * @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory * @param AttributeValueFactory $customAttributeFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -48,13 +50,13 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, - MetadataServiceInterface $metadataService, + \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = [] ) { - $this->metadataService = $metadataService; + $this->extensionAttributesFactory = $extensionFactory; $this->customAttributeFactory = $customAttributeFactory; $data = $this->filterCustomAttributes($data); parent::__construct($context, $registry, $resource, $resourceCollection, $data); @@ -77,7 +79,7 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib $customAttributesCodes = $this->getCustomAttributesCodes(); $data[self::CUSTOM_ATTRIBUTES] = array_intersect_key( (array)$data[self::CUSTOM_ATTRIBUTES], - $customAttributesCodes + array_flip($customAttributesCodes) ); foreach ($data[self::CUSTOM_ATTRIBUTES] as $code => $value) { if (!($value instanceof \Magento\Framework\Api\AttributeInterface)) { @@ -148,11 +150,12 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib { if (is_array($key)) { $key = $this->filterCustomAttributes($key); - } elseif ($key == self::CUSTOM_ATTRIBUTES) { + } else if ($key == self::CUSTOM_ATTRIBUTES) { $filteredData = $this->filterCustomAttributes([self::CUSTOM_ATTRIBUTES => $value]); $value = $filteredData[self::CUSTOM_ATTRIBUTES]; } - return parent::setData($key, $value); + parent::setData($key, $value); + return $this; } /** @@ -168,7 +171,7 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib * * In addition to parent implementation custom attributes support is added. * - * @param string $key + * @param string $key * @param string|int $index * @return mixed */ @@ -194,26 +197,35 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib } /** - * Fetch all custom attributes for the given extensible model - * //TODO : check if the custom attribute is already defined as a getter on the data interface + * Get a list of custom attribute codes. + * + * By default, entity can be extended only using extension attributes functionality. * * @return string[] */ protected function getCustomAttributesCodes() { - if (!is_null($this->customAttributesCodes)) { - return $this->customAttributesCodes; - } + return []; + } + + /** + * Receive a list of EAV attributes using provided metadata service. + * + * Can be used in child classes, which represent EAV entities. + * + * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService + * @return string[] + */ + protected function getEavAttributesCodes(\Magento\Framework\Api\MetadataServiceInterface $metadataService) + { $attributeCodes = []; - $customAttributesMetadata = $this->metadataService->getCustomAttributesMetadata(get_class($this)); + $customAttributesMetadata = $metadataService->getCustomAttributesMetadata(get_class($this)); if (is_array($customAttributesMetadata)) { /** @var $attribute \Magento\Framework\Api\MetadataObjectInterface */ foreach ($customAttributesMetadata as $attribute) { - // Create a map for easier processing - $attributeCodes[$attribute->getAttributeCode()] = $attribute->getAttributeCode(); + $attributeCodes[] = $attribute->getAttributeCode(); } } - $this->customAttributesCodes = $attributeCodes; return $attributeCodes; } @@ -228,4 +240,26 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib parent::setId($value); return $this->setData('id', $value); } + + /** + * Set an extension attributes object. + * + * @param \Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes + * @return $this + */ + protected function _setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes) + { + $this->_data[self::EXTENSION_ATTRIBUTES_KEY] = $extensionAttributes; + return $this; + } + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\Framework\Api\ExtensionAttributesInterface + */ + protected function _getExtensionAttributes() + { + return $this->getData(self::EXTENSION_ATTRIBUTES_KEY); + } } diff --git a/lib/internal/Magento/Framework/Model/AbstractModel.php b/lib/internal/Magento/Framework/Model/AbstractModel.php index 5c5985ee70e0946722a440c0733ffa048e3dddc6..f31fb9fc3e90c7451f605f74022d82625c1f7b5e 100644 --- a/lib/internal/Magento/Framework/Model/AbstractModel.php +++ b/lib/internal/Magento/Framework/Model/AbstractModel.php @@ -642,6 +642,17 @@ abstract class AbstractModel extends \Magento\Framework\Object return $this->_getData('entity_id'); } + /** + * Set entity id + * + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData('entity_id', $entityId); + } + /** * Clearing object for correct deleting by garbage collector * diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php index 13bffdd695ea7eda4fe7d1fa0335cf35f3197631..df82d6f679446790dd0df79b6cf2633e6070053d 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/AbstractExtensibleModelTest.php @@ -4,8 +4,11 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Framework\Model\Test\Unit; +use Magento\Framework\Api\AttributeValue; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase @@ -97,6 +100,9 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase new \Magento\Framework\Object(['attribute_code' => 'attribute3']), ] ); + $extensionAttributesFactory = $this->getMockBuilder('Magento\Framework\Api\ExtensionAttributesFactory') + ->disableOriginalConstructor() + ->getMock(); $this->attributeValueFactoryMock = $this->getMockBuilder('Magento\Framework\Api\AttributeValueFactory') ->disableOriginalConstructor() ->getMock(); @@ -105,7 +111,7 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase [ $this->contextMock, $this->registryMock, - $this->metadataServiceMock, + $extensionAttributesFactory, $this->attributeValueFactoryMock, $this->resourceMock, $this->resourceCollectionMock @@ -129,10 +135,9 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase "Null is expected as a result of getCustomAttribute(\$code) when custom attribute is not set." ); $attributesAsArray = ['attribute1' => true, 'attribute2' => 'Attribute Value', 'attribute3' => 333]; - $addedAttributes = $this->addCustomAttributesToModel($attributesAsArray, $this->model); - $addedAttributes = array_values($addedAttributes); + $this->addCustomAttributesToModel($attributesAsArray, $this->model); $this->assertEquals( - $addedAttributes, + [], $this->model->getCustomAttributes(), 'Custom attributes retrieved from the model using getCustomAttributes() are invalid.' ); @@ -151,15 +156,13 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase ]; $modelData = ['key1' => 'value1', 'key2' => 222]; $this->model->setData($modelData); - $addedAttributes = $this->addCustomAttributesToModel($attributesAsArray, $this->model); - $modelDataAsFlatArray = array_merge($modelData, $addedAttributes); - unset($modelDataAsFlatArray['invalid']); + $this->addCustomAttributesToModel($attributesAsArray, $this->model); $this->assertEquals( - $modelDataAsFlatArray, + $modelData, $this->model->getData(), 'All model data should be represented as a flat array, including custom attributes.' ); - foreach ($modelDataAsFlatArray as $field => $value) { + foreach ($modelData as $field => $value) { $this->assertEquals( $value, $this->model->getData($field), @@ -173,7 +176,7 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase */ public function testRestrictedCustomAttributesGet() { - $this->model->getData(\Magento\Framework\Api\ExtensibleDataInterface::CUSTOM_ATTRIBUTES); + $this->model->getData(\Magento\Framework\Api\CustomAttributesDataInterface::CUSTOM_ATTRIBUTES); } public function testSetCustomAttributesAsLiterals() @@ -183,18 +186,18 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase $attributeMock = $this->getMockBuilder('\Magento\Framework\Api\AttributeValue') ->disableOriginalConstructor() ->getMock(); - $attributeMock->expects($this->once()) + $attributeMock->expects($this->never()) ->method('setAttributeCode') ->with($attributeCode) ->will($this->returnSelf()); - $attributeMock->expects($this->once()) + $attributeMock->expects($this->never()) ->method('setValue') ->with($attributeValue) ->will($this->returnSelf()); - $this->attributeValueFactoryMock->expects($this->once())->method('create') + $this->attributeValueFactoryMock->expects($this->never())->method('create') ->willReturn($attributeMock); $this->model->setData( - \Magento\Framework\Api\ExtensibleDataInterface::CUSTOM_ATTRIBUTES, + \Magento\Framework\Api\CustomAttributesDataInterface::CUSTOM_ATTRIBUTES, [$attributeCode => $attributeValue] ); } @@ -206,20 +209,19 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase */ protected function addCustomAttributesToModel($attributesAsArray, $model) { - $objectManager = new ObjectManagerHelper($this); - /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */ - $attributeValueBuilder = $objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder'); $addedAttributes = []; foreach ($attributesAsArray as $attributeCode => $attributeValue) { - $addedAttributes[$attributeCode] = $attributeValueBuilder - ->setAttributeCode($attributeCode) - ->setValue($attributeValue) - ->create(); + $addedAttributes[$attributeCode] = new AttributeValue( + [ + AttributeValue::ATTRIBUTE_CODE => $attributeCode, + AttributeValue::VALUE => $attributeValue, + ] + ); } $model->setData( array_merge( $model->getData(), - [\Magento\Framework\Api\ExtensibleDataInterface::CUSTOM_ATTRIBUTES => $addedAttributes] + [\Magento\Framework\Api\CustomAttributesDataInterface::CUSTOM_ATTRIBUTES => $addedAttributes] ) ); return $addedAttributes; diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php index e0dcd8a6d4da249be3d1d5ddfbbc90f56cb799c1..9d4540a26e896351957dd9bf08dd49454dfd842e 100644 --- a/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php +++ b/lib/internal/Magento/Framework/Model/Test/Unit/Resource/Db/Collection/AbstractCollectionTest.php @@ -12,6 +12,9 @@ use Magento\Framework\Model\Resource\Db\Collection\AbstractCollection; use Magento\Framework\Object as MagentoObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase { const TABLE_NAME = 'some_table'; @@ -78,6 +81,14 @@ class AbstractCollectionTest extends \PHPUnit_Framework_TestCase $this->uut = $this->getUut(); } + protected function tearDown() + { + parent::tearDown(); + $magentoObjectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, $_SERVER); + $objectManager = $magentoObjectManagerFactory->create($_SERVER); + \Magento\Framework\App\ObjectManager::setInstance($objectManager); + } + protected function getUut() { return $this->objectManagerHelper->getObject( diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/Declaration/Converter/DomTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/Declaration/Converter/DomTest.php index 81a0535a1955692719e3e0025f280503e850e1bd..c9c0b024ca9c9dc95ee54f68ea21482c3309f9fe 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/Declaration/Converter/DomTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/Declaration/Converter/DomTest.php @@ -28,22 +28,26 @@ class DomTest extends \PHPUnit_Framework_TestCase /** * @param string $xmlString - * @dataProvider testConvertWithInvalidDomDataProvider + * @dataProvider convertWithInvalidDomDataProvider * @expectedException \Exception */ public function testConvertWithInvalidDom($xmlString) { $dom = new \DOMDocument(); - $dom->loadXML($xmlString); - $this->_converter->convert($dom); + try { + $dom->loadXML($xmlString); + $this->_converter->convert($dom); + } catch (\PHPUnit_Framework_Error $ex) { + // do nothing because we expect \Exception but not \PHPUnit_Framework_Error + } } - public function testConvertWithInvalidDomDataProvider() + public function convertWithInvalidDomDataProvider() { return [ 'Module node without "name" attribute' => ['<?xml version="1.0"?><config><module /></config>'], 'Sequence module node without "name" attribute' => [ - '<?xml dbversion="1.0"?><config><module name="Module_One" setup_version="1.0.0.0">' . + '<?xml version="1.0"?><config><module name="Module_One" setup_version="1.0.0.0">' . '<sequence><module/></sequence></module></config>', ], ]; diff --git a/lib/internal/Magento/Framework/Mview/Test/Unit/Config/ConverterTest.php b/lib/internal/Magento/Framework/Mview/Test/Unit/Config/ConverterTest.php index a3ea7de3792d2cc2b447e23bb171b319762099c7..13901c1283cca62deaec9be9cf03eab0a73e1dae 100644 --- a/lib/internal/Magento/Framework/Mview/Test/Unit/Config/ConverterTest.php +++ b/lib/internal/Magento/Framework/Mview/Test/Unit/Config/ConverterTest.php @@ -25,24 +25,4 @@ class ConverterTest extends \PHPUnit_Framework_TestCase $this->assertEquals($data['expected'], $this->_model->convert($dom)); } - - /** - * @param string $xmlData - * @dataProvider wrongXmlDataProvider - * @expectedException \Exception - */ - public function testMapThrowsExceptionWhenXmlHasWrongFormat($xmlData) - { - $dom = new \DOMDocument(); - $dom->loadXML($xmlData); - $this->_model->convert($dom); - } - - /** - * @return array - */ - public function wrongXmlDataProvider() - { - return [['<?xml version="1.0"?><config>']]; - } } diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php index e2bca1d2086337a2a55a84c807024497fbc51107..65b02d8afce7189b5e4a912e2c3664c247f75276 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Converter.php @@ -47,8 +47,7 @@ class Converter extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getFactoryPropertyName() { - $parts = explode('\\', ltrim($this->_getSourceClassName(), '\\')); - return lcfirst(end($parts)) . 'Factory'; + return lcfirst($this->getSourceClassNameWithoutNamespace()) . 'Factory'; } /** @@ -58,7 +57,7 @@ class Converter extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getFactoryClass() { - return $this->_getSourceClassName() . 'Factory'; + return $this->getSourceClassName() . 'Factory'; } /** @@ -84,7 +83,7 @@ class Converter extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() + 'description' => $this->getSourceClassName() . " \$" . $this->_getFactoryPropertyName(), ], ], @@ -121,7 +120,7 @@ class Converter extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => 'return', - 'description' => $this->_getSourceClassName() + 'description' => $this->getSourceClassName() ], ], ], @@ -138,7 +137,7 @@ class Converter extends \Magento\Framework\Code\Generator\EntityAbstract return false; } - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== $sourceClassName . 'Converter') { diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Factory.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Factory.php index 33a4e7ee10f7add76fb93baca44b46daa3c871fa..ee28a12c169a83a19fda2db50adf4a5993aae6ee 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Factory.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Factory.php @@ -44,7 +44,7 @@ class Factory extends \Magento\Framework\Code\Generator\EntityAbstract 'name' => '__construct', 'parameters' => [ ['name' => 'objectManager', 'type' => '\Magento\Framework\ObjectManagerInterface'], - ['name' => 'instanceName', 'defaultValue' => $this->_getSourceClassName()], + ['name' => 'instanceName', 'defaultValue' => $this->getSourceClassName()], ], 'body' => "\$this->_objectManager = \$objectManager;\n\$this->_instanceName = \$instanceName;", 'docblock' => [ @@ -80,7 +80,7 @@ class Factory extends \Magento\Framework\Code\Generator\EntityAbstract ['name' => 'param', 'description' => 'array $data'], [ 'name' => 'return', - 'description' => $this->_getSourceClassName() + 'description' => $this->getSourceClassName() ], ], ], @@ -97,7 +97,7 @@ class Factory extends \Magento\Framework\Code\Generator\EntityAbstract $result = parent::_validateData(); if ($result) { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== $sourceClassName . 'Factory') { diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php index 9b83cb681d80177ceed23136ae93038d4915c078..8c54a7c689a0ee6e3eb11eb1ef1922463a0a0860 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php @@ -34,7 +34,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'var', - 'description' => $this->_getSourceClassName() . 'Factory', + 'description' => $this->getSourceClassName() . 'Factory', ], ], ], @@ -117,8 +117,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getSourceFactoryPropertyName() { - $parts = explode('\\', ltrim($this->_getSourceClassName(), '\\')); - return lcfirst(end($parts)) . 'Factory'; + return lcfirst($this->getSourceClassNameWithoutNamespace()) . 'Factory'; } /** @@ -127,8 +126,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getSourceResourcePropertyName() // InvoiceResource { - $parts = explode('\\', ltrim($this->_getSourceClassName(), '\\')); - return lcfirst(end($parts)) . "Resource"; + return lcfirst($this->getSourceClassNameWithoutNamespace()) . "Resource"; } /** @@ -138,7 +136,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getSourceResourceClassName() // Invoice\Resource { - $temporary = str_replace('\\Api\\Data\\', '\\Model\\Spi\\', $this->_getSourceClassName()); + $temporary = str_replace('\\Api\\Data\\', '\\Model\\Spi\\', $this->getSourceClassName()); $parts = explode('\\', ltrim($temporary, '\\')); $className = array_pop($parts); $className = str_replace('Interface', '', $className); @@ -180,7 +178,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => $this->_getSourceFactoryPropertyName(), - 'type' => $this->_getSourceClassName() . 'Factory' + 'type' => $this->getSourceClassName() . 'Factory' ], [ 'name' => 'resource', @@ -205,7 +203,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . 'Factory' + 'description' => $this->getSourceClassName() . 'Factory' . " \$" . $this->_getSourceFactoryPropertyName() ], [ @@ -295,7 +293,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => 'entity', - 'type' => $this->_getSourceClassName(), + 'type' => $this->getSourceClassName(), ], ], 'body' => $body, @@ -304,7 +302,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . " \$entity", + 'description' => $this->getSourceClassName() . " \$entity", ], ], ] @@ -388,7 +386,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => 'entity', - 'type' => $this->_getSourceClassName(), + 'type' => $this->getSourceClassName(), ], ], 'body' => $body, @@ -397,7 +395,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . " \$entity", + 'description' => $this->getSourceClassName() . " \$entity", ], ], ] @@ -431,7 +429,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . " \$entity", + 'description' => $this->getSourceClassName() . " \$entity", ], ], ] @@ -457,7 +455,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => 'entity', - 'type' => $this->_getSourceClassName(), + 'type' => $this->getSourceClassName(), ], ], 'body' => $body, @@ -467,7 +465,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . " \$entity", + 'description' => $this->getSourceClassName() . " \$entity", ], ], ] @@ -482,7 +480,7 @@ class Persistor extends \Magento\Framework\Code\Generator\EntityAbstract $result = parent::_validateData(); if ($result) { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== $sourceClassName . 'Persistor') { diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php index e09dcef74ac47445da2b4672d771539986110128..82686165132f8367f7999972af0e51c238e2cc8b 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Proxy.php @@ -47,7 +47,7 @@ class Proxy extends \Magento\Framework\Code\Generator\EntityAbstract 'visibility' => 'protected', 'docblock' => [ 'shortDescription' => 'Proxied instance', - 'tags' => [['name' => 'var', 'description' => $this->_getSourceClassName()]], + 'tags' => [['name' => 'var', 'description' => $this->getSourceClassName()]], ], ]; @@ -101,10 +101,10 @@ class Proxy extends \Magento\Framework\Code\Generator\EntityAbstract "return \$this->_subject;", 'docblock' => [ 'shortDescription' => 'Get proxied instance', - 'tags' => [['name' => 'return', 'description' => $this->_getSourceClassName()]], + 'tags' => [['name' => 'return', 'description' => $this->getSourceClassName()]], ], ]; - $reflectionClass = new \ReflectionClass($this->_getSourceClassName()); + $reflectionClass = new \ReflectionClass($this->getSourceClassName()); $publicMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($publicMethods as $method) { if (!($method->isConstructor() || @@ -127,7 +127,7 @@ class Proxy extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _generateCode() { - $typeName = $this->_getSourceClassName(); + $typeName = $this->getSourceClassName(); $reflection = new \ReflectionClass($typeName); if ($reflection->isInterface()) { @@ -181,7 +181,7 @@ class Proxy extends \Magento\Framework\Code\Generator\EntityAbstract 'name' => '__construct', 'parameters' => [ ['name' => 'objectManager', 'type' => '\Magento\Framework\ObjectManagerInterface'], - ['name' => 'instanceName', 'defaultValue' => $this->_getSourceClassName()], + ['name' => 'instanceName', 'defaultValue' => $this->getSourceClassName()], ['name' => 'shared', 'defaultValue' => true], ], 'body' => "\$this->_objectManager = \$objectManager;" . @@ -225,7 +225,7 @@ class Proxy extends \Magento\Framework\Code\Generator\EntityAbstract { $result = parent::_validateData(); if ($result) { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== $sourceClassName . '\\Proxy') { diff --git a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php index ce047eb4a6f693d23df1459070ba981e9c82fd34..22857fcf9bcfae8bfe3f0de7f675263cfdae33ee 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php +++ b/lib/internal/Magento/Framework/ObjectManager/Code/Generator/Repository.php @@ -64,7 +64,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'visibility' => 'protected', 'defaultValue' => [], 'docblock' => [ - 'shortDescription' => $this->_getSourceClassName() . '[]', + 'shortDescription' => $this->getSourceClassName() . '[]', 'tags' => [ [ 'name' => 'var', @@ -84,8 +84,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getSourcePersistorPropertyName() { - $parts = explode('\\', ltrim($this->_getSourceClassName(), '\\')); - return lcfirst(end($parts)) . 'Persistor'; + return lcfirst($this->getSourceClassNameWithoutNamespace()) . 'Persistor'; } /** @@ -94,8 +93,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getSourceCollectionFactoryPropertyName() { - $parts = explode('\\', ltrim($this->_getSourceClassName(), '\\')); - return lcfirst(end($parts)) . 'SearchResultFactory'; + return lcfirst($this->getSourceClassNameWithoutNamespace()) . 'SearchResultFactory'; } /** @@ -106,7 +104,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract protected function _getCollectionFactoryClassName() { return - str_replace('Interface', '', $this->_getSourceClassName()) . 'SearchResultInterfaceFactory'; + str_replace('Interface', '', $this->getSourceClassName()) . 'SearchResultInterfaceFactory'; } /** * Returns source persistor class name @@ -115,7 +113,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _getPersistorClassName() { - $target = $this->_getSourceClassName(); + $target = $this->getSourceClassName(); // if (substr($target, -9) == 'Interface') { // $target = substr($target, 1, strlen($target) -9); // } @@ -153,7 +151,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . " \$" . $this->_getSourcePersistorPropertyName(), + 'description' => $this->getSourceClassName() . " \$" . $this->_getSourcePersistorPropertyName(), ], [ 'name' => 'param', @@ -202,7 +200,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => 'return', - 'description' => $this->_getSourceClassName(), + 'description' => $this->getSourceClassName(), ], [ 'name' => 'throws', @@ -263,7 +261,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => 'entity', - 'type' => $this->_getSourceClassName(), + 'type' => $this->getSourceClassName(), ], ], 'body' => $body, @@ -276,7 +274,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => 'return', - 'description' => $this->_getSourceClassName(), + 'description' => $this->getSourceClassName(), ], ], ] @@ -319,7 +317,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => 'entity', - 'type' => $this->_getSourceClassName(), + 'type' => $this->getSourceClassName(), ], ], 'body' => $body, @@ -328,11 +326,11 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . " \$entity", + 'description' => $this->getSourceClassName() . " \$entity", ], [ 'name' => 'return', - 'description' => $this->_getSourceClassName(), + 'description' => $this->getSourceClassName(), ], ], ] @@ -353,7 +351,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => 'entity', - 'type' => $this->_getSourceClassName(), + 'type' => $this->getSourceClassName(), ], ], 'body' => $body, @@ -362,7 +360,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . ' $entity', + 'description' => $this->getSourceClassName() . ' $entity', ], ], ] @@ -413,7 +411,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'parameters' => [ [ 'name' => 'entity', - 'type' => $this->_getSourceClassName(), + 'type' => $this->getSourceClassName(), ], ], 'body' => $body, @@ -422,7 +420,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract 'tags' => [ [ 'name' => 'param', - 'description' => $this->_getSourceClassName() . ' $entity', + 'description' => $this->getSourceClassName() . ' $entity', ], ], ] @@ -464,7 +462,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract ], [ 'name' => 'return', - 'description' => $this->_getSourceClassName() . '[]', + 'description' => $this->getSourceClassName() . '[]', ], ], ] @@ -500,7 +498,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract $result = parent::_validateData(); if ($result) { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== str_replace('Interface', '', $sourceClassName) . '\\Repository') { @@ -520,7 +518,7 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _generateCode() { - $className = str_replace('Interface', '', str_replace('Data\\', '', $this->_getSourceClassName())); + $className = str_replace('Interface', '', str_replace('Data\\', '', $this->getSourceClassName())); $this->_classGenerator->setName( $this->_getResultClassName() )->addProperties( @@ -542,8 +540,8 @@ class Repository extends \Magento\Framework\Code\Generator\EntityAbstract * * @return string */ - protected function _getSourceClassName() + public function getSourceClassName() { - return parent::_getSourceClassName() . 'Interface'; + return parent::getSourceClassName() . 'Interface'; } } diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php index bb9f7e00b4ca9e187707100883bf279521229f75..00aac17d300ed3522a3c1f0726186622a594875f 100644 --- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php +++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php @@ -11,10 +11,8 @@ namespace Magento\Framework\ObjectManager; -use Magento\Framework\Api\Code\Generator\DataBuilder as DataBuilderGenerator; use Magento\Framework\Api\Code\Generator\Mapper as MapperGenerator; use Magento\Framework\Api\Code\Generator\SearchResults; -use Magento\Framework\Api\Code\Generator\SearchResultsBuilder; use Magento\Framework\Filesystem\DriverInterface; use Magento\Framework\Interception\Code\Generator as InterceptionGenerator; use Magento\Framework\ObjectManager\Code\Generator; @@ -23,7 +21,8 @@ use Magento\Framework\ObjectManager\Definition\Compiled\Binary; use Magento\Framework\ObjectManager\Definition\Compiled\Serialized; use Magento\Framework\ObjectManager\Definition\Runtime; use Magento\Framework\ObjectManager\Profiler\Code\Generator as ProfilerGenerator; -use Magento\Framework\Api\Code\Generator\ObjectExtensionInterface; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator; +use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -68,6 +67,11 @@ class DefinitionFactory Serialized::MODE_NAME => '\Magento\Framework\ObjectManager\Definition\Compiled\Serialized', ]; + /** + * @var \Magento\Framework\Code\Generator + */ + protected $codeGenerator; + /** * @param DriverInterface $filesystemDriver * @param string $definitionDir @@ -97,29 +101,7 @@ class DefinitionFactory $definitionModel = $this->_definitionClasses[$this->_definitionFormat]; $result = new $definitionModel($definitions); } else { - $generatorIo = new \Magento\Framework\Code\Generator\Io( - $this->_filesystemDriver, - $this->_generationDir - ); - $generator = new \Magento\Framework\Code\Generator( - $generatorIo, - [ - SearchResultsBuilder::ENTITY_TYPE => '\Magento\Framework\Api\Code\Generator\SearchResultsBuilder', - Generator\Factory::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Factory', - Generator\Proxy::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Proxy', - Generator\Repository::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Repository', - Generator\Persistor::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Persistor', - InterceptionGenerator\Interceptor::ENTITY_TYPE => '\Magento\Framework\Interception\Code\Generator\Interceptor', - DataBuilderGenerator::ENTITY_TYPE => '\Magento\Framework\Api\Code\Generator\DataBuilder', - DataBuilderGenerator::ENTITY_TYPE_BUILDER => 'Magento\Framework\Api\Code\Generator\DataBuilder', - MapperGenerator::ENTITY_TYPE => '\Magento\Framework\Api\Code\Generator\Mapper', - SearchResults::ENTITY_TYPE => '\Magento\Framework\Api\Code\Generator\SearchResults', - ConverterGenerator::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Converter', - ProfilerGenerator\Logger::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger', - ObjectExtensionInterface::ENTITY_TYPE => - 'Magento\Framework\Api\Code\Generator\ObjectExtensionInterface' ] - ); - $autoloader = new \Magento\Framework\Code\Generator\Autoloader($generator); + $autoloader = new \Magento\Framework\Code\Generator\Autoloader($this->getCodeGenerator()); spl_autoload_register([$autoloader, 'load']); $result = new Runtime(); @@ -172,4 +154,36 @@ class DefinitionFactory $extractor = $this->_definitionFormat == Binary::MODE_NAME ? 'igbinary_unserialize' : 'unserialize'; return $extractor($definitions); } + + /** + * Get existing code generator. Instantiate a new one if it does not exist yet. + * + * @return \Magento\Framework\Code\Generator + */ + public function getCodeGenerator() + { + if (!$this->codeGenerator) { + $generatorIo = new \Magento\Framework\Code\Generator\Io( + $this->_filesystemDriver, + $this->_generationDir + ); + $this->codeGenerator = new \Magento\Framework\Code\Generator( + $generatorIo, + [ + Generator\Factory::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Factory', + Generator\Proxy::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Proxy', + Generator\Repository::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Repository', + Generator\Persistor::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Persistor', + InterceptionGenerator\Interceptor::ENTITY_TYPE => '\Magento\Framework\Interception\Code\Generator\Interceptor', + MapperGenerator::ENTITY_TYPE => '\Magento\Framework\Api\Code\Generator\Mapper', + SearchResults::ENTITY_TYPE => '\Magento\Framework\Api\Code\Generator\SearchResults', + ConverterGenerator::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Code\Generator\Converter', + ProfilerGenerator\Logger::ENTITY_TYPE => '\Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger', + ExtensionAttributesGenerator::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator', + ExtensionAttributesInterfaceGenerator::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator' + ] + ); + } + return $this->codeGenerator; + } } diff --git a/lib/internal/Magento/Framework/ObjectManager/Profiler/Code/Generator/Logger.php b/lib/internal/Magento/Framework/ObjectManager/Profiler/Code/Generator/Logger.php index c30507a345a4225b46c4c272dcee7a4e243c390a..c8336a6ad15eb52152b7ab41e77c6cbef5d78182 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Profiler/Code/Generator/Logger.php +++ b/lib/internal/Magento/Framework/ObjectManager/Profiler/Code/Generator/Logger.php @@ -116,7 +116,7 @@ class Logger extends \Magento\Framework\Code\Generator\EntityAbstract . "\n\$this->log->add(\$this->subject);", ]; - $reflectionClass = new \ReflectionClass($this->_getSourceClassName()); + $reflectionClass = new \ReflectionClass($this->getSourceClassName()); $publicMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC); foreach ($publicMethods as $method) { if (!($method->isConstructor() || $method->isFinal() || $method->isStatic() || $method->isDestructor()) @@ -183,7 +183,7 @@ class Logger extends \Magento\Framework\Code\Generator\EntityAbstract */ protected function _generateCode() { - $typeName = $this->_getSourceClassName(); + $typeName = $this->getSourceClassName(); $reflection = new \ReflectionClass($typeName); if ($reflection->isInterface()) { @@ -202,7 +202,7 @@ class Logger extends \Magento\Framework\Code\Generator\EntityAbstract $result = parent::_validateData(); if ($result) { - $sourceClassName = $this->_getSourceClassName(); + $sourceClassName = $this->getSourceClassName(); $resultClassName = $this->_getResultClassName(); if ($resultClassName !== $sourceClassName . '\\Logger') { diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php index 88bce3e3a2a3aa0ce8fcf8cbb8220cd31b3ba8cf..c3eeeabb3125d93bc74abb10f3aff6141edfd376 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/mapped_simple_di_config.php @@ -9,17 +9,17 @@ return [ 'Magento\Framework\App\RequestInterface' => 'Magento\Framework\App\Request\Http\Proxy', ], 'Magento\Framework\App\State' => ['arguments' => ['test name' => 'test value']], - 'Magento\Core\Model\Config\Modules' => [ + 'Magento\Config\Model\Config\Modules' => [ 'arguments' => ['test name' => 'test value'], 'plugins' => [ 'simple_modules_plugin' => [ 'sortOrder' => 10, 'disabled' => true, - 'instance' => 'Magento\Core\Model\Config\Modules\Plugin', + 'instance' => 'Magento\Config\Model\Config\Modules\Plugin', ], 'simple_modules_plugin_advanced' => [ 'sortOrder' => 0, - 'instance' => 'Magento\Core\Model\Config\Modules\PluginAdvanced', + 'instance' => 'Magento\Config\Model\Config\Modules\PluginAdvanced', ], 'overridden_plugin' => ['sortOrder' => 30, 'disabled' => true], ], diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/simple_di_config.xml b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/simple_di_config.xml index 823fd9b38f6de60b756eafe7087cbebcc47e7986..d930f3dadf451c56bcaea24e5dab4060faba8e01 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/simple_di_config.xml +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/Mapper/_files/simple_di_config.xml @@ -16,12 +16,12 @@ </arguments> </type> <!--Arguments and plugins--> - <type name="Magento\Core\Model\Config\Modules"> + <type name="Magento\Config\Model\Config\Modules"> <arguments> <argument name="test name" xsi:type="string">test value</argument> </arguments> - <plugin name="simple_modules_plugin" type="Magento\Core\Model\Config\Modules\Plugin" disabled="true" sortOrder="10" /> - <plugin name="simple_modules_plugin_advanced" type="Magento\Core\Model\Config\Modules\PluginAdvanced" /> + <plugin name="simple_modules_plugin" type="Magento\Config\Model\Config\Modules\Plugin" disabled="true" sortOrder="10" /> + <plugin name="simple_modules_plugin_advanced" type="Magento\Config\Model\Config\Modules\PluginAdvanced" /> <plugin name="overridden_plugin" sortOrder="30" disabled="true" /> </type> <!--Unshared type--> diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php index 7309a4b1a67ba16f2c83524882f9427c6aedaf54..3fde1b24d33603ef8159914db3ec962de5c9299b 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Relations/RuntimeTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\ObjectManager\Test\Unit\Relations; require_once __DIR__ . '/../_files/Child.php'; @@ -36,4 +39,25 @@ class RuntimeTest extends \PHPUnit_Framework_TestCase ['Magento\Test\Di\Child', ['Magento\Test\Di\DiParent', 'Magento\Test\Di\ChildInterface']] ]; } + + /** + * @param $entity + * @expectedException \Magento\Framework\Exception + * @dataProvider nonExistentGeneratorsDataProvider + */ + public function testHasIfNonExists($entity) + { + $this->_model->has($entity); + } + + public function nonExistentGeneratorsDataProvider() + { + return [ + ['Magento\Test\Module\Model\Item\Factory'], + ['Magento\Test\Module\Model\Item\Proxy'], + ['Magento\Test\Module\Model\Item\Interceptor'], + ['Magento\Test\Module\Model\Item\Mapper'], + ['Magento\Test\Module\Model\Item\SearchResults'] + ]; + } } diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/CollectionTest.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/CollectionTest.php index 8c0e0812b5601c8fbbfc6866baab37a0131d66e1..96a4abb41e71b3cf0b92be5b493f23c02bb12fad 100644 --- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/CollectionTest.php +++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Adjustment/CollectionTest.php @@ -76,7 +76,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $result = $collection->getItems(); - $this->assertEquals($expectedResult, array_keys($result)); + $this->assertEmpty(array_diff($expectedResult, array_keys($result))); } public function getItemsDataProvider() diff --git a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php index c1d58952de1c9d4006c947a6fa34de1aeb427f48..2b9977d7355f565e808b15cc539c7c892f38afa6 100644 --- a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php @@ -8,7 +8,7 @@ namespace Magento\Framework\Reflection; use Magento\Framework\Phrase; use Magento\Framework\Api\AttributeValue; -use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\Framework\Api\CustomAttributesDataInterface; use Magento\Framework\Api\SimpleDataObjectConverter; use Zend\Code\Reflection\ClassReflection; use Zend\Code\Reflection\MethodReflection; @@ -108,7 +108,7 @@ class DataObjectProcessor continue; } $key = SimpleDataObjectConverter::camelCaseToSnakeCase(substr($methodName, 3)); - if ($key === ExtensibleDataInterface::CUSTOM_ATTRIBUTES) { + if ($key === CustomAttributesDataInterface::CUSTOM_ATTRIBUTES) { $value = $this->convertCustomAttributes($value, $dataObjectType); } elseif (is_object($value) && !($value instanceof Phrase)) { $value = $this->buildOutputDataArray($value, $returnType); @@ -304,10 +304,7 @@ class DataObjectProcessor $isSuitableMethodType = !($method->isConstructor() || $method->isFinal() || $method->isStatic() || $method->isDestructor()); - $isExcludedMagicMethod = in_array( - $method->getName(), - ['__sleep', '__wakeup', '__clone'] - ); + $isExcludedMagicMethod = strpos($method->getName(), '__') === 0; return $isSuitableMethodType && !$isExcludedMagicMethod; } } diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/DataObject.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/DataObject.php new file mode 100644 index 0000000000000000000000000000000000000000..501ac376fe70d8e1945ffdc73ecee3d6e66176ba --- /dev/null +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/DataObject.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Reflection\Test\Unit; + +/** + * Dummy data object to be used by TypeProcessorTest + */ +class DataObject +{ + /** + * @var string + */ + protected $attrName; + + /** + * @var bool + */ + protected $isActive; + + /** + * @return string + */ + public function getAttrName() + { + return $this->attrName; + } + + /** + * @param string $attrName + * @return $this + */ + public function setAttrName($attrName) + { + $this->attrName = $attrName; + return $this; + } + + /** + * @return bool + */ + public function isActive() + { + return $this->isActive; + } + + /** + * @param bool $isActive + * @return $this + */ + public function setIsActive($isActive) + { + $this->isActive = $isActive; + return $this; + } +} diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php index 7dd1bf8f36f78018db1d4888a3f3e1df05fe6f6b..496416ff379e4f24a877ddb27fabe17a5535e104 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php @@ -3,8 +3,11 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreStart namespace Magento\Framework\Reflection\Test\Unit; +use Zend\Code\Reflection\ClassReflection; + /** * Type processor Test */ @@ -172,7 +175,7 @@ class TypeProcessorTest extends \PHPUnit_Framework_TestCase /** * @expectedException \Magento\Framework\Exception\SerializationException - * @expectedExceptionMessage Invalid type for value :"1". Expected Type: "int[]". + * @expectedExceptionMessage Invalid type for value :"integer". Expected Type: "int[]". */ public function testProcessSimpleTypeInvalidType() { @@ -180,4 +183,24 @@ class TypeProcessorTest extends \PHPUnit_Framework_TestCase $type = 'int[]'; $this->_typeProcessor->processSimpleAndAnyType($value, $type); } + + public function testFindSetterMethodName() + { + $class = new ClassReflection("\\Magento\\Framework\\Reflection\\Test\\Unit\\DataObject"); + $setterName = $this->_typeProcessor->findSetterMethodName($class, 'AttrName'); + $this->assertEquals("setAttrName", $setterName); + + $booleanSetterName = $this->_typeProcessor->findSetterMethodName($class, 'Active'); + $this->assertEquals("setIsActive", $booleanSetterName); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessageRegExp /Property :"InvalidAttribute" does not exist in the provided class: \w+/ + */ + public function testFindSetterMethodNameInvalidAttribute() + { + $class = new ClassReflection("\\Magento\\Framework\\Reflection\\Test\\Unit\\DataObject"); + $this->_typeProcessor->findSetterMethodName($class, 'InvalidAttribute'); + } } diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index ad2ea51bdaa51e13a6db466f43064499357fc7c2..38d65da521c7b9aee6e3d92a6948e55ebc1adc32 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -241,11 +241,17 @@ class TypeProcessor { $methodDocBlock = $methodReflection->getDocBlock(); if (!$methodDocBlock) { - throw new \InvalidArgumentException('Each getter must have description with @return annotation.'); + throw new \InvalidArgumentException( + "Each getter must have description with @return annotation. " + . "See {$methodReflection->getDeclaringClass()->getName()}::{$methodReflection->getName()}()" + ); } $returnAnnotations = $methodDocBlock->getTags('return'); if (empty($returnAnnotations)) { - throw new \InvalidArgumentException('Getter return type must be specified using @return annotation.'); + throw new \InvalidArgumentException( + "Getter return type must be specified using @return annotation. " + . "See {$methodReflection->getDeclaringClass()->getName()}::{$methodReflection->getName()}()" + ); } /** @var \Zend\Code\Reflection\DocBlock\Tag\ReturnTag $returnAnnotation */ $returnAnnotation = current($returnAnnotations); @@ -432,7 +438,7 @@ class TypeProcessor } elseif ($isArrayType && is_null($value)) { return null; } elseif (!$isArrayType && !is_array($value)) { - if ($value !== null && $type !== self::ANY_TYPE && !settype($value, $type)) { + if ($value !== null && $type !== self::ANY_TYPE && !$this->setType($value, $type)) { throw new SerializationException( SerializationException::TYPE_MISMATCH, ['value' => (string)$value, 'type' => $type] @@ -441,7 +447,7 @@ class TypeProcessor } else { throw new SerializationException( SerializationException::TYPE_MISMATCH, - ['value' => (string)$value, 'type' => $type] + ['value' => gettype($value), 'type' => $type] ); } return $value; @@ -495,4 +501,50 @@ class TypeProcessor } return $methodName; } + + /** + * Set value to a particular type + * + * @param mixed $value + * @param string $type + * @return true on successful type cast + */ + protected function setType(&$value, $type) + { + // settype doesn't work for boolean string values. + // ex: custom_attributes passed from SOAP client can have boolean values as string + if ($type == 'bool' || $type == 'boolean') { + $value = filter_var($value, FILTER_VALIDATE_BOOLEAN); + return true; + } + return settype($value, $type); + } + + /** + * Find the setter method name for a property from the given class + * + * @param ClassReflection $class + * @param string $camelCaseProperty + * @return string processed method name + * @throws \Exception If $camelCaseProperty has no corresponding setter method + */ + public function findSetterMethodName(ClassReflection $class, $camelCaseProperty) + { + $setterName = 'set' . $camelCaseProperty; + $boolSetterName = 'setIs' . $camelCaseProperty; + if ($class->hasMethod($setterName)) { + $methodName = $setterName; + } elseif ($class->hasMethod($boolSetterName)) { + $methodName = $boolSetterName; + } else { + throw new \Exception( + sprintf( + 'Property :"%s" does not exist in the provided class: "%s".', + $camelCaseProperty, + $class->getName() + ) + ); + } + return $methodName; + } } diff --git a/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php b/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php deleted file mode 100644 index a64670910d253dac667c3a7288bd5c4daa7e27f4..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Serialization; - -use Magento\Framework\ObjectManagerInterface; - -/** - * Factory used to construct Data Builder based on interface name - */ -class DataBuilderFactory -{ - /** - * @var ObjectManagerInterface - */ - protected $objectManager; - - /** - * @param ObjectManagerInterface $objectManager - */ - public function __construct(ObjectManagerInterface $objectManager) - { - $this->objectManager = $objectManager; - } - - /** - * Returns a builder for a given class name. - * - * @param string $className - * @return \Magento\Framework\Api\BuilderInterface Builder Instance - */ - public function getDataBuilder($className) - { - $builderClassName = $this->getBuilderClassName($className); - return $this->createObject($builderClassName); - } - - /** - * Returns builder class name - * - * @param string $className - * @return string - */ - protected function getBuilderClassName($className) - { - $interfaceSuffix = 'Interface'; - if (substr($className, -strlen($interfaceSuffix)) === $interfaceSuffix) { - /** If class name ends with Interface, replace it with Data suffix */ - $builderClassName = substr($className, 0, -strlen($interfaceSuffix)) . 'Data'; - } else { - $builderClassName = $className; - } - $builderClassName .= 'Builder'; - - $builderClassName = ltrim($builderClassName, '\\'); - return $builderClassName; - } - - /** - * Creates builder object - * - * @param string $builderClassName - * @return \Magento\Framework\Api\BuilderInterface Builder Instance - */ - protected function createObject($builderClassName) - { - return $this->objectManager->create($builderClassName); - } -} diff --git a/lib/internal/Magento/Framework/Serialization/Test/Unit/DataBuilderFactoryTest.php b/lib/internal/Magento/Framework/Serialization/Test/Unit/DataBuilderFactoryTest.php deleted file mode 100644 index 13487b6520acdec46695b92104b1b453c7352f3b..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Serialization/Test/Unit/DataBuilderFactoryTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Framework\Serialization\Test\Unit; - -use \Magento\Framework\Serialization\DataBuilderFactory; - -use Magento\Framework\ObjectManagerInterface; - -class DataBuilderFactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var ObjectManagerInterface | \PHPUnit_Framework_MockObject_MockObject - */ - private $objectManager; - - /** - * @var DataBuilderFactory - */ - private $dataBuilderFactory; - - public function setUp() - { - $this->objectManager = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface') - ->setMethods([]) - ->getMock(); - - $this->dataBuilderFactory = new DataBuilderFactory($this->objectManager); - } - - /** - * @param string $className - * @param string $expectedBuilderName - * @dataProvider classNamesDataProvider - */ - public function testGetBuilderClassName($className, $expectedBuilderName) - { - $this->objectManager->expects($this->once()) - ->method('create') - ->with($expectedBuilderName) - ->willReturn(new \StdClass); - - $this->assertInstanceOf('StdClass', $this->dataBuilderFactory->getDataBuilder($className)); - } - - /** - * @return array - */ - public function classNamesDataProvider() - { - return [ - ['\\TypeInterface', 'TypeDataBuilder'], - ['\\Type', 'TypeBuilder'] - ]; - } -} diff --git a/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php b/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php index 5d05e5ffbe9c388015ef853c1ccee955b30eae87..b9e9b8a27aa94186ac3a9bb24522d571ecfa3ace 100644 --- a/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php +++ b/lib/internal/Magento/Framework/Session/SaveHandler/DbTable.php @@ -31,7 +31,7 @@ class DbTable extends \SessionHandler */ public function __construct(\Magento\Framework\App\Resource $resource) { - $this->_sessionTable = $resource->getTableName('core_session'); + $this->_sessionTable = $resource->getTableName('session'); $this->_write = $resource->getConnection('core_write'); $this->checkConnection(); } diff --git a/lib/internal/Magento/Framework/Simplexml/Config.php b/lib/internal/Magento/Framework/Simplexml/Config.php index f94ec099c6fc5124217d1fbd52b3a3fae5b95d1c..4e1265ebd4a4c180d7bbc4a8b84b0334b5b1676a 100644 --- a/lib/internal/Magento/Framework/Simplexml/Config.php +++ b/lib/internal/Magento/Framework/Simplexml/Config.php @@ -489,10 +489,9 @@ class Config * @param \DOMNode $dom * @return bool */ - public function loadDom($dom) + public function loadDom(\DOMNode $dom) { $xml = simplexml_import_dom($dom, $this->_elementClass); - if ($xml) { $this->_xml = $xml; return true; diff --git a/lib/internal/Magento/Framework/Simplexml/Test/Unit/ConfigTest.php b/lib/internal/Magento/Framework/Simplexml/Test/Unit/ConfigTest.php index f0842c5a78b122980e895ff077f1a57da621c9b8..1b690780cccd7fdaad65bb33d818aca0113d7662 100644 --- a/lib/internal/Magento/Framework/Simplexml/Test/Unit/ConfigTest.php +++ b/lib/internal/Magento/Framework/Simplexml/Test/Unit/ConfigTest.php @@ -42,17 +42,13 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->config->loadString('')); $this->assertTrue($this->config->loadString($xml)); $this->assertXmlStringEqualsXmlString($xml, $this->config->getXmlString()); - $this->setExpectedException( - '\Exception', - 'simplexml_load_string(): Entity: line 1: parser error : Start tag expected,' - ); - $this->assertFalse($this->config->loadString('wrong_path')); } public function testLoadDom() { - $this->config->loadString('<?xml version="1.0"?><config><node>1</node></config>'); - $this->assertTrue($this->config->loadDom($this->config->getNode())); + $dom = new \DOMDocument(); + $dom->loadXML('<?xml version="1.0"?><config><node>1</node></config>'); + $this->assertTrue($this->config->loadDom($dom)); } public function testGetNode() diff --git a/lib/internal/Magento/Framework/Test/Unit/Translate/Js/ConfigTest.php b/lib/internal/Magento/Framework/Test/Unit/Translate/Js/ConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b2dcba665cde41cda8ff2f05642d8c0761d8ca1c --- /dev/null +++ b/lib/internal/Magento/Framework/Test/Unit/Translate/Js/ConfigTest.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Test\Unit\Translate\Js; + +use Magento\Framework\Translate\Js\Config; + +/** + * Class ConfigTest + */ +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @return void + */ + public function testDefault() + { + $config = new Config(); + $this->assertFalse($config->dictionaryEnabled()); + $this->assertNull($config->getDictionaryFileName()); + } + + /** + * @return void + */ + public function testCustom() + { + $path = 'path'; + $config = new Config(true, $path); + $this->assertTrue($config->dictionaryEnabled()); + $this->assertEquals($path, $config->getDictionaryFileName()); + } +} diff --git a/lib/internal/Magento/Framework/Test/Unit/View/Asset/SourceTest.php b/lib/internal/Magento/Framework/Test/Unit/View/Asset/SourceTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b1d22dca5d9a9692a2c8fed68235edee03e965f7 --- /dev/null +++ b/lib/internal/Magento/Framework/Test/Unit/View/Asset/SourceTest.php @@ -0,0 +1,285 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +// @codingStandardsIgnoreFile + +namespace Magento\Framework\Test\Unit\View\Asset; + +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\Filesystem\DriverPool; +use Magento\Framework\View\Asset\Source; + +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class SourceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject + */ + private $filesystem; + + /** + * @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $rootDirRead; + + /** + * @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $varDir; + + /** + * @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $staticDirRead; + + /** + * @var \Magento\Framework\View\Asset\PreProcessor\Cache|\PHPUnit_Framework_MockObject_MockObject + */ + private $cache; + + /** + * @var \Magento\Framework\View\Asset\PreProcessor\Pool|\PHPUnit_Framework_MockObject_MockObject + */ + private $preProcessorPool; + + /** + * @var \Magento\Framework\View\Design\FileResolution\Fallback\StaticFile|\PHPUnit_Framework_MockObject_MockObject + */ + private $viewFileResolution; + + /** + * @var \Magento\Framework\View\Design\ThemeInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $theme; + + /** + * @var Source + */ + private $object; + + protected function setUp() + { + $this->cache = $this->getMock( + 'Magento\Framework\View\Asset\PreProcessor\Cache', [], [], '', false + ); + $this->preProcessorPool = $this->getMock( + 'Magento\Framework\View\Asset\PreProcessor\Pool', [], [], '', false + ); + $this->viewFileResolution = $this->getMock( + 'Magento\Framework\View\Design\FileResolution\Fallback\StaticFile', [], [], '', false + ); + $this->theme = $this->getMockForAbstractClass('Magento\Framework\View\Design\ThemeInterface'); + + $themeList = $this->getMockForAbstractClass('Magento\Framework\View\Design\Theme\ListInterface'); + $themeList->expects($this->any()) + ->method('getThemeByFullPath') + ->with('frontend/magento_theme') + ->will($this->returnValue($this->theme)); + + $this->initFilesystem(); + + $this->object = new Source( + $this->cache, + $this->filesystem, + $this->preProcessorPool, + $this->viewFileResolution, + $themeList + ); + } + + public function testGetFileCached() + { + $root = '/root/some/file.ext'; + $expected = '/var/some/file.ext'; + $filePath = 'some/file.ext'; + $this->viewFileResolution->expects($this->once()) + ->method('getFile') + ->with('frontend', $this->theme, 'en_US', $filePath, 'Magento_Module') + ->will($this->returnValue($root)); + $this->rootDirRead->expects($this->once()) + ->method('getRelativePath') + ->with($root) + ->will($this->returnValue($filePath)); + $this->cache->expects($this->once()) + ->method('load') + ->with("some/file.ext:{$filePath}") + ->will($this->returnValue(serialize([DirectoryList::VAR_DIR, $filePath]))); + + $this->varDir->expects($this->once())->method('getAbsolutePath') + ->with($filePath) + ->will($this->returnValue($expected)); + $this->assertSame($expected, $this->object->getFile($this->getAsset())); + } + + /** + * @param string $origFile + * @param string $origPath + * @param string $origContentType + * @param string $origContent + * @param string $isMaterialization + * @dataProvider getFileDataProvider + */ + public function testGetFile($origFile, $origPath, $origContent, $isMaterialization) + { + $filePath = 'some/file.ext'; + $cacheValue = "{$origPath}:{$filePath}"; + $this->viewFileResolution->expects($this->once()) + ->method('getFile') + ->with('frontend', $this->theme, 'en_US', $filePath, 'Magento_Module') + ->will($this->returnValue($origFile)); + $this->rootDirRead->expects($this->once()) + ->method('getRelativePath') + ->with($origFile) + ->will($this->returnValue($origPath)); + $this->cache->expects($this->once()) + ->method('load') + ->will($this->returnValue(false)); + $this->rootDirRead->expects($this->once()) + ->method('readFile') + ->with($origPath) + ->will($this->returnValue($origContent)); + $this->preProcessorPool->expects($this->once()) + ->method('process') + ->will($this->returnCallback([$this, 'chainTestCallback'])); + if ($isMaterialization) { + $this->varDir->expects($this->once()) + ->method('writeFile') + ->with('view_preprocessed/source/some/file.ext', 'processed'); + $this->cache->expects($this->once()) + ->method('save') + ->with( + serialize([DirectoryList::VAR_DIR, 'view_preprocessed/source/some/file.ext']), + $cacheValue + ); + $this->varDir->expects($this->once()) + ->method('getAbsolutePath') + ->with('view_preprocessed/source/some/file.ext')->will($this->returnValue('result')); + } else { + $this->varDir->expects($this->never())->method('writeFile'); + $this->cache->expects($this->once()) + ->method('save') + ->with(serialize([DirectoryList::ROOT, 'source/some/file.ext']), $cacheValue); + $this->rootDirRead->expects($this->once()) + ->method('getAbsolutePath') + ->with('source/some/file.ext') + ->will($this->returnValue('result')); + } + $this->assertSame('result', $this->object->getFile($this->getAsset())); + } + + /** + * @param string $path + * @param string $expected + * @dataProvider getContentTypeDataProvider + */ + public function testGetContentType($path, $expected) + { + $this->assertEquals($expected, $this->object->getContentType($path)); + } + + /** + * @return array + */ + public function getContentTypeDataProvider() + { + return [ + ['', ''], + ['path/file', ''], + ['path/file.ext', 'ext'], + ]; + } + + /** + * A callback for affecting preprocessor chain in the test + * + * @param \Magento\Framework\View\Asset\PreProcessor\Chain $chain + */ + public function chainTestCallback(\Magento\Framework\View\Asset\PreProcessor\Chain $chain) + { + $chain->setContentType('ext'); + $chain->setContent('processed'); + } + + /** + * @return array + */ + public function getFileDataProvider() + { + return [ + ['/root/some/file.ext', 'source/some/file.ext', 'processed', false], + ['/root/some/file.ext', 'source/some/file.ext', 'not_processed', true], + ['/root/some/file.ext2', 'source/some/file.ext2', 'processed', true], + ['/root/some/file.ext2', 'source/some/file.ext2', 'not_processed', true], + ]; + } + + protected function initFilesystem() + { + $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false); + $this->rootDirRead = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\ReadInterface'); + $this->staticDirRead = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\ReadInterface'); + $this->varDir = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface'); + + $readDirMap = [ + [DirectoryList::ROOT, DriverPool::FILE, $this->rootDirRead], + [DirectoryList::STATIC_VIEW, DriverPool::FILE, $this->staticDirRead], + [DirectoryList::VAR_DIR, DriverPool::FILE, $this->varDir], + ]; + + $this->filesystem->expects($this->any()) + ->method('getDirectoryRead') + ->will($this->returnValueMap($readDirMap)); + $this->filesystem->expects($this->any()) + ->method('getDirectoryWrite') + ->with(DirectoryList::VAR_DIR) + ->will($this->returnValue($this->varDir)); + } + + /** + * Create an asset mock + * + * @param bool $isFallback + * @return \Magento\Framework\View\Asset\File|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getAsset($isFallback = true) + { + if ($isFallback) { + $context = new \Magento\Framework\View\Asset\File\FallbackContext( + 'http://example.com/static/', + 'frontend', + 'magento_theme', + 'en_US' + ); + } else { + $context = new \Magento\Framework\View\Asset\File\Context( + 'http://example.com/static/', + DirectoryList::STATIC_VIEW, + '' + ); + } + + $asset = $this->getMock('Magento\Framework\View\Asset\File', [], [], '', false); + $asset->expects($this->any()) + ->method('getContext') + ->will($this->returnValue($context)); + $asset->expects($this->any()) + ->method('getFilePath') + ->will($this->returnValue('some/file.ext')); + $asset->expects($this->any()) + ->method('getPath') + ->will($this->returnValue('some/file.ext')); + $asset->expects($this->any()) + ->method('getModule') + ->will($this->returnValue('Magento_Module')); + $asset->expects($this->any()) + ->method('getContentType') + ->will($this->returnValue('ext')); + + return $asset; + } +} diff --git a/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Helper/ObjectManagerTest.php b/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Helper/ObjectManagerTest.php index 58515be62b53e0db573554ee009d1b912819dcd4..d4e50811d7d92598df1588fa0af35359b2879a35 100644 --- a/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Helper/ObjectManagerTest.php +++ b/lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Helper/ObjectManagerTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\TestFramework\Test\Unit\Unit\Helper; class ObjectManagerTest extends \PHPUnit_Framework_TestCase @@ -76,7 +79,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase $this->assertAttributeInstanceOf($propertyType, '_' . $propertyName, $model); } - /** @var $resourceMock \Magento\Core\Model\Resource\Resource */ + /** @var $resourceMock \Magento\Framework\Module\Resource */ $resourceMock = $this->getMock( 'Magento\Framework\Module\Resource', ['_getReadAdapter', 'getIdFieldName', '__sleep', '__wakeup'], diff --git a/lib/internal/Magento/Framework/Translate/Js/Config.php b/lib/internal/Magento/Framework/Translate/Js/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..17ec1bbba4af1057cf68070bbf0a0640c064641f --- /dev/null +++ b/lib/internal/Magento/Framework/Translate/Js/Config.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Translate\Js; + +/** + * Js Translation config + */ +class Config +{ + /** + * Should the framework generate dictionary file + * + * @var bool + */ + protected $dictionaryEnabled; + + /** + * Name of dictionary json file + * + * @var string + */ + protected $dictionaryFileName; + + /** + * @param bool $dictionaryEnabled + * @param string $dictionaryFileName + */ + public function __construct($dictionaryEnabled = false, $dictionaryFileName = null) + { + $this->dictionaryEnabled = $dictionaryEnabled; + $this->dictionaryFileName = $dictionaryFileName; + } + + /** + * Should the framework generate dictionary file + * + * @return bool + */ + public function dictionaryEnabled() + { + return $this->dictionaryEnabled; + } + + /** + * Name of dictionary json file + * + * @return string + */ + public function getDictionaryFileName() + { + return $this->dictionaryFileName; + } +} diff --git a/lib/internal/Magento/Framework/View/Asset/Repository.php b/lib/internal/Magento/Framework/View/Asset/Repository.php index 4e46b91fba0d65cbbdcafd456b9b6efcb75b4433..fda21b7564074f7412b7430e9927ddef9a64e1bf 100644 --- a/lib/internal/Magento/Framework/View/Asset/Repository.php +++ b/lib/internal/Magento/Framework/View/Asset/Repository.php @@ -152,7 +152,7 @@ class Repository $module = $params['module']; } $isSecure = isset($params['_secure']) ? (bool) $params['_secure'] : null; - $themePath = $this->design->getThemePath($params['themeModel']); + $themePath = isset($params['theme']) ? $params['theme'] : $this->design->getThemePath($params['themeModel']); $context = $this->getFallbackContext( UrlInterface::URL_TYPE_STATIC, $isSecure, diff --git a/lib/internal/Magento/Framework/View/Asset/Source.php b/lib/internal/Magento/Framework/View/Asset/Source.php index 747ab55ab07c3d4952587065da0fa6f47841d33a..2518c6973eaf06b14584ed0d435a0dea5ade18b9 100644 --- a/lib/internal/Magento/Framework/View/Asset/Source.php +++ b/lib/internal/Magento/Framework/View/Asset/Source.php @@ -129,9 +129,6 @@ class Source private function preProcess(LocalInterface $asset) { $sourceFile = $this->findSourceFile($asset); - if (!$sourceFile) { - return false; - } $dirCode = DirectoryList::ROOT; $path = $this->rootDir->getRelativePath($sourceFile); $cacheId = $path . ':' . $asset->getPath(); @@ -141,7 +138,7 @@ class Source } $chain = new \Magento\Framework\View\Asset\PreProcessor\Chain( $asset, - $this->rootDir->readFile($path), + $path ? $this->rootDir->readFile($path) : "", $this->getContentType($path), $path, $this->appMode diff --git a/lib/internal/Magento/Framework/View/Layout/PageType/Config/SchemaLocator.php b/lib/internal/Magento/Framework/View/Layout/PageType/Config/SchemaLocator.php index 8c3987f63f9e7799f85d23191381bb8fdcfe702a..6d65479e651389b58d854843afe3a687bee0ca3a 100644 --- a/lib/internal/Magento/Framework/View/Layout/PageType/Config/SchemaLocator.php +++ b/lib/internal/Magento/Framework/View/Layout/PageType/Config/SchemaLocator.php @@ -18,12 +18,10 @@ class SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface /** * Constructor - * - * @param \Magento\Framework\Module\Dir\Reader $moduleReader */ - public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader) + public function __construct() { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Core') . '/page_types.xsd'; + $this->_schema = realpath(__DIR__ . '/../../etc/page_types.xsd'); } /** diff --git a/lib/internal/Magento/Framework/View/Layout/Proxy.php b/lib/internal/Magento/Framework/View/Layout/Proxy.php index 697b16a908ee9d9e27ee9937eee4274ec1db7641..8c399f4e4161a7f847b4f22db49e7e97e8528ef2 100644 --- a/lib/internal/Magento/Framework/View/Layout/Proxy.php +++ b/lib/internal/Magento/Framework/View/Layout/Proxy.php @@ -847,7 +847,7 @@ class Proxy extends \Magento\Framework\View\Layout * @param \DOMNode $dom * @return bool */ - public function loadDom($dom) + public function loadDom(\DOMNode $dom) { return $this->getSubject()->loadDom($dom); } diff --git a/app/code/Magento/Core/etc/page_types.xsd b/lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd similarity index 100% rename from app/code/Magento/Core/etc/page_types.xsd rename to lib/internal/Magento/Framework/View/Layout/etc/page_types.xsd diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php index 7c14c7b32ccd265093688328a4959bb8413a90a5..026fbf85e677e1977a0ce9e51b23664c9f848b21 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/SourceTest.php @@ -92,24 +92,6 @@ class SourceTest extends \PHPUnit_Framework_TestCase ); } - public function testGetFileNoOriginalFile() - { - $this->viewFileResolution->expects($this->once()) - ->method('getFile') - ->with('frontend', $this->theme, 'en_US', 'some/file.ext', 'Magento_Module') - ->will($this->returnValue(false)); - $this->assertFalse($this->object->getFile($this->getAsset())); - } - - public function testGetFileNoOriginalFileBasic() - { - $this->staticDirRead->expects($this->once()) - ->method('getAbsolutePath') - ->with('some/file.ext') - ->will($this->returnValue(false)); - $this->assertFalse($this->object->getFile($this->getAsset(false))); - } - public function testGetFileCached() { $root = '/root/some/file.ext'; diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php index c2f66aa9a9c430073d48f6c5c477e205f5953400..a4121826604aa11e55f5697190f0847aa5f6a0a9 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Design/Fallback/RulePoolTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\View\Test\Unit\Design\Fallback; use \Magento\Framework\View\Design\Fallback\RulePool; @@ -229,12 +232,12 @@ class RulePoolTest extends \PHPUnit_Framework_TestCase ], 'template, non-modular-magento-core' => [ \Magento\Framework\View\Design\Fallback\RulePool::TYPE_TEMPLATE_FILE, - ['namespace' => 'Magento', 'module' => 'Core'], + ['namespace' => 'Magento', 'module' => 'Theme'], [ - DirectoryList::THEMES . '/area/current_theme_path/Magento_Core/templates', - DirectoryList::THEMES . '/area/parent_theme_path/Magento_Core/templates', - DirectoryList::MODULES . '/Magento/Core/view/area/templates', - DirectoryList::MODULES . '/Magento/Core/view/base/templates', + DirectoryList::THEMES . '/area/current_theme_path/Magento_Theme/templates', + DirectoryList::THEMES . '/area/parent_theme_path/Magento_Theme/templates', + DirectoryList::MODULES . '/Magento/Theme/view/area/templates', + DirectoryList::MODULES . '/Magento/Theme/view/base/templates', ], ], diff --git a/app/code/Magento/Core/Test/Unit/Model/DesignLoaderTest.php b/lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php similarity index 95% rename from app/code/Magento/Core/Test/Unit/Model/DesignLoaderTest.php rename to lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php index 4d4a994c2e5d5b654bdab87b15fcf97c159c211a..b3d0f530171683d28eaaf37f2bc032a7cee50a70 100644 --- a/app/code/Magento/Core/Test/Unit/Model/DesignLoaderTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php @@ -3,7 +3,10 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Unit\Model; + +// @codingStandardsIgnoreFile + +namespace Magento\Framework\View\Test\Unit; class DesignLoaderTest extends \PHPUnit_Framework_TestCase { diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php index eed898b3cd0c4d601da624dc725e799b983ff3d3..f187f63c647f09cdcf36f6075368da90248905f3 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php @@ -3,6 +3,9 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\View\Test\Unit\Element; class AbstractBlockTest extends \PHPUnit_Framework_TestCase @@ -64,7 +67,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase )->method( 'getVarValue' )->with( - 'Magento_Core', + 'Magento_Theme', 'v1' )->will( $this->returnValue('one') @@ -80,7 +83,7 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase $block = $this->getMockForAbstractClass( 'Magento\Framework\View\Element\AbstractBlock', $helper->getConstructArguments('Magento\Framework\View\Element\AbstractBlock', $params), - uniqid('Magento\\Core\\Block\\AbstractBlock\\') + uniqid('Magento\\Theme\\Block\\AbstractBlock\\') ); $this->assertEquals('one', $block->getVar('v1')); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php index 6b2719e088bf574f033352963bfc63cc363e1674..0e5c9ec84d8957895337051890d256bccda9431b 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/BlockTest.php @@ -38,26 +38,28 @@ class BlockTest extends \PHPUnit_Framework_TestCase /** * @param string $xml + * @param string $elementType * @return \Magento\Framework\View\Layout\Element */ - protected function getElement($xml) + protected function getElement($xml, $elementType) { $xml = '<' . \Magento\Framework\View\Layout\Reader\Block::TYPE_BLOCK . '>' . $xml . '</' . \Magento\Framework\View\Layout\Reader\Block::TYPE_BLOCK . '>'; $xml = simplexml_load_string($xml, 'Magento\Framework\View\Layout\Element'); - return current($xml->children()); + return $xml->{$elementType}; } /** * Prepare reader pool * * @param string $xml + * @param string $elementType */ - protected function prepareReaderPool($xml) + protected function prepareReaderPool($xml, $elementType) { - $this->currentElement = $this->getElement($xml); + $this->currentElement = $this->getElement($xml, $elementType); $this->readerPool->expects($this->once())->method('interpret')->with($this->context, $this->currentElement); } @@ -116,7 +118,11 @@ class BlockTest extends \PHPUnit_Framework_TestCase $this->scheduledStructure->expects($getCondition) ->method('getStructureElementData') ->with($literal, []) - ->willReturn([]); + ->willReturn([ + 'actions' => [ + ['someMethod', [], 'action_config_path', 'scope'], + ], + ]); $this->scheduledStructure->expects($setCondition) ->method('setStructureElementData') ->with( @@ -140,8 +146,9 @@ class BlockTest extends \PHPUnit_Framework_TestCase $this->prepareReaderPool( '<' . $literal . ' ifconfig="' . $ifconfigValue . '">' - . '<action method="someMethod" ifconfig="action_config_path" />' - . '</' . $literal . '>' + . '<action method="someMethod" ifconfig="action_config_path" />' + . '</' . $literal . '>', + $literal ); /** @var \Magento\Framework\View\Layout\Reader\Block $block */ @@ -184,7 +191,11 @@ class BlockTest extends \PHPUnit_Framework_TestCase $this->scheduledStructure->expects($getCondition) ->method('getStructureElementData') ->with($literal, []) - ->willReturn([]); + ->willReturn([ + 'actions' => [ + ['someMethod', [], 'action_config_path', 'scope'], + ], + ]); $this->scheduledStructure->expects($setCondition) ->method('setStructureElementData') ->with( @@ -199,8 +210,9 @@ class BlockTest extends \PHPUnit_Framework_TestCase $this->prepareReaderPool( '<' . $literal . ' name="' . $literal . '">' - . '<action method="someMethod" ifconfig="action_config_path" />' - . '</' . $literal . '>' + . '<action method="someMethod" ifconfig="action_config_path" />' + . '</' . $literal . '>', + $literal ); /** @var \Magento\Framework\View\Layout\Reader\Block $block */ diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php index e79b16a2ca6a6b9627e59b72f78a4ae9285e22fd..2f90f4c1b1f23cd62412465d34ac9073e953a2c3 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/ContainerTest.php @@ -103,7 +103,10 @@ class ContainerTest extends \PHPUnit_Framework_TestCase { return [ 'container' => [ - 'elementCurrent' => $this->getElement('<container name="container" id="id_add" tag="body"/>'), + 'elementCurrent' => $this->getElement( + '<container name="container" id="id_add" tag="body"/>', + 'container' + ), 'containerName' => 'container', 'structureElement' => [ 'attributes' => [ @@ -122,7 +125,8 @@ class ContainerTest extends \PHPUnit_Framework_TestCase ], 'referenceContainer' => [ 'elementCurrent' => $this->getElement( - '<referenceContainer name="reference" htmlTag="span" htmlId="id_add" htmlClass="new" label="Add"/>' + '<referenceContainer name="reference" htmlTag="span" htmlId="id_add" htmlClass="new" label="Add"/>', + 'referenceContainer' ), 'containerName' => 'reference', 'structureElement' => [], @@ -140,14 +144,15 @@ class ContainerTest extends \PHPUnit_Framework_TestCase /** * @param string $xml + * @param string $elementType * @return \Magento\Framework\View\Layout\Element */ - protected function getElement($xml) + protected function getElement($xml, $elementType) { $xml = simplexml_load_string( '<parent_element>' . $xml . '</parent_element>', 'Magento\Framework\View\Layout\Element' ); - return current($xml->children()); + return $xml->{$elementType}; } } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/UiComponentTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/UiComponentTest.php index 67ed4e08e4cbf9341795dfd6d2dec22bfe62c268..145c8f6992e9167ec631c92fdb132f38386afac4 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/UiComponentTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/Reader/UiComponentTest.php @@ -70,7 +70,9 @@ class UiComponentTest extends \PHPUnit_Framework_TestCase ['attributes' => ['group' => '', 'component' => 'listing']] ); $scheduleStructure->expects($this->once())->method('setElementToIfconfigList')->with( - $element->getAttribute('name'), 'config_path', 'scope' + $element->getAttribute('name'), + 'config_path', + 'scope' ); $this->model->interpret($this->context, $element); } @@ -80,7 +82,8 @@ class UiComponentTest extends \PHPUnit_Framework_TestCase return [ [ $this->getElement( - '<ui_component name="cms_block_listing" component="listing" ifconfig="config_path"/>' + '<ui_component name="cms_block_listing" component="listing" ifconfig="config_path"/>', + 'ui_component' ), ] ]; @@ -88,14 +91,15 @@ class UiComponentTest extends \PHPUnit_Framework_TestCase /** * @param string $xml + * @param string $elementType * @return \Magento\Framework\View\Layout\Element */ - protected function getElement($xml) + protected function getElement($xml, $elementType) { $xml = simplexml_load_string( '<parent_element>' . $xml . '</parent_element>', 'Magento\Framework\View\Layout\Element' ); - return current($xml->children()); + return $xml->{$elementType}; } } diff --git a/app/code/Magento/Core/Test/Unit/Model/Layout/XsdTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/XsdTest.php similarity index 94% rename from app/code/Magento/Core/Test/Unit/Model/Layout/XsdTest.php rename to lib/internal/Magento/Framework/View/Test/Unit/Layout/XsdTest.php index 3bdf7c6f6df1910495275801159607c1c5e21712..dae07e2a6ac190804687ad60dee637df0c2d5acd 100644 --- a/app/code/Magento/Core/Test/Unit/Model/Layout/XsdTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/XsdTest.php @@ -3,7 +3,10 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Core\Test\Unit\Model\Layout; + +// @codingStandardsIgnoreFile + +namespace Magento\Framework\View\Test\Unit\Layout; class XsdTest extends \PHPUnit_Framework_TestCase { diff --git a/app/code/Magento/Core/Test/Unit/Model/Layout/_files/action.xml b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/action.xml similarity index 100% rename from app/code/Magento/Core/Test/Unit/Model/Layout/_files/action.xml rename to lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/action.xml diff --git a/app/code/Magento/Core/Test/Unit/Model/Layout/_files/arguments.xml b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/arguments.xml similarity index 89% rename from app/code/Magento/Core/Test/Unit/Model/Layout/_files/arguments.xml rename to lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/arguments.xml index 7feb1abb6619b22afcd693820d9e160fff3b2310..cfda9d37a3fea1de5065684614d078e9ca51415a 100644 --- a/app/code/Magento/Core/Test/Unit/Model/Layout/_files/arguments.xml +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/arguments.xml @@ -9,11 +9,11 @@ <body> <block class="Magento\Test\Block" name="test.block"> <arguments> - <argument name="testHelperWithParams" xsi:type="helper" helper="Magento\Core\Model\Layout\Argument\Handler\TestHelper::testMethod"> + <argument name="testHelperWithParams" xsi:type="helper" helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod"> <param name="firstParam">firstValue</param> <param name="secondParam">secondValue</param> </argument> - <argument name="testHelperWithoutParams" xsi:type="helper" helper="Magento\Core\Model\Layout\Argument\Handler\TestHelper::testMethod"/> + <argument name="testHelperWithoutParams" xsi:type="helper" helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod"/> <argument name="testSimpleBoolean" xsi:type="boolean">true</argument> <argument name="testSimpleNumber" xsi:type="number">1.5</argument> <argument name="testSimpleString" xsi:type="string">Simple Test</argument> @@ -39,11 +39,11 @@ <item name="url" xsi:type="string">*/sales_archive/massAdd</item> </item> </argument> - <argument name="testOptions" xsi:type="options" model="Magento\Core\Model\Layout\Argument\Handler\TestOptions"/> + <argument name="testOptions" xsi:type="options" model="Magento\Framework\View\Layout\Argument\Handler\TestOptions"/> <argument name="testSimpleObject" xsi:type="object"> Magento\Framework\View\Layout\Argument\Handler\TestObject </argument> - <argument name="testComplexObject" xsi:type="object"><updater>Magento_Test_Updater</updater>Magento\Core\Model\Layout\Argument\Handler\TestObject</argument> + <argument name="testComplexObject" xsi:type="object"><updater>Magento_Test_Updater</updater>Magento\Framework\View\Layout\Argument\Handler\TestObject</argument> </arguments> <action method="testAction"> <argument name="string" xsi:type="string">string</argument> diff --git a/app/code/Magento/Core/Test/Unit/Model/Layout/_files/invalidLayoutArgumentsXmlArray.php b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/invalidLayoutArgumentsXmlArray.php similarity index 94% rename from app/code/Magento/Core/Test/Unit/Model/Layout/_files/invalidLayoutArgumentsXmlArray.php rename to lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/invalidLayoutArgumentsXmlArray.php index 14cd1a31346ccf3830699c0368e2c79ae6a62f35..0bb28856ca1479a34f6033a6edcf5778cf333ee3 100644 --- a/app/code/Magento/Core/Test/Unit/Model/Layout/_files/invalidLayoutArgumentsXmlArray.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Layout/_files/invalidLayoutArgumentsXmlArray.php @@ -82,7 +82,7 @@ return [ <block class="Magento\Test\Block" name="test.block"> <arguments> <argument name="argumentName" xsi:type="helper" - helper="Magento\Core\Model\Layout\Argument\Handler\TestHelper::testMethod"> + helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod"> <param /> </argument> </arguments> @@ -96,7 +96,7 @@ return [ <block class="Magento\Test\Block" name="test.block"> <arguments> <argument name="argumentName" xsi:type="helper" - helper="Magento\Core\Model\Layout\Argument\Handler\TestHelper::testMethod"> + helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod"> <param name="paramName" forbidden="forbidden"/> </argument> </arguments> @@ -110,7 +110,7 @@ return [ <block class="Magento\Test\Block" name="test.block"> <arguments> <argument name="argumentName" xsi:type="helper" - helper="Magento\Core\Model\Layout\Argument\Handler\TestHelper::testMethod"> + helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod"> <param name="paramName"><forbidden /></param> </argument> </arguments> diff --git a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php index efbe7b23a727f76496a3565330a3288e8852a447..ab17c14b9b3bad2f86e6a312ccf9aa7ba36be98f 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/TemplateEngine/PhpTest.php @@ -56,7 +56,6 @@ class PhpTest extends \PHPUnit_Framework_TestCase * * Expect an exception if the specified file does not exist. * @expectedException \Exception - * @expectedExceptionMessage include(This_is_not_a_file): failed to open stream: No such file or directory */ public function testRenderException() { diff --git a/lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php b/lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..dac64d2acfcf9379169980a836e95d15ef6e034f --- /dev/null +++ b/lib/internal/Magento/Framework/Webapi/CustomAttributeTypeLocatorInterface.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Webapi; + +/** + * Interface to locate types for custom attributes + */ +interface CustomAttributeTypeLocatorInterface +{ + /** + * Get Data Interface type for a given custom attribute code + * + * @param string $attributeCode + * @param string $serviceClass + * @return string|null + */ + public function getType($attributeCode, $serviceClass); +} diff --git a/lib/internal/Magento/Framework/Webapi/Request.php b/lib/internal/Magento/Framework/Webapi/Request.php index e40112ce2d6466e70b881460ec6b6a1c867172ab..fdd688a313e51a83d6cd1bf3ec3d78bc5b61e22e 100644 --- a/lib/internal/Magento/Framework/Webapi/Request.php +++ b/lib/internal/Magento/Framework/Webapi/Request.php @@ -39,4 +39,22 @@ class Request extends HttpRequest implements RequestInterface $pathInfo = preg_replace('#\?.*#', '', $pathInfo); $this->setPathInfo($pathInfo); } + + /** + * {@inheritdoc} + * + * Added CGI environment support. + */ + public function getHeader($header, $default = false) + { + $headerValue = parent::getHeader($header, $default); + if ($headerValue == false) { + /** Workaround for hhvm environment */ + $header = 'REDIRECT_HTTP_' . strtoupper(str_replace('-', '_', $header)); + if (isset($_SERVER[$header])) { + $headerValue = $_SERVER[$header]; + } + } + return $headerValue; + } } diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php b/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php index ba0091bc725a7e94f6073f2ea2fb21bbac36ca6d..34f3936ce563c3b399eb280640bb532025ba507b 100644 --- a/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php +++ b/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php @@ -52,10 +52,10 @@ class Json implements \Magento\Framework\Webapi\Rest\Request\DeserializerInterfa throw new \Magento\Framework\Webapi\Exception(new Phrase('Decoding error.')); } else { throw new \Magento\Framework\Webapi\Exception( - new Phrase( + (string)(new Phrase( 'Decoding error: %1%2%3%4', [PHP_EOL, $e->getMessage(), PHP_EOL, $e->getTraceAsString()] - ) + )) ); } } diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index 59bebdb9439fe8e217a42d22e79bd4ac9f15b4f2..2298ea27fdfc6c08ef9d69e37981b2fc3d9d7cc1 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -7,7 +7,7 @@ */ namespace Magento\Framework\Webapi; -use Magento\Framework\Api\AttributeDataBuilder; +use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Api\AttributeValue; use Magento\Framework\Api\Config\Reader as ServiceConfigReader; use Magento\Framework\Api\SimpleDataObjectConverter; @@ -15,7 +15,7 @@ use Magento\Framework\App\Cache\Type\Webapi as WebapiCache; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\SerializationException; use Magento\Framework\Reflection\TypeProcessor; -use Magento\Framework\Serialization\DataBuilderFactory; +use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Webapi\Exception as WebapiException; use Zend\Code\Reflection\ClassReflection; use Zend\Code\Reflection\MethodReflection; @@ -30,42 +30,44 @@ class ServiceInputProcessor { const CACHE_ID_PREFIX = 'service_method_params_'; + const EXTENSION_ATTRIBUTES_TYPE = '\Magento\Framework\Api\ExtensionAttributesInterface'; + /** @var \Magento\Framework\Reflection\TypeProcessor */ protected $typeProcessor; - /** @var DataBuilderFactory */ - protected $builderFactory; - - /** @var ServiceConfigReader */ - protected $serviceConfigReader; + /** @var ObjectManagerInterface */ + protected $objectManager; - /** @var AttributeDataBuilder */ - protected $attributeValueBuilder; + /** @var AttributeValueFactory */ + protected $attributeValueFactory; /** @var WebapiCache */ protected $cache; + /** @var CustomAttributeTypeLocatorInterface */ + protected $customAttributeTypeLocator; + /** * Initialize dependencies. * * @param TypeProcessor $typeProcessor - * @param DataBuilderFactory $builderFactory - * @param ServiceConfigReader $serviceConfigReader - * @param AttributeDataBuilder $attributeValueBuilder + * @param ObjectManagerInterface $objectManager + * @param AttributeValueFactory $attributeValueFactory * @param WebapiCache $cache + * @param CustomAttributeTypeLocatorInterface $customAttributeTypeLocator */ public function __construct( TypeProcessor $typeProcessor, - DataBuilderFactory $builderFactory, - ServiceConfigReader $serviceConfigReader, - AttributeDataBuilder $attributeValueBuilder, - WebapiCache $cache + ObjectManagerInterface $objectManager, + AttributeValueFactory $attributeValueFactory, + WebapiCache $cache, + CustomAttributeTypeLocatorInterface $customAttributeTypeLocator ) { $this->typeProcessor = $typeProcessor; - $this->builderFactory = $builderFactory; - $this->serviceConfigReader = $serviceConfigReader; - $this->attributeValueBuilder = $attributeValueBuilder; + $this->objectManager = $objectManager; + $this->attributeValueFactory = $attributeValueFactory; $this->cache = $cache; + $this->customAttributeTypeLocator = $customAttributeTypeLocator; } /** @@ -126,13 +128,17 @@ class ServiceInputProcessor * @param string $className * @param array $data * @return object the newly created and populated object + * @throws \Exception */ protected function _createFromArray($className, $data) { $data = is_array($data) ? $data : []; $class = new ClassReflection($className); - - $builder = $this->builderFactory->getDataBuilder($className); + if (is_subclass_of($className, self::EXTENSION_ATTRIBUTES_TYPE)) { + $className = substr($className, 0, -strlen('Interface')); + } + $factory = $this->objectManager->get($className . 'Factory'); + $object = $factory->create(); foreach ($data as $propertyName => $value) { // Converts snake_case to uppercase CamelCase to help form getter/setter method names @@ -142,35 +148,38 @@ class ServiceInputProcessor $methodReflection = $class->getMethod($methodName); if ($methodReflection->isPublic()) { $returnType = $this->typeProcessor->getGetterReturnType($methodReflection)['type']; - $setterName = 'set' . $camelCaseProperty; + try { + $setterName = $this->typeProcessor->findSetterMethodName($class, $camelCaseProperty); + } catch (\Exception $e) { + if (empty($value)) { + continue; + } else { + throw $e; + } + } if ($camelCaseProperty === 'CustomAttributes') { - $setterValue = $this->convertCustomAttributeValue($value, $returnType, $className); + $setterValue = $this->convertCustomAttributeValue($value, $className); } else { $setterValue = $this->_convertValue($value, $returnType); } - $builder->{$setterName}($setterValue); + $object->{$setterName}($setterValue); } } - return $builder->create(); + return $object; } /** * Convert custom attribute data array to array of AttributeValue Data Object * * @param array $customAttributesValueArray - * @param string $returnType * @param string $dataObjectClassName * @return AttributeValue[] */ - protected function convertCustomAttributeValue($customAttributesValueArray, $returnType, $dataObjectClassName) + protected function convertCustomAttributeValue($customAttributesValueArray, $dataObjectClassName) { $result = []; - $allAttributes = $this->serviceConfigReader->read(); $dataObjectClassName = ltrim($dataObjectClassName, '\\'); - if (!isset($allAttributes[$dataObjectClassName])) { - return $this->_convertValue($customAttributesValueArray, $returnType); - } - $dataObjectAttributes = $allAttributes[$dataObjectClassName]; + $camelCaseAttributeCodeKey = lcfirst( SimpleDataObjectConverter::snakeCaseToUpperCamelCase(AttributeValue::ATTRIBUTE_CODE) ); @@ -183,11 +192,9 @@ class ServiceInputProcessor $customAttributeCode = null; } - //Check if type is defined, else default to mixed - $type = isset($dataObjectAttributes[$customAttributeCode]) - ? $dataObjectAttributes[$customAttributeCode] - : TypeProcessor::ANY_TYPE; - + //Check if type is defined, else default to string + $type = $this->customAttributeTypeLocator->getType($customAttributeCode, $dataObjectClassName); + $type = $type ? $type : TypeProcessor::ANY_TYPE; $customAttributeValue = $customAttribute[AttributeValue::VALUE]; if (is_array($customAttributeValue)) { //If type for AttributeValue's value as array is mixed, further processing is not possible @@ -200,10 +207,9 @@ class ServiceInputProcessor $attributeValue = $this->_convertValue($customAttributeValue, $type); } //Populate the attribute value data object once the value for custom attribute is derived based on type - $result[] = $this->attributeValueBuilder + $result[$customAttributeCode] = $this->attributeValueFactory->create() ->setAttributeCode($customAttributeCode) - ->setValue($attributeValue) - ->create(); + ->setValue($attributeValue); } return $result; diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/AssociativeArray.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/AssociativeArray.php index 4c0081fd3d438f5b7f0691a9d6cde094f0973ed5..132947d5d040e1cd8a79ab0a62606e74f7972a33 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/AssociativeArray.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/AssociativeArray.php @@ -16,4 +16,13 @@ class AssociativeArray extends AbstractExtensibleObject { return $this->_get('associativeArray'); } + + /** + * @param string[] $associativeArray + * @return $this + */ + public function setAssociativeArray(array $associativeArray = []) + { + return $this->setData('associativeArray', $associativeArray); + } } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/AssociativeArrayBuilder.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/AssociativeArrayBuilder.php deleted file mode 100644 index 1b563204225ed704d84c5d2e1c97ac35d62cfd97..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/AssociativeArrayBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; - -use Magento\Framework\Api\ExtensibleObjectBuilder; - -class AssociativeArrayBuilder extends ExtensibleObjectBuilder -{ - /** - * @param string[] $associativeArray - * @return $this - */ - public function setAssociativeArray($associativeArray) - { - $this->data['associativeArray'] = $associativeArray; - return $this; - } -} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/DataArray.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/DataArray.php index b1eed520ea63adcdf99672a8ed99816dcd0bca81..d620fad15b96b4a00b22864276d4b7d022272b10 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/DataArray.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/DataArray.php @@ -16,4 +16,13 @@ class DataArray extends AbstractExtensibleObject { return $this->_get('items'); } + + /** + * @param \Magento\Webapi\Service\Entity\Simple[] $items + * @return $this + */ + public function setItems(array $items = null) + { + return $this->setData('items', $items); + } } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/DataArrayBuilder.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/DataArrayBuilder.php deleted file mode 100644 index a6f3b8720780ec36858d1373aaec7f1ce5e63479..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/DataArrayBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; - -use Magento\Framework\Api\ExtensibleObjectBuilder; - -class DataArrayBuilder extends ExtensibleObjectBuilder -{ - /** - * @param \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple[] $items - * @return $this - */ - public function setItems($items) - { - $this->data['items'] = $items; - return $this; - } -} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Nested.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Nested.php index 05f7cda59849595b876a9a02d344bf399186e985..d69482352272d1c798643ce804fb497c515967f9 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Nested.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Nested.php @@ -16,4 +16,13 @@ class Nested extends AbstractExtensibleObject { return $this->_get('details'); } + + /** + * @param \Magento\Webapi\Service\Entity\Simple $details + * @return $this + */ + public function setDetails($details) + { + return $this->setData('details', $details); + } } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/NestedBuilder.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/NestedBuilder.php deleted file mode 100644 index aec2af54d8e96b536e1975e78dd1e3f1b54ecd4b..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/NestedBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; - -use Magento\Framework\Api\ExtensibleObjectBuilder; - -class NestedBuilder extends ExtensibleObjectBuilder -{ - /** - * @param string $details - * @return $this - */ - public function setDetails($details) - { - $this->data['details'] = $details; - return $this; - } -} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/ObjectWithCustomAttributes.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/ObjectWithCustomAttributes.php index 4f4532ece362e7dea3009e9e1cea1796793eeff0..36ee49d4e9055fee51760eb96130d2bfb2985309 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/ObjectWithCustomAttributes.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/ObjectWithCustomAttributes.php @@ -9,4 +9,8 @@ use Magento\Framework\Api\AbstractExtensibleObject; class ObjectWithCustomAttributes extends AbstractExtensibleObject { + /** + * @var string[] + */ + protected $customAttributesCodes = [TestService::CUSTOM_ATTRIBUTE_CODE]; } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/ObjectWithCustomAttributesBuilder.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/ObjectWithCustomAttributesBuilder.php deleted file mode 100644 index a080a40d8ca0d0e942d4af3fb1fb5bfe49c31dbd..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/ObjectWithCustomAttributesBuilder.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; - -use Magento\Framework\Api\ExtensibleObjectBuilder; - -class ObjectWithCustomAttributesBuilder extends ExtensibleObjectBuilder -{ - /** - * @var string[] - */ - protected $customAttributesCodes = [TestService::CUSTOM_ATTRIBUTE_CODE]; -} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Simple.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Simple.php index 9cd6d0d190d22f53fb497da81b76fc07960c61bd..14537dbdfb761153367a8c9cbbde6100e3af5b09 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Simple.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/Simple.php @@ -17,6 +17,15 @@ class Simple extends AbstractExtensibleObject return $this->_get('entityId'); } + /** + * @param int $entityId + * @return $this + */ + public function setEntityId($entityId) + { + return $this->setData('entityId', $entityId); + } + /** * @return string|null */ @@ -24,4 +33,13 @@ class Simple extends AbstractExtensibleObject { return $this->_get('name'); } + + /** + * @param string $name + * @return $this + */ + public function setName($name) + { + return $this->setData('name', $name); + } } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleArray.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleArray.php index b09582c2a6d4cd20b57b14883e97911ee00365de..0fc83797db44b5f19ff36556a7e9f66368dafb22 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleArray.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleArray.php @@ -16,4 +16,13 @@ class SimpleArray extends AbstractExtensibleObject { return $this->_get('ids'); } + + /** + * @param int[] $ids + * @return $this + */ + public function setIds(array $ids = null) + { + return $this->setData('ids', $ids); + } } diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleArrayBuilder.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleArrayBuilder.php deleted file mode 100644 index f979b7481dca348de7932d13160ee29aed20b8ae..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleArrayBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; - -use Magento\Framework\Api\ExtensibleObjectBuilder; - -class SimpleArrayBuilder extends ExtensibleObjectBuilder -{ - /** - * @param array $ids - * @return $this - */ - public function setIds($ids) - { - $this->data['ids'] = $ids; - return $this; - } -} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleBuilder.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleBuilder.php deleted file mode 100644 index b10e117f8c68db0655d42a7cbb8fcf45eb310c09..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleBuilder.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; - -use Magento\Framework\Api\ExtensibleObjectBuilder; - -class SimpleBuilder extends ExtensibleObjectBuilder -{ - /** - * @param int $id - * @return $this - */ - public function setEntityId($id) - { - $this->data['entityId'] = $id; - return $this; - } - - /** - * @param string $name - * @return $this - */ - public function setName($name) - { - $this->data['name'] = $name; - return $this; - } -} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/WebapiBuilderFactory.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/WebapiBuilderFactory.php deleted file mode 100644 index 13fa96edf76143e472ccd72441cddf1423a4e8b2..0000000000000000000000000000000000000000 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/WebapiBuilderFactory.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; - -class WebapiBuilderFactory extends \Magento\Framework\Serialization\DataBuilderFactory -{ - /** - * @param \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager - */ - public function __construct(\Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManager) - { - $this->objectManager = $objectManager; - } - - /** - * Creates builder object - * - * @param $builderClassName - * @return \Magento\Framework\Api\BuilderInterface Builder Instance - */ - protected function createObject($builderClassName) - { - return $this->objectManager->getObject($builderClassName); - } -} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php index 0eb9af208ca32fde7757b5f85a4a11929e5b6a00..41cdf8184ba372143f8ed2fdde2ff790f8633fa0 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php @@ -3,13 +3,16 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ + +// @codingStandardsIgnoreFile + namespace Magento\Framework\Webapi\Test\Unit; -use \Magento\Framework\Webapi\ServiceInputProcessor; -use \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\WebapiBuilderFactory; +use Magento\Framework\Webapi\ServiceInputProcessor; +use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\WebapiBuilderFactory; use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray; use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\DataArray; -use \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\ObjectWithCustomAttributes; +use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\ObjectWithCustomAttributes; use Magento\Webapi\Test\Unit\Service\Entity\DataArrayData; use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Nested; use Magento\Webapi\Test\Unit\Service\Entity\NestedData; @@ -25,15 +28,20 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase protected $serviceInputProcessor; /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $attributeValueBuilder; + protected $attributeValueFactoryMock; /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $serviceConfigReader; + protected $customAttributeTypeLocator; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $objectManagerMock; public function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $objectFactory = new WebapiBuilderFactory($objectManager); + $this->objectManagerMock = $this->getMockBuilder('\Magento\Framework\ObjectManagerInterface') + ->disableOriginalConstructor() + ->getMock(); /** @var \Magento\Framework\Reflection\TypeProcessor $typeProcessor */ $typeProcessor = $objectManager->getObject('Magento\Framework\Reflection\TypeProcessor'); $cache = $this->getMockBuilder('Magento\Framework\App\Cache\Type\Webapi') @@ -41,21 +49,30 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase ->getMock(); $cache->expects($this->any())->method('load')->willReturn(false); - $this->serviceConfigReader = $this->getMockBuilder('Magento\Framework\Api\Config\Reader') + $this->customAttributeTypeLocator = $this->getMockBuilder('Magento\Eav\Model\EavCustomAttributeTypeLocator') ->disableOriginalConstructor() ->getMock(); /** @var \Magento\Framework\Api\AttributeDataBuilder */ - $this->attributeValueBuilder = $objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder'); + $this->attributeValueFactoryMock = $this->getMockBuilder('Magento\Framework\Api\AttributeValueFactory') + ->disableOriginalConstructor() + ->getMock(); + $this->attributeValueFactoryMock->expects($this->any()) + ->method('create') + ->willReturnCallback( + function () use ($objectManager) { + return $objectManager->getObject('Magento\Framework\Api\AttributeValue'); + } + ); $this->serviceInputProcessor = $objectManager->getObject( 'Magento\Framework\Webapi\ServiceInputProcessor', [ 'typeProcessor' => $typeProcessor, - 'builderFactory' => $objectFactory, + 'objectManager' => $this->objectManagerMock, 'cache' => $cache, - 'serviceConfigReader' => $this->serviceConfigReader, - 'attributeValueBuilder' => $this->attributeValueBuilder + 'customAttributeTypeLocator' => $this->customAttributeTypeLocator, + 'attributeValueFactory' => $this->attributeValueFactoryMock ] ); } @@ -102,6 +119,12 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedDataProperties() { + $this->setupFactory( + [ + 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Nested', + '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', + ] + ); $data = ['nested' => ['details' => ['entityId' => 15, 'name' => 'Test']]]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -144,6 +167,7 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testAssociativeArrayProperties() { + $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple']); $data = ['associativeArray' => ['key' => 'value', 'key_two' => 'value_two']]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -162,6 +186,7 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testAssociativeArrayPropertiesWithItem() { + $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']); $data = ['associativeArray' => ['item' => 'value']]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -179,6 +204,7 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testAssociativeArrayPropertiesWithItemArray() { + $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']); $data = ['associativeArray' => ['item' => ['value1','value2']]]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -197,6 +223,11 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testArrayOfDataObjectProperties() { + $this->setupFactory( + [ + '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple' + ] + ); $data = [ 'dataObjects' => [ ['entityId' => 14, 'name' => 'First'], @@ -228,6 +259,7 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedSimpleArrayProperties() { + $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleArray']); $data = ['arrayData' => ['ids' => [1, 2, 3, 4]]]; $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -249,6 +281,7 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedAssociativeArrayProperties() { + $this->setupFactory(['Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray']); $data = [ 'associativeArrayData' => ['associativeArray' => ['key' => 'value', 'key2' => 'value2']], ]; @@ -272,6 +305,12 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase public function testNestedArrayOfDataObjectProperties() { + $this->setupFactory( + [ + 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\DataArray', + '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', + ] + ); $data = [ 'dataObjects' => [ 'items' => [['entityId' => 1, 'name' => 'First'], ['entityId' => 2, 'name' => 'Second']], @@ -308,18 +347,20 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase * * @dataProvider customAttributesDataProvider * @param $customAttributeType - * @param $customAttributeValue - * @param $attributeCode + * @param $inputData + * @param $expectedObject */ public function testCustomAttributesProperties($customAttributeType, $inputData, $expectedObject) { - $this->serviceConfigReader->expects($this->any())->method('read')->willReturn( + $this->setupFactory( [ - 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\ObjectWithCustomAttributes' => [ - TestService::CUSTOM_ATTRIBUTE_CODE => $customAttributeType - ] + 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\ObjectWithCustomAttributes', + '\Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', + 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Simple', + 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleArray', ] ); + $this->customAttributeTypeLocator->expects($this->any())->method('getType')->willReturn($customAttributeType); $result = $this->serviceInputProcessor->process( 'Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService', @@ -480,4 +521,27 @@ class ServiceInputProcessorTest extends \PHPUnit_Framework_TestCase ]] ); } + protected function setupFactory(array $classNames) + { + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $returnValueMap = []; + foreach ($classNames as $className) { + $factoryMock = $this->getMockBuilder($className . 'Factory') + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $factoryMock->expects($this->any()) + ->method('create') + ->willReturnCallback( + function () use ($objectManager, $className) { + return $objectManager->getObject($className); + } + ); + $returnValueMap[] = [$className . 'Factory', $factoryMock]; + } + $this->objectManagerMock->expects($this->any()) + ->method('get') + ->will($this->returnValueMap($returnValueMap)); + } } diff --git a/lib/web/css/source/lib/_navigation.less b/lib/web/css/source/lib/_navigation.less index bc3b5b512b3df549677b19542d568d1bb832f050..3da4c94017a3f2fbab5bf17ee25cef507fce5a87 100644 --- a/lib/web/css/source/lib/_navigation.less +++ b/lib/web/css/source/lib/_navigation.less @@ -79,7 +79,7 @@ .css(border-bottom, @_nav-level0-item-border); } } - .ui-menu:not(:first-child) { + .submenu:not(:first-child) { .css(background, @_submenu-background-color); .css(border, @_submenu-border); .css(font-size, @_submenu-font-size); @@ -241,10 +241,11 @@ &.parent:hover > .submenu { overflow: visible !important; } - .ui-menu { + .submenu { .css(font-size, @_submenu-font-size); .css(font-weight, @_submenu-font-weight); .css(min-width, @_submenu-min-width); + display: none; padding: 0; margin: 0 !important; position: absolute; @@ -284,7 +285,7 @@ .css(color, @_submenu-item-color-active); .css(text-decoration, @_submenu-item-text-decoration-active); } - .ui-menu { + .submenu { top: 0 !important; left: 100% !important; } diff --git a/lib/web/jquery/jquery.validate.js b/lib/web/jquery/jquery.validate.js index 58fdf10e665f2de752181fcfc09e1cfc5ecad2c2..85d0621b02244ae568e56509e83f9ad3dde2d626 100644 --- a/lib/web/jquery/jquery.validate.js +++ b/lib/web/jquery/jquery.validate.js @@ -288,22 +288,22 @@ }, messages: { - required: "This field is required.", - remote: "Please fix this field.", - email: "Please enter a valid email address.", - url: "Please enter a valid URL.", - date: "Please enter a valid date.", - dateISO: "Please enter a valid date (ISO).", - number: "Please enter a valid number.", - digits: "Please enter only digits.", - creditcard: "Please enter a valid credit card number.", - equalTo: "Please enter the same value again.", - maxlength: $.validator.format("Please enter no more than {0} characters."), - minlength: $.validator.format("Please enter at least {0} characters."), - rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), - range: $.validator.format("Please enter a value between {0} and {1}."), - max: $.validator.format("Please enter a value less than or equal to {0}."), - min: $.validator.format("Please enter a value greater than or equal to {0}.") + required: $.mage.__("This field is required."), + remote: $.mage.__("Please fix this field."), + email: $.mage.__("Please enter a valid email address."), + url: $.mage.__("Please enter a valid URL."), + date: $.mage.__("Please enter a valid date."), + dateISO: $.mage.__("Please enter a valid date (ISO)."), + number: $.mage.__("Please enter a valid number."), + digits: $.mage.__("Please enter only digits."), + creditcard: $.mage.__("Please enter a valid credit card number."), + equalTo: $.mage.__("Please enter the same value again."), + maxlength: $.validator.format($.mage.__("Please enter no more than {0} characters.")), + minlength: $.validator.format($.mage.__("Please enter at least {0} characters.")), + rangelength: $.validator.format($.mage.__("Please enter a value between {0} and {1} characters long.")), + range: $.validator.format($.mage.__("Please enter a value between {0} and {1}.")), + max: $.validator.format($.mage.__("Please enter a value less than or equal to {0}.")), + min: $.validator.format($.mage.__("Please enter a value greater than or equal to {0}.")) }, autoCreateRanges: false, @@ -621,6 +621,7 @@ }, defaultMessage: function (element, method) { + var noMessage = $.mage.__("Warning: No message defined for %s"); return this.findDefined( this.customMessage(element.name, method), this.customDataMessage(element, method), @@ -628,7 +629,7 @@ // title is never undefined, so handle empty string as undefined !this.settings.ignoreTitle && element.title || undefined, $.validator.messages[method], - "<strong>Warning: No message defined for " + element.name + "</strong>" + "<strong>" + noMessage.replace('%s', element.name) + "</strong>" ); }, diff --git a/lib/web/mage/adminhtml/grid.js b/lib/web/mage/adminhtml/grid.js index 9509684882687e9ebfdb793ed5920f4873119982..62ede73c5c2fc8e94c6c32f538ba56447e9018db 100644 --- a/lib/web/mage/adminhtml/grid.js +++ b/lib/web/mage/adminhtml/grid.js @@ -372,7 +372,7 @@ varienGridMassaction.prototype = { useSelectAll: false, currentItem: false, lastChecked: { left: false, top: false, checkbox: false }, - fieldTemplate: mageTemplate('<input type="hidden" name="<%= name %>" value="<%= value %>" />'), + fieldTemplate: mageTemplate('<input type="hidden" name="<%- name %>" value="<%- value %>" />'), initialize: function (containerId, grid, checkedValues, formFieldNameInternal, formFieldName) { this.setOldCallback('row_click', grid.rowClickCallback); this.setOldCallback('init', grid.initCallback); diff --git a/lib/web/mage/backend/notification.js b/lib/web/mage/backend/notification.js index 99f898f5806942798e0156035948b6b80e44a64e..eb688214155efc8314dabc25cba88f44bfd839e8 100644 --- a/lib/web/mage/backend/notification.js +++ b/lib/web/mage/backend/notification.js @@ -13,7 +13,7 @@ define([ $.widget('mage.notification', { options: { templates: { - global: '<div class="messages"><div class="message <%= if (data.error) { %>error<% } %>"><div><%= data.message %></div></div></div>' + global: '<div class="messages"><div class="message <%- if (data.error) { %>error<% } %>"><div><%- data.message %></div></div></div>' } }, diff --git a/lib/web/mage/backend/suggest.js b/lib/web/mage/backend/suggest.js index 9617c1d7df59af842aaba5f9b06c4477f7737a5c..70dd802284562e8d43d54be0e28b5d38f7e27ac2 100644 --- a/lib/web/mage/backend/suggest.js +++ b/lib/web/mage/backend/suggest.js @@ -28,18 +28,18 @@ widgetEventPrefix: 'suggest', options: { template: '<% if (data.items.length) { %><% if (!data.term && !data.allShown() && data.recentShown()) { %>' + - '<h5 class="title"><%= data.recentTitle %></h5>' + + '<h5 class="title"><%- data.recentTitle %></h5>' + '<% } %>' + '<ul data-mage-init=\'{"menu":[]}\'>' + '<% _.each(data.items, function(value){ %>' + '<% if (!data.itemSelected(value)) { %><li <%= data.optionData(value) %>>' + - '<a href="#"><%= value.label %></a></li><% } %>' + + '<a href="#"><%- value.label %></a></li><% } %>' + '<% }); %>' + '<% if (!data.term && !data.allShown() && data.recentShown()) { %>' + '<li data-mage-init=\'{"actionLink":{"event":"showAll"}}\' class="show-all">' + - '<a href="#"><%= data.showAllTitle %></a></li>' + + '<a href="#"><%- data.showAllTitle %></a></li>' + '<% } %>' + - '</ul><% } else { %><span class="mage-suggest-no-records"><%= data.noRecordsText %></span><% } %>', + '</ul><% } else { %><span class="mage-suggest-no-records"><%- data.noRecordsText %></span><% } %>', minLength: 1, /** * @type {(String|Array)} @@ -776,7 +776,7 @@ options: { multiSuggestWrapper: '<ul class="mage-suggest-choices">' + '<li class="mage-suggest-search-field" data-role="parent-choice-element"><label class="mage-suggest-search-label"></label></li></ul>', - choiceTemplate: '<li class="mage-suggest-choice button"><div><%= text %></div>' + + choiceTemplate: '<li class="mage-suggest-choice button"><div><%- text %></div>' + '<span class="mage-suggest-choice-close" tabindex="-1" ' + 'data-mage-init=\'{"actionLink":{"event":"removeOption"}}\'></span></li>', selectedClass: 'mage-suggest-selected' diff --git a/lib/web/mage/backend/tree-suggest.js b/lib/web/mage/backend/tree-suggest.js index 19ec82c2a1f6148e82d264a52246634162f8a270..794e9638ff6e0e6084e60ccb4ef86591483fa7ae 100644 --- a/lib/web/mage/backend/tree-suggest.js +++ b/lib/web/mage/backend/tree-suggest.js @@ -113,7 +113,7 @@ '<ul>' + '<% _.each(data.items, function(value) { %>' + '<li class="<% if (data.itemSelected(value)) { %>mage-suggest-selected<% } %><% if (value.is_active == 0) { %> mage-suggest-not-active<% } %>">' + - '<a href="#" <%= data.optionData(value) %>><%= value.label %></a>' + + '<a href="#" <%= data.optionData(value) %>><%- value.label %></a>' + '<% if (value.children && value.children.length) { %>' + '<%= data.renderTreeLevel(value.children) %>' + '<% } %>' + @@ -129,8 +129,8 @@ '<% if (!data.itemSelected(value)) {%>' + '<li <%= data.optionData(value) %>>' + '<a href="#">' + - '<span class="category-label"><%= value.label %></span>' + - '<span class="category-path"><%= value.path %></span>' + + '<span class="category-label"><%- value.label %></span>' + + '<span class="category-path"><%- value.path %></span>' + '</a>' + '</li>' + '<% } %>' + @@ -138,7 +138,7 @@ '</ul>' + '<% } %>' + '<% } else { %>' + - '<span class="mage-suggest-no-records"><%= data.noRecordsText %></span>' + + '<span class="mage-suggest-no-records"><%- data.noRecordsText %></span>' + '<% } %>', controls: { selector: ':ui-menu, :mage-menu, .jstree', diff --git a/lib/web/mage/dataPost.js b/lib/web/mage/dataPost.js index 2ace3bc0a24d39059a9a8a62dc5a012b52db18fa..b7fc0d18eb912afedc07d8425ac436d57d1b8a9d 100644 --- a/lib/web/mage/dataPost.js +++ b/lib/web/mage/dataPost.js @@ -12,9 +12,9 @@ define([ $.widget('mage.dataPost', { options: { - formTemplate: '<form action="<%= data.action %>" method="post">' + formTemplate: '<form action="<%- data.action %>" method="post">' + '<% _.each(data.data, function(value, index) { %>' - + '<input name="<%= index %>" value="<%= value %>">' + + '<input name="<%- index %>" value="<%- value %>">' + '<% }) %></form>', postTrigger: ['a[data-post]', 'button[data-post]', 'span[data-post]'], formKeyInputSelector: 'input[name="form_key"]' diff --git a/lib/web/mage/decorate.js b/lib/web/mage/decorate.js index 0babea53af81b9f42e7db1bedf2e3266c26a278c..2c629479e497f1ccc31fdf570cf4ea44b3c050d3 100644 --- a/lib/web/mage/decorate.js +++ b/lib/web/mage/decorate.js @@ -111,7 +111,8 @@ } else if (typeof method === 'object' || ! method) { return methods.init.apply(this, arguments); } else { - $.error($.mage.__('Method ' + method + ' does not exist on jQuery.decorate')); + var message = $.mage.__('Method %s does not exist on jQuery.decorate'); + $.error(message.replace('%s', method)); } }; diff --git a/lib/web/mage/loader.js b/lib/web/mage/loader.js index 12c75e86554aabf4cf852ebc1fe1bc775b7c565f..b9443094f07201bda215e498f1706ba348a31629 100644 --- a/lib/web/mage/loader.js +++ b/lib/web/mage/loader.js @@ -23,8 +23,8 @@ define([ template: '<div class="loading-mask" data-role="loader">' + '<div class="loader">' + - '<img alt="<%= data.texts.imgAlt %>" src="<%= data.icon %>">' + - '<p><%= data.texts.loaderText %></p>' + + '<img alt="<%- data.texts.imgAlt %>" src="<%- data.icon %>">' + + '<p><%- data.texts.loaderText %></p>' + '</div>' + '</div>' diff --git a/lib/web/mage/loader_old.js b/lib/web/mage/loader_old.js index f2164f998aae5af18008e910e0aa0303b459af8c..86ebce8cd6ac978587d42711834f29be27498c89 100644 --- a/lib/web/mage/loader_old.js +++ b/lib/web/mage/loader_old.js @@ -32,8 +32,8 @@ template: '<div class="loading-mask" data-role="loader">' + '<div class="popup popup-loading">' + '<div class="popup-inner">' + - '<% if (data.icon) { %><img <% if (data.texts.imgAlt) { %>alt="<%= data.texts.imgAlt %>"<% } %> src="<%= data.icon %>"><% } %>' + - '<% if (data.texts.loaderText) { %><%= data.texts.loaderText %><% } %>' + + '<% if (data.icon) { %><img <% if (data.texts.imgAlt) { %>alt="<%- data.texts.imgAlt %>"<% } %> src="<%- data.icon %>"><% } %>' + + '<% if (data.texts.loaderText) { %><%- data.texts.loaderText %><% } %>' + '</div>' + '</div>' + '</div>' diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index 01b4d116ebf4a8d192512003a6cb9e51752092eb..94055ff0a1ddbda398323f9d8e31a9060ac7bfd3 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -6,7 +6,8 @@ define([ "jquery", "matchMedia", "jquery/ui", - "jquery/jquery.mobile.custom" + "jquery/jquery.mobile.custom", + "mage/translate" ], function($, mediaCheck){ 'use strict'; @@ -274,7 +275,7 @@ define([ this.categoryLink = $('<a>') .attr('href', categoryUrl) - .text('All '+ category); + .text($.mage.__('All ') + category); this.categoryParent = $('<li>') .addClass('ui-menu-item all-category') @@ -336,9 +337,17 @@ define([ "mouseleave .ui-menu": "collapseAll" }); - var categoryParent = this.element.find('.all-category'); + var categoryParent = this.element.find('.all-category'), + html = $('html'); categoryParent.remove(); + + if (html.hasClass('nav-open')) { + html.removeClass('nav-open'); + setTimeout(function () { + html.removeClass('nav-before-open'); + }, 300); + } }, _delay: function(handler, delay) { @@ -355,7 +364,7 @@ define([ responsiveAction: 'wrap', //option for responsive handling maxItems: null, //option to set max number of menu items container: '#menu', //container to check against navigation length - moreText: 'more', + moreText: $.mage.__('more'), breakpoint: 768 }, diff --git a/lib/web/mage/translate-inline-vde.js b/lib/web/mage/translate-inline-vde.js index 6c2b3a53b7f927fe0f9ca3679a131568bb9f6038..0e70103b8f06fa3173582e16ed52cd42032d86cb 100644 --- a/lib/web/mage/translate-inline-vde.js +++ b/lib/web/mage/translate-inline-vde.js @@ -127,7 +127,7 @@ */ _checkTranslateEditing: function(event, data) { if (this.isBeingEdited) { - alert($.mage.__(data.alert_message)); + alert(data.alert_message); data.is_being_edited = true; } else { diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 6e14e33548ddd8d773f3149689b5158c089cd969..7632ce9b84977587975da37348f383f39395c89e 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -934,7 +934,8 @@ return true; }, function() { - return $.mage.__('Please enter a value less than or equal to %s.').replace('%s', this.lteToVal); + var message = $.mage.__('Please enter a value less than or equal to %s.'); + return message.replace('%s', this.lteToVal); } ], "greater-than-equals-to": [ @@ -946,7 +947,8 @@ return true; }, function() { - return $.mage.__('Please enter a value greater than or equal to %s.').replace('%s', this.gteToVal); + var message = $.mage.__('Please enter a value greater than or equal to %s.'); + return message.replace('%s', this.gteToVal); } ], "validate-emails": [ @@ -1250,7 +1252,7 @@ var showLabel = $.validator.prototype.showLabel; $.extend(true, $.validator.prototype, { showLabel: function(element, message) { - showLabel.call(this, element, $.mage.__(message)); + showLabel.call(this, element, message); // ARIA (adding aria-invalid & aria-describedby) var label = this.errorsFor(element), diff --git a/lib/web/mage/validation/validation.js b/lib/web/mage/validation/validation.js index 42013cf2ca1b41c1e6a1eb40b22cb9417f8b9d0a..d666d2025c2636cb00b27e5d2af2c8baa584323d 100644 --- a/lib/web/mage/validation/validation.js +++ b/lib/web/mage/validation/validation.js @@ -72,7 +72,8 @@ if (inputDate >= minDate && inputDate <= maxDate) { return true; } - this.dateBetweenErrorMessage = $.mage.__('Please enter a date between %min and %max.').replace('%min', minDate).replace('%max', maxDate); + var message = $.mage.__('Please enter a date between %min and %max.'); + this.dateBetweenErrorMessage = message.replace('%min', minDate).replace('%max', maxDate); return false; }, function () { @@ -107,14 +108,14 @@ return false; } if (year < 1900 || year > curYear) { - this.dobErrorMessage = - $.mage.__('Please enter a valid year (1900-%1).').replace('%1', curYear.toString()); + var validYearMessage = $.mage.__('Please enter a valid year (1900-%1).'); + this.dobErrorMessage = validYearMessage.replace('%1', curYear.toString()); return false; } var validateDayInMonth = new Date(year, month, 0).getDate(); if (day < 1 || day > validateDayInMonth) { - this.dobErrorMessage = - $.mage.__('Please enter a valid day (1-%1).').replace('%1', validateDayInMonth.toString()); + var validDateMessage = $.mage.__('Please enter a valid day (1-%1).'); + this.dobErrorMessage = validDateMessage.replace('%1', validateDayInMonth.toString()); return false; } var today = new Date(), diff --git a/pub/get.php b/pub/get.php index f223a917dbb317cdc39736c975651261fca3b348..7e9adfd0e9fd7cde47236f024c888ae44d254f3d 100755 --- a/pub/get.php +++ b/pub/get.php @@ -63,9 +63,7 @@ if ($mediaDirectory) { // Materialize file in application $params = $_SERVER; if (empty($mediaDirectory)) { - $params[ObjectManagerFactory::INIT_PARAM_DEPLOYMENT_CONFIG] = [ - DeploymentConfig::CONFIG_KEY => ['Magento_Core' => 1], - ]; + $params[ObjectManagerFactory::INIT_PARAM_DEPLOYMENT_CONFIG] = []; $params[Factory::PARAM_CACHE_FORCED_OPTIONS] = ['frontend_options' => ['disable_save' => true]]; } $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params); diff --git a/setup/pub/styles/setup.css b/setup/pub/styles/setup.css index 2b738d61e6ee37fd1d75260db370b4e012fae368..41b113a55c90f4be925712eee65124bb3200d537 100644 --- a/setup/pub/styles/setup.css +++ b/setup/pub/styles/setup.css @@ -3,4 +3,4 @@ * See COPYING.txt for license details. */ -html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;font-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{box-sizing:border-box}:focus{box-shadow:none;outline:0}.keyfocus :focus{box-shadow:0 0 0 1px #008bdb}embed,img,object,video{max-width:100%}.abs-clearer:after,.form-row:after,.header:after,.ie9 .alert:after,.nav:after,.row:after{content:"";display:table;clear:both}.ng-cloak{display:none!important}.hide.hide{display:none}.show.show{display:block}.text-center{text-align:center}.text-right{text-align:right}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/light/opensans-300.eot);src:url(../../pub/fonts/opensans/light/opensans-300.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/light/opensans-300.woff2) format('woff2'),url(../../pub/fonts/opensans/light/opensans-300.woff) format('woff'),url(../../pub/fonts/opensans/light/opensans-300.ttf) format('truetype'),url('../../pub/fonts/opensans/light/opensans-300.svg#Open Sans') format('svg');font-weight:300;font-style:normal}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/regular/opensans-400.eot);src:url(../../pub/fonts/opensans/regular/opensans-400.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/regular/opensans-400.woff2) format('woff2'),url(../../pub/fonts/opensans/regular/opensans-400.woff) format('woff'),url(../../pub/fonts/opensans/regular/opensans-400.ttf) format('truetype'),url('../../pub/fonts/opensans/regular/opensans-400.svg#Open Sans') format('svg');font-weight:400;font-style:normal}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/semibold/opensans-600.eot);src:url(../../pub/fonts/opensans/semibold/opensans-600.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/semibold/opensans-600.woff2) format('woff2'),url(../../pub/fonts/opensans/semibold/opensans-600.woff) format('woff'),url(../../pub/fonts/opensans/semibold/opensans-600.ttf) format('truetype'),url('../../pub/fonts/opensans/semibold/opensans-600.svg#Open Sans') format('svg');font-weight:600;font-style:normal}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/bold/opensans-700.eot);src:url(../../pub/fonts/opensans/bold/opensans-700.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/bold/opensans-700.woff2) format('woff2'),url(../../pub/fonts/opensans/bold/opensans-700.woff) format('woff'),url(../../pub/fonts/opensans/bold/opensans-700.ttf) format('truetype'),url('../../pub/fonts/opensans/bold/opensans-700.svg#Open Sans') format('svg');font-weight:700;font-style:normal}html{font-size:62.5%}body{color:#303030;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:1.4rem;font-weight:400;line-height:1.4}h1,h2,h3,h4,h5,h6{font-weight:400;margin-top:0}p{margin:0 0 1em}a{color:#008bdb;text-decoration:none}a:hover{color:#0fa7ff;text-decoration:underline}@font-face{font-family:Icons;src:url(../../pub/fonts/icons/icons.eot);src:url(../../pub/fonts/icons/icons.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/icons/icons.woff2) format('woff2'),url(../../pub/fonts/icons/icons.woff) format('woff'),url(../../pub/fonts/icons/icons.ttf) format('truetype'),url(../../pub/fonts/icons/icons.svg#Icons) format('svg');font-weight:400;font-style:normal}[class*=icon-]{display:inline-block;line-height:1}[class*=icon-]:after{font-family:Icons}.icon-success-thick:after{content:'\e600'}.icon-success:after{content:'\e601'}.icon-collapse:after{content:'\e602'}.icon-failed-thick:after{content:'\e603'}.icon-failed:after{content:'\e604'}.icon-expand:after{content:'\e605'}.icon-warning:after{content:'\e606'}.icon-failed-round,.icon-success-round{border-radius:100%;color:#fff;font-size:2.5rem;height:1em;position:relative;text-align:center;width:1em}.icon-failed-round:after,.icon-success-round:after{bottom:0;font-size:.8em;left:0;position:absolute;right:0;top:.15em}.icon-success-round{background-color:#79a22e}.icon-success-round:after{content:'\e600'}.icon-failed-round{background-color:#e22626}.icon-failed-round:after{content:'\e603'}dl,ol,ul{margin-top:0}.list{margin-bottom:1em;padding-left:0}.list>li{display:block;margin-bottom:.75em;position:relative}.list>li>.icon-failed,.list>li>.icon-success{font-size:1.6em;left:-.1em;position:absolute;top:0}.list>li>.icon-success{color:#79a22e}.list>li>.icon-failed{color:#e22626}.list-item-failed,.list-item-icon,.list-item-success{padding-left:3.5rem}.list-item-failed:before,.list-item-success:before{font-family:Icons;font-size:1.6em;left:-.1em;position:absolute;top:-.2em}.list-item-success:before{color:#79a22e;content:'\e601'}.list-item-failed:before{color:#e22626;content:'\e604'}.list-definition{margin:0 0 3rem;padding:0}.list-definition>dt{clear:left;float:left}.list-definition>dd{margin-bottom:1em;margin-left:20rem}.btn-wrap{margin:0 auto}.btn-wrap .btn{width:100%}.btn{background:#e3e3e3;border:none;color:#514943;display:inline-block;font-size:1.6rem;font-weight:600;padding:.45em .5em;text-align:center}.btn:hover{background-color:#dbdbdb;color:#514943;text-decoration:none}.btn:active{background-color:#d6d6d6}.btn.disabled,.btn[disabled]{cursor:default;opacity:.5;pointer-events:none}.ie9 .btn.disabled,.ie9 .btn[disabled]{background-color:#f0f0f0;opacity:1;text-shadow:none}.btn-large{padding:.75em 1.25em}.btn-link{background-color:transparent;border:none;color:#008bdb;font-family:1.6rem;font-size:1.5rem}.btn-link:hover{background-color:transparent;color:#0fa7ff}.btn-prime{background-color:#eb5202;color:#fff;text-shadow:1px 1px 0 rgba(0,0,0,.25)}.btn-prime:hover{background-color:#f65405;background-repeat:repeat-x;background-image:linear-gradient(to right,#e04f00 0,#f65405 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e04f00', endColorstr='#f65405', GradientType=1);color:#fff}.btn-prime:active{background-color:#e04f00;background-repeat:repeat-x;background-image:linear-gradient(to right,#f65405 0,#e04f00 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f65405', endColorstr='#e04f00', GradientType=1)}.ie9 .btn-prime.disabled,.ie9 .btn-prime[disabled]{background-color:#fd6e23}.ie9 .btn-prime.disabled:active,.ie9 .btn-prime.disabled:hover,.ie9 .btn-prime[disabled]:active,.ie9 .btn-prime[disabled]:hover{background-color:#fd6e23;-webkit-filter:none;filter:none}.btn-secondary{background-color:#514943;color:#fff}.btn-secondary:hover{background-color:#5f564f;color:#fff}.btn-secondary:active{background-color:#574e48}.ie9 .btn-secondary.disabled,.ie9 .btn-secondary[disabled]{background-color:#514943}.ie9 .btn-secondary.disabled:active,.ie9 .btn-secondary.disabled:hover,.ie9 .btn-secondary[disabled]:active,.ie9 .btn-secondary[disabled]:hover{background-color:#514943;-webkit-filter:none;filter:none}[class*=btn-wrap-triangle]{overflow:hidden;position:relative}[class*=btn-wrap-triangle] .btn:after{border-style:solid;content:'';height:0;position:absolute;top:0;width:0}.btn-wrap-triangle-right{display:inline-block;padding-right:1.74rem;position:relative}.btn-wrap-triangle-right .btn{text-indent:.92rem}.btn-wrap-triangle-right .btn:after{border-color:transparent transparent transparent #e3e3e3;border-width:1.84rem 0 1.84rem 1.84rem;left:100%;margin-left:-1.74rem}.btn-wrap-triangle-right .btn:hover:after{border-left-color:#dbdbdb}.btn-wrap-triangle-right .btn:active:after{border-left-color:#d6d6d6}.btn-wrap-triangle-right .btn:not(.disabled):active,.btn-wrap-triangle-right .btn:not([disabled]):active{left:1px}.ie9 .btn-wrap-triangle-right .btn.disabled:after,.ie9 .btn-wrap-triangle-right .btn[disabled]:after{border-color:transparent transparent transparent #f0f0f0}.ie9 .btn-wrap-triangle-right .btn.disabled:active:after,.ie9 .btn-wrap-triangle-right .btn.disabled:hover:after,.ie9 .btn-wrap-triangle-right .btn[disabled]:active:after,.ie9 .btn-wrap-triangle-right .btn[disabled]:hover:after{border-left-color:#f0f0f0}.btn-wrap-triangle-right .btn-prime:after{border-color:transparent transparent transparent #eb5202}.btn-wrap-triangle-right .btn-prime:hover:after{border-left-color:#f65405}.btn-wrap-triangle-right .btn-prime:active:after{border-left-color:#e04f00}.btn-wrap-triangle-right .btn-prime:not(.disabled):active,.btn-wrap-triangle-right .btn-prime:not([disabled]):active{left:1px}.ie9 .btn-wrap-triangle-right .btn-prime.disabled:after,.ie9 .btn-wrap-triangle-right .btn-prime[disabled]:after{border-color:transparent transparent transparent #fd6e23}.ie9 .btn-wrap-triangle-right .btn-prime.disabled:active:after,.ie9 .btn-wrap-triangle-right .btn-prime.disabled:hover:after,.ie9 .btn-wrap-triangle-right .btn-prime[disabled]:active:after,.ie9 .btn-wrap-triangle-right .btn-prime[disabled]:hover:after{border-left-color:#fd6e23}.btn-wrap-triangle-left{display:inline-block;padding-left:1.74rem}.btn-wrap-triangle-left .btn{text-indent:-.92rem}.btn-wrap-triangle-left .btn:after{border-color:transparent #e3e3e3 transparent transparent;border-width:1.84rem 1.84rem 1.84rem 0;margin-right:-1.74rem;right:100%}.btn-wrap-triangle-left .btn:hover:after{border-right-color:#dbdbdb}.btn-wrap-triangle-left .btn:active:after{border-right-color:#d6d6d6}.btn-wrap-triangle-left .btn:not(.disabled):active,.btn-wrap-triangle-left .btn:not([disabled]):active{right:1px}.ie9 .btn-wrap-triangle-left .btn.disabled:after,.ie9 .btn-wrap-triangle-left .btn[disabled]:after{border-color:transparent #f0f0f0 transparent transparent}.ie9 .btn-wrap-triangle-left .btn.disabled:active:after,.ie9 .btn-wrap-triangle-left .btn.disabled:hover:after,.ie9 .btn-wrap-triangle-left .btn[disabled]:active:after,.ie9 .btn-wrap-triangle-left .btn[disabled]:hover:after{border-right-color:#f0f0f0}.btn-wrap-triangle-left .btn-prime:after{border-color:transparent #eb5202 transparent transparent}.btn-wrap-triangle-left .btn-prime:hover:after{border-right-color:#e04f00}.btn-wrap-triangle-left .btn-prime:active:after{border-right-color:#f65405}.btn-wrap-triangle-left .btn-prime:not(.disabled):active,.btn-wrap-triangle-left .btn-prime:not([disabled]):active{right:1px}.ie9 .btn-wrap-triangle-left .btn-prime.disabled:after,.ie9 .btn-wrap-triangle-left .btn-prime[disabled]:after{border-color:transparent #fd6e23 transparent transparent}.ie9 .btn-wrap-triangle-left .btn-prime.disabled:active:after,.ie9 .btn-wrap-triangle-left .btn-prime.disabled:hover:after,.ie9 .btn-wrap-triangle-left .btn-prime[disabled]:active:after,.ie9 .btn-wrap-triangle-left .btn-prime[disabled]:hover:after{border-right-color:#fd6e23}.btn-expand{background-color:transparent;border:none;color:#303030;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:1.4rem;font-weight:700;padding:0;position:relative}.btn-expand.expanded:after{border-color:transparent transparent #303030;border-width:0 .285em .36em}.btn-expand.expanded:hover:after{border-color:transparent transparent #3d3d3d}.btn-expand:hover{background-color:transparent;border:none;color:#3d3d3d}.btn-expand:hover:after{border-color:#3d3d3d transparent transparent}.btn-expand:after{border-color:#303030 transparent transparent;border-style:solid;border-width:.36em .285em 0;content:'';height:0;left:100%;margin-left:.5em;margin-top:-.18em;position:absolute;top:50%;width:0}[class*=col-] .form-el-input,[class*=col-] .form-el-select{width:100%}.form-fieldset{border:none;margin:0 0 1em;padding:0}.form-row{margin-bottom:2.2rem}.form-row .form-row{margin-bottom:.4rem}.form-row .form-label{display:block;font-weight:600;padding:.6rem 2.1em 0 0;text-align:right}.form-row .form-label.required{position:relative}.form-row .form-label.required:after{color:#eb5202;content:'*';font-size:1.15em;position:absolute;right:.7em;top:.5em}.form-row .form-el-checkbox+.form-label:before,.form-row .form-el-radio+.form-label:before{top:.7rem}.form-row .form-el-checkbox+.form-label:after,.form-row .form-el-radio+.form-label:after{top:1.1rem}input:not([disabled]):focus,textarea:not([disabled]):focus{box-shadow:none}.form-el-input{border:1px solid #adadad;border-radius:2px;color:#303030;padding:.35em .55em .5em}.form-el-input:hover{border-color:#949494}.form-el-input:focus{border-color:#008bdb}.form-label{margin-bottom:.5em}[class*=form-label][for]{cursor:pointer}.form-el-insider-wrap{display:table;width:100%}.form-el-insider-input{display:table-cell;width:100%}.form-el-insider{border-radius:2px;display:table-cell;vertical-align:top;padding:.43em .55em .5em 0}.form-legend,.form-legend-expand,.form-legend-light{display:block;margin:0}.form-legend,.form-legend-expand{margin-bottom:2.5em;padding-top:1.5em;font-weight:600;font-size:1.25em}.form-legend{width:100%;border-top:1px solid #ccc}.form-legend-light{margin-bottom:1.5em;font-size:1em}.form-legend-expand{transition:opacity .2s linear;cursor:pointer}.form-legend-expand:hover{opacity:.85}.form-legend-expand.expanded:after{content:'\e602'}.form-legend-expand:after{margin-left:.5em;font-weight:400;font-size:1.15em;font-family:Icons;content:'\e605';vertical-align:sub}.form-el-checkbox,.form-el-radio{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.form-el-checkbox.disabled+.form-label,.form-el-checkbox.disabled+.form-label:before,.form-el-checkbox[disabled]+.form-label,.form-el-checkbox[disabled]+.form-label:before,.form-el-radio.disabled+.form-label,.form-el-radio.disabled+.form-label:before,.form-el-radio[disabled]+.form-label,.form-el-radio[disabled]+.form-label:before{cursor:default;opacity:.5;pointer-events:none}.form-el-checkbox:not(.disabled)+.form-label:hover:before,.form-el-checkbox:not([disabled])+.form-label:hover:before,.form-el-radio:not(.disabled)+.form-label:hover:before,.form-el-radio:not([disabled])+.form-label:hover:before{border-color:#514943}.form-el-checkbox+.form-label,.form-el-radio+.form-label{font-weight:400;padding-left:2em;padding-right:0;position:relative;text-align:left;transition:border-color .1s linear}.form-el-checkbox+.form-label:before,.form-el-radio+.form-label:before{border:1px solid;content:'';left:0;position:absolute;top:.1rem;transition:border-color .1s linear}.form-el-checkbox+.form-label:before{border-color:#adadad;border-radius:2px;height:1.4rem;line-height:1;width:1.4rem}.form-el-checkbox:checked+.form-label::before{content:'\e600';font-family:Icons}.form-el-radio+.form-label:before{background-color:#fff;border:1px solid #adadad;border-radius:100%;height:1.6rem;width:1.6rem}.form-el-radio+.form-label:after{background:0 0;border:.5rem solid transparent;border-radius:100%;content:'';height:0;left:.4rem;position:absolute;top:.5rem;transition:background .3s linear;width:0}.form-el-radio:checked+.form-label{cursor:default}.form-el-radio:checked+.form-label:after{border-color:#514943}.form-select-label{border:1px solid #adadad;border-radius:2px;color:#303030;cursor:pointer;display:block;overflow:hidden;position:relative}.form-select-label:hover,.form-select-label:hover:after{border-color:#949494}.form-select-label:active,.form-select-label:active:after,.form-select-label:focus,.form-select-label:focus:after{border-color:#008bdb}.form-select-label:after{background:#e3e3e3;border-left:1px solid #adadad;bottom:0;content:'';position:absolute;right:0;top:0;width:2.36em;z-index:-2}.ie9 .form-select-label:after{display:none}.form-select-label:before{border-color:#303030 transparent transparent;border-style:solid;border-width:5px 4px 0;content:'';height:0;margin-right:-4px;margin-top:-2.5px;position:absolute;right:1.18em;top:50%;width:0;z-index:-1}.ie9 .form-select-label:before{display:none}.form-select-label .form-el-select{background:0 0;border:none;border-radius:0;content:'';display:block;margin:0;padding:.35em calc(2.36em + 10%) .5em .55em;width:110%}.ie9 .form-select-label .form-el-select{padding-right:.55em;width:100%}.form-el-select{background:#fff;border:1px solid #adadad;border-radius:2px;color:#303030;display:block;padding:.35em .55em}.multiselect-custom{position:relative;height:45.2rem;border:1px solid #adadad;overflow:auto;margin:0 0 1.5rem}.multiselect-custom ul{margin:0;padding:0;list-style:none;min-width:29rem}.multiselect-custom .item{padding:1rem 1.4rem}.multiselect-custom .selected{background-color:#e0f6fe}.multiselect-custom .form-label{margin-bottom:0}[class*=form-el-].invalid{border-color:#e22626}[class*=form-el-].invalid+.error-container{display:block}.error-container{background-color:#fff8d6;border:1px solid #ee7d7d;border-radius:2px;color:#514943;display:none;font-size:1.19rem;margin-top:.2rem;padding:.4235em .6655em .605em}.check-result-message{margin-left:.5em;min-height:3.68rem;-webkit-align-items:center;-ms-align-items:center;-ms-flex-align:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex}.check-result-text{margin-left:.5em}.pseudo-table{display:table}.pseudo-td{display:table-cell}.alert{margin-bottom:3.5rem;padding:2.5rem;-webkit-align-items:center;-ms-align-items:center;-ms-flex-align:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex}.alert .spinner{min-width:1em}.ie9 .alert .spinner{float:left}.alert p:last-child{margin-bottom:0}.alert-info{background-color:#fafafa;border:1px solid #ccc}.alert-warning{background-color:#fff8d6;border:1px solid #fff8d6}.alert-icon{margin-right:1.5rem}.ie9 .alert-icon{float:left}[class*=icon-].alert-icon{font-size:3.8rem;min-width:3.8rem}.alert-text{margin-bottom:0}.alert-text~.alert-text{margin-top:1em}.ie9 .alert-text{display:block;margin-left:5.3rem;margin-top:1rem}.container{display:block;margin:0 auto 4rem;max-width:100rem;padding:0 2rem}.row{margin-left:0;margin-right:0}.col-l-1,.col-l-10,.col-l-11,.col-l-12,.col-l-2,.col-l-3,.col-l-4,.col-l-5,.col-l-6,.col-l-7,.col-l-8,.col-l-9,.col-m-1,.col-m-10,.col-m-11,.col-m-12,.col-m-2,.col-m-3,.col-m-4,.col-m-5,.col-m-6,.col-m-7,.col-m-8,.col-m-9,.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{min-height:1px;padding-left:0;padding-right:0;position:relative}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}.nav{background-color:#f8f8f8;border-bottom:1px solid #e3e3e3;border-top:1px solid #e3e3e3;display:none;padding:2.2rem 1.5rem 0 0}.nav .btn-group,.nav-bar-outer-actions{float:right;margin-bottom:1.7rem}.nav .btn-group .btn-wrap,.nav-bar-outer-actions .btn-wrap{float:right;margin-left:.5rem;margin-right:.5rem}.nav-bar-outer-actions{margin-top:-10.6rem;padding-right:1.5rem}.btn-wrap-try-again{width:9.5rem}.btn-wrap-next,.btn-wrap-prev{width:8.5rem}.nav-bar{counter-reset:i;float:left;margin:0 1rem 1.7rem 0;padding:0;position:relative;white-space:nowrap}.nav-bar:before{background-color:#d4d4d4;background-repeat:repeat-x;background-image:linear-gradient(to bottom,#d1d1d1 0,#d4d4d4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d1d1d1', endColorstr='#d4d4d4', GradientType=0);border-bottom:1px solid #d9d9d9;border-top:1px solid #bfbfbf;content:'';height:.8rem;left:5.15rem;position:absolute;right:5.15rem;top:.7rem}.nav-bar>li{display:inline-block;font-size:0;position:relative;vertical-align:top;width:10.3rem}.nav-bar>li:first-child:after{display:none}.nav-bar>li:after{background-color:#514943;content:'';height:.5rem;left:calc(-50% + .25rem);position:absolute;right:calc(50% + .7rem);top:.9rem}.nav-bar>li.disabled:before{bottom:0;content:'';left:0;position:absolute;right:0;top:0;z-index:1}.nav-bar>li.active~li:after{display:none}.nav-bar>li.active~li a:after{background-color:transparent;border-color:transparent;color:#a6a6a6}.nav-bar>li.active a{color:#000}.nav-bar>li.active a:hover{cursor:default}.nav-bar>li.active a:after{background-color:#fff;content:''}.nav-bar a{color:#514943;display:block;font-size:1.2rem;font-weight:600;line-height:1.2;overflow:hidden;padding:3rem .5em 0;position:relative;text-align:center;text-overflow:ellipsis}.nav-bar a:hover{text-decoration:none}.nav-bar a:after{background-color:#514943;border:.4rem solid #514943;border-radius:100%;color:#fff;content:counter(i);counter-increment:i;height:.7rem;left:50%;line-height:.6;margin-left:-.8rem;position:absolute;right:auto;text-align:center;top:.4rem;width:.7rem}.nav-bar a:before{background-color:#d6d6d6;border:1px solid transparent;border-bottom-color:#d9d9d9;border-radius:100%;border-top-color:#bfbfbf;content:'';height:2.1rem;left:50%;line-height:1;margin-left:-1.2rem;position:absolute;top:0;width:2.1rem}.tooltip{display:block;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:1.19rem;font-weight:400;line-height:1.4;opacity:0;position:absolute;visibility:visible;z-index:10}.tooltip.in{opacity:.9}.tooltip.top{margin-top:-4px;padding:8px 0}.tooltip.right{margin-left:4px;padding:0 8px}.tooltip.bottom{margin-top:4px;padding:8px 0}.tooltip.left{margin-left:-4px;padding:0 8px}.tooltip-inner{background-color:#fff;border:1px solid #adadad;border-radius:0;box-shadow:1px 1px 1px #ccc;color:#41362f;max-width:20rem;padding:.5em 1em;text-decoration:none}.tooltip-arrow,.tooltip-arrow:after{border:solid transparent;height:0;position:absolute;width:0}.tooltip-arrow:after{content:'';position:absolute}.tooltip.top .tooltip-arrow,.tooltip.top .tooltip-arrow:after{border-top-color:#949494;border-width:8px 8px 0;bottom:0;left:50%;margin-left:-8px}.tooltip.top-left .tooltip-arrow,.tooltip.top-left .tooltip-arrow:after{border-top-color:#949494;border-width:8px 8px 0;bottom:0;margin-bottom:-8px;right:8px}.tooltip.top-right .tooltip-arrow,.tooltip.top-right .tooltip-arrow:after{border-top-color:#949494;border-width:8px 8px 0;bottom:0;left:8px;margin-bottom:-8px}.tooltip.right .tooltip-arrow,.tooltip.right .tooltip-arrow:after{border-right-color:#949494;border-width:8px 8px 8px 0;left:1px;margin-top:-8px;top:50%}.tooltip.right .tooltip-arrow:after{border-right-color:#fff;border-width:6px 7px 6px 0;margin-left:0;margin-top:-6px}.tooltip.left .tooltip-arrow,.tooltip.left .tooltip-arrow:after{border-left-color:#949494;border-width:8px 0 8px 8px;margin-top:-8px;right:0;top:50%}.tooltip.bottom .tooltip-arrow,.tooltip.bottom .tooltip-arrow:after{border-bottom-color:#949494;border-width:0 8px 8px;left:50%;margin-left:-8px;top:0}.tooltip.bottom-left .tooltip-arrow,.tooltip.bottom-left .tooltip-arrow:after{border-bottom-color:#949494;border-width:0 8px 8px;margin-top:-8px;right:8px;top:0}.tooltip.bottom-right .tooltip-arrow,.tooltip.bottom-right .tooltip-arrow:after{border-bottom-color:#949494;border-width:0 8px 8px;left:8px;margin-top:-8px;top:0}.password-strength{display:block;margin:0 -.3rem 1em;white-space:nowrap}.password-strength.password-strength-too-short .password-strength-item:first-child,.password-strength.password-strength-weak .password-strength-item:first-child,.password-strength.password-strength-weak .password-strength-item:first-child+.password-strength-item{background-color:#e22626}.password-strength.password-strength-fair .password-strength-item:first-child,.password-strength.password-strength-fair .password-strength-item:first-child+.password-strength-item,.password-strength.password-strength-fair .password-strength-item:first-child+.password-strength-item+.password-strength-item{background-color:#ef672f}.password-strength.password-strength-good .password-strength-item:first-child,.password-strength.password-strength-good .password-strength-item:first-child+.password-strength-item,.password-strength.password-strength-good .password-strength-item:first-child+.password-strength-item+.password-strength-item,.password-strength.password-strength-good .password-strength-item:first-child+.password-strength-item+.password-strength-item+.password-strength-item,.password-strength.password-strength-strong .password-strength-item{background-color:#79a22e}.password-strength .password-strength-item{background-color:#ccc;display:inline-block;font-size:0;height:1.4rem;margin-right:.3rem;width:calc(20% - .6rem)}@-webkit-keyframes progress-bar-stripes{from{background-position:4rem 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:4rem 0}to{background-position:0 0}}.progress{background-color:#fafafa;border:1px solid #ccc;height:3rem;margin-bottom:3rem;overflow:hidden}.progress-bar{background-color:#79a22e;color:#fff;float:left;font-size:1.19rem;height:100%;line-height:3rem;text-align:center;transition:width .6s ease;width:0}.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.spinner{display:inline-block;font-size:4rem;height:1em;margin-right:1.5rem;position:relative;width:1em}@-webkit-keyframes fade{0%{background-color:#514943}100%{background-color:#fff}}@keyframes fade{0%{background-color:#514943}100%{background-color:#fff}}.spinner>span:nth-child(1){-webkit-animation-delay:.27s;animation-delay:.27s;-webkit-transform:rotate(-315deg);-ms-transform:rotate(-315deg);transform:rotate(-315deg)}.spinner>span:nth-child(2){-webkit-animation-delay:.36s;animation-delay:.36s;-webkit-transform:rotate(-270deg);-ms-transform:rotate(-270deg);transform:rotate(-270deg)}.spinner>span:nth-child(3){-webkit-animation-delay:.45s;animation-delay:.45s;-webkit-transform:rotate(-225deg);-ms-transform:rotate(-225deg);transform:rotate(-225deg)}.spinner>span:nth-child(4){-webkit-animation-delay:.54s;animation-delay:.54s;-webkit-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg)}.spinner>span:nth-child(5){-webkit-animation-delay:.63s;animation-delay:.63s;-webkit-transform:rotate(-135deg);-ms-transform:rotate(-135deg);transform:rotate(-135deg)}.spinner>span:nth-child(6){-webkit-animation-delay:.72s;animation-delay:.72s;-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg)}.spinner>span:nth-child(7){-webkit-animation-delay:.81s;animation-delay:.81s;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.spinner>span:nth-child(8){-webkit-animation-delay:.9;animation-delay:.9;-webkit-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}.spinner>span{-webkit-animation-direction:linear;animation-direction:linear;-webkit-animation-duration:.72s;animation-duration:.72s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:fade;animation-name:fade;-webkit-transform:scale(0.4);-ms-transform:scale(0.4);transform:scale(0.4);background-color:#fff;border-radius:6px;clip:rect(0 .28571429em .1em 0);height:.1em;margin-top:.5em;position:absolute;width:1em}.ie9 .spinner{background:url(../../pub/images/ajax-loader.gif) center no-repeat}.ie9 .spinner>span{display:none}.main{padding-bottom:2rem;padding-top:3rem}.header{display:none}.header .logo{float:left;height:4.1rem;width:3.5rem}.header-title{font-size:2.8rem;letter-spacing:.02em;margin:2.5rem 0 3.5rem 5rem}.page-title{font-size:2rem;margin-bottom:1.3em}.accent-box{margin-bottom:2rem}.accent-box .btn-prime{margin-top:1.5rem}.page-landing{margin:7.6% auto 0;max-width:44rem;text-align:center}.page-landing .logo{height:5.6rem;margin-bottom:2rem;width:19.2rem}.page-landing .text-version{margin-bottom:3rem}.page-landing .text-welcome{margin-bottom:6.5rem}.page-landing .text-terms{margin-bottom:2.5rem;text-align:center}.page-landing .btn-submit{margin-bottom:20px}.page-license .license-text{margin-bottom:2rem}.page-license .page-license-footer{text-align:right}.rediness-check-item{margin-bottom:4rem}.readiness-check-title{font-size:1.4rem;font-weight:700;margin-bottom:.1rem;margin-left:7.5rem}.readiness-check-content{margin-left:7.5rem;margin-right:22rem}.readiness-check-content .readiness-check-title{margin-left:0}.readiness-check-content .list{margin-top:-.3rem}.rediness-check-side{float:right;padding-left:2.4rem;width:22rem}.rediness-check-side .side-title{margin-bottom:0}.readiness-check-icon{float:left;margin-left:2rem;margin-top:.7rem}.page-web-configuration .form-el-insider-wrap{width:auto}.page-web-configuration .form-el-insider{width:15.4rem}.page-web-configuration .form-el-insider-input .form-el-input{width:16.5rem}.customize-your-store .customize-your-store-default .legend{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.customize-your-store .advanced-modules-count,.customize-your-store .advanced-modules-select{padding-left:1.5rem}.customize-your-store .customize-your-store-advanced{min-width:0}.content-install{margin-bottom:2rem}.console{border:1px solid #ccc;font-family:'Courier New',Courier,monospace;font-weight:300;margin:1rem 0 2rem;max-height:20rem;overflow-y:auto;padding:1.5rem 2rem 2rem}.console .text-danger{color:#e22626}.console .text-success{color:#090}.console .hidden{display:none}.content-success .btn-prime{margin-top:1.5rem}.jumbo-title{font-size:3.6rem}.jumbo-title .jumbo-icon{font-size:3.8rem;margin-right:.25em;position:relative;top:.15em}@media all and (max-width:1047px){.nav{padding-bottom:5.38rem;padding-left:1.5rem;text-align:center}.nav-bar{display:inline-block;float:none;margin-right:0;vertical-align:top}.nav .btn-group,.nav-bar-outer-actions{display:inline-block;float:none;margin-top:-8.48rem;text-align:center;vertical-align:top;width:100%}.nav-bar-outer-actions{padding-right:0}.nav-bar-outer-actions .outer-actions-inner-wrap{display:inline-block}}@media all and (min-width:768px){html{margin-left:calc(100vw - 100%);margin-right:0;overflow:auto}.col-m-1,.col-m-10,.col-m-11,.col-m-12,.col-m-2,.col-m-3,.col-m-4,.col-m-5,.col-m-6,.col-m-7,.col-m-8,.col-m-9{float:left}.col-m-12{width:100%}.col-m-11{width:91.66666667%}.col-m-10{width:83.33333333%}.col-m-9{width:75%}.col-m-8{width:66.66666667%}.col-m-7{width:58.33333333%}.col-m-6{width:50%}.col-m-5{width:41.66666667%}.col-m-4{width:33.33333333%}.col-m-3{width:25%}.col-m-2{width:16.66666667%}.col-m-1{width:8.33333333%}.col-m-pull-12{right:100%}.col-m-pull-11{right:91.66666667%}.col-m-pull-10{right:83.33333333%}.col-m-pull-9{right:75%}.col-m-pull-8{right:66.66666667%}.col-m-pull-7{right:58.33333333%}.col-m-pull-6{right:50%}.col-m-pull-5{right:41.66666667%}.col-m-pull-4{right:33.33333333%}.col-m-pull-3{right:25%}.col-m-pull-2{right:16.66666667%}.col-m-pull-1{right:8.33333333%}.col-m-pull-0{right:auto}.col-m-push-12{left:100%}.col-m-push-11{left:91.66666667%}.col-m-push-10{left:83.33333333%}.col-m-push-9{left:75%}.col-m-push-8{left:66.66666667%}.col-m-push-7{left:58.33333333%}.col-m-push-6{left:50%}.col-m-push-5{left:41.66666667%}.col-m-push-4{left:33.33333333%}.col-m-push-3{left:25%}.col-m-push-2{left:16.66666667%}.col-m-push-1{left:8.33333333%}.col-m-push-0{left:auto}.col-m-offset-12{margin-left:100%}.col-m-offset-11{margin-left:91.66666667%}.col-m-offset-10{margin-left:83.33333333%}.col-m-offset-9{margin-left:75%}.col-m-offset-8{margin-left:66.66666667%}.col-m-offset-7{margin-left:58.33333333%}.col-m-offset-6{margin-left:50%}.col-m-offset-5{margin-left:41.66666667%}.col-m-offset-4{margin-left:33.33333333%}.col-m-offset-3{margin-left:25%}.col-m-offset-2{margin-left:16.66666667%}.col-m-offset-1{margin-left:8.33333333%}.col-m-offset-0{margin-left:0}}@media all and (min-width:1048px){.col-l-1,.col-l-10,.col-l-11,.col-l-12,.col-l-2,.col-l-3,.col-l-4,.col-l-5,.col-l-6,.col-l-7,.col-l-8,.col-l-9{float:left}.col-l-12{width:100%}.col-l-11{width:91.66666667%}.col-l-10{width:83.33333333%}.col-l-9{width:75%}.col-l-8{width:66.66666667%}.col-l-7{width:58.33333333%}.col-l-6{width:50%}.col-l-5{width:41.66666667%}.col-l-4{width:33.33333333%}.col-l-3{width:25%}.col-l-2{width:16.66666667%}.col-l-1{width:8.33333333%}.col-l-pull-12{right:100%}.col-l-pull-11{right:91.66666667%}.col-l-pull-10{right:83.33333333%}.col-l-pull-9{right:75%}.col-l-pull-8{right:66.66666667%}.col-l-pull-7{right:58.33333333%}.col-l-pull-6{right:50%}.col-l-pull-5{right:41.66666667%}.col-l-pull-4{right:33.33333333%}.col-l-pull-3{right:25%}.col-l-pull-2{right:16.66666667%}.col-l-pull-1{right:8.33333333%}.col-l-pull-0{right:auto}.col-l-push-12{left:100%}.col-l-push-11{left:91.66666667%}.col-l-push-10{left:83.33333333%}.col-l-push-9{left:75%}.col-l-push-8{left:66.66666667%}.col-l-push-7{left:58.33333333%}.col-l-push-6{left:50%}.col-l-push-5{left:41.66666667%}.col-l-push-4{left:33.33333333%}.col-l-push-3{left:25%}.col-l-push-2{left:16.66666667%}.col-l-push-1{left:8.33333333%}.col-l-push-0{left:auto}.col-l-offset-12{margin-left:100%}.col-l-offset-11{margin-left:91.66666667%}.col-l-offset-10{margin-left:83.33333333%}.col-l-offset-9{margin-left:75%}.col-l-offset-8{margin-left:66.66666667%}.col-l-offset-7{margin-left:58.33333333%}.col-l-offset-6{margin-left:50%}.col-l-offset-5{margin-left:41.66666667%}.col-l-offset-4{margin-left:33.33333333%}.col-l-offset-3{margin-left:25%}.col-l-offset-2{margin-left:16.66666667%}.col-l-offset-1{margin-left:8.33333333%}.col-l-offset-0{margin-left:0}}@media all and (min-width:1440px){.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9{float:left}.col-xl-12{width:100%}.col-xl-11{width:91.66666667%}.col-xl-10{width:83.33333333%}.col-xl-9{width:75%}.col-xl-8{width:66.66666667%}.col-xl-7{width:58.33333333%}.col-xl-6{width:50%}.col-xl-5{width:41.66666667%}.col-xl-4{width:33.33333333%}.col-xl-3{width:25%}.col-xl-2{width:16.66666667%}.col-xl-1{width:8.33333333%}.col-xl-pull-12{right:100%}.col-xl-pull-11{right:91.66666667%}.col-xl-pull-10{right:83.33333333%}.col-xl-pull-9{right:75%}.col-xl-pull-8{right:66.66666667%}.col-xl-pull-7{right:58.33333333%}.col-xl-pull-6{right:50%}.col-xl-pull-5{right:41.66666667%}.col-xl-pull-4{right:33.33333333%}.col-xl-pull-3{right:25%}.col-xl-pull-2{right:16.66666667%}.col-xl-pull-1{right:8.33333333%}.col-xl-pull-0{right:auto}.col-xl-push-12{left:100%}.col-xl-push-11{left:91.66666667%}.col-xl-push-10{left:83.33333333%}.col-xl-push-9{left:75%}.col-xl-push-8{left:66.66666667%}.col-xl-push-7{left:58.33333333%}.col-xl-push-6{left:50%}.col-xl-push-5{left:41.66666667%}.col-xl-push-4{left:33.33333333%}.col-xl-push-3{left:25%}.col-xl-push-2{left:16.66666667%}.col-xl-push-1{left:8.33333333%}.col-xl-push-0{left:auto}.col-xl-offset-12{margin-left:100%}.col-xl-offset-11{margin-left:91.66666667%}.col-xl-offset-10{margin-left:83.33333333%}.col-xl-offset-9{margin-left:75%}.col-xl-offset-8{margin-left:66.66666667%}.col-xl-offset-7{margin-left:58.33333333%}.col-xl-offset-6{margin-left:50%}.col-xl-offset-5{margin-left:41.66666667%}.col-xl-offset-4{margin-left:33.33333333%}.col-xl-offset-3{margin-left:25%}.col-xl-offset-2{margin-left:16.66666667%}.col-xl-offset-1{margin-left:8.33333333%}.col-xl-offset-0{margin-left:0}}@media all and (max-width:767px){.list-definition>dt{float:none}.list-definition>dd{margin-left:0}.form-row .form-label{text-align:left}.form-row .form-label.required:after{position:static}.nav{padding-bottom:0;padding-left:0;padding-right:0}.nav-bar-outer-actions{margin-top:0}.nav-bar{display:block;margin-bottom:0;margin-left:auto;margin-right:auto;width:30.9rem}.nav-bar:before{display:none}.nav-bar>li{float:left;min-height:9rem}.nav-bar>li:after{display:none}.nav-bar>li:nth-child(4n){clear:both}.nav-bar a{line-height:1.4}.tooltip{display:none!important}.readiness-check-content{margin-right:2rem}.form-el-insider,.form-el-insider-wrap,.page-web-configuration .form-el-insider-input,.page-web-configuration .form-el-insider-input .form-el-input{display:block;width:100%}}@media all and (max-width:479px){.nav-bar{width:23.175rem}.nav-bar>li{width:7.725rem}.nav .btn-group .btn-wrap-try-again,.nav-bar-outer-actions .btn-wrap-try-again{clear:both;display:block;float:none;margin-left:auto;margin-right:auto;margin-top:1rem;padding-top:1rem}} \ No newline at end of file +html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;font-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{box-sizing:border-box}:focus{box-shadow:none;outline:0}.keyfocus :focus{box-shadow:0 0 0 1px #008bdb}embed,img,object,video{max-width:100%}.abs-clearer:after,.form-row:after,.header:after,.nav:after,.row:after{content:"";display:table;clear:both}.ng-cloak{display:none!important}.hide.hide{display:none}.show.show{display:block}.text-center{text-align:center}.text-right{text-align:right}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/light/opensans-300.eot);src:url(../../pub/fonts/opensans/light/opensans-300.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/light/opensans-300.woff2) format('woff2'),url(../../pub/fonts/opensans/light/opensans-300.woff) format('woff'),url(../../pub/fonts/opensans/light/opensans-300.ttf) format('truetype'),url('../../pub/fonts/opensans/light/opensans-300.svg#Open Sans') format('svg');font-weight:300;font-style:normal}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/regular/opensans-400.eot);src:url(../../pub/fonts/opensans/regular/opensans-400.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/regular/opensans-400.woff2) format('woff2'),url(../../pub/fonts/opensans/regular/opensans-400.woff) format('woff'),url(../../pub/fonts/opensans/regular/opensans-400.ttf) format('truetype'),url('../../pub/fonts/opensans/regular/opensans-400.svg#Open Sans') format('svg');font-weight:400;font-style:normal}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/semibold/opensans-600.eot);src:url(../../pub/fonts/opensans/semibold/opensans-600.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/semibold/opensans-600.woff2) format('woff2'),url(../../pub/fonts/opensans/semibold/opensans-600.woff) format('woff'),url(../../pub/fonts/opensans/semibold/opensans-600.ttf) format('truetype'),url('../../pub/fonts/opensans/semibold/opensans-600.svg#Open Sans') format('svg');font-weight:600;font-style:normal}@font-face{font-family:'Open Sans';src:url(../../pub/fonts/opensans/bold/opensans-700.eot);src:url(../../pub/fonts/opensans/bold/opensans-700.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/opensans/bold/opensans-700.woff2) format('woff2'),url(../../pub/fonts/opensans/bold/opensans-700.woff) format('woff'),url(../../pub/fonts/opensans/bold/opensans-700.ttf) format('truetype'),url('../../pub/fonts/opensans/bold/opensans-700.svg#Open Sans') format('svg');font-weight:700;font-style:normal}html{font-size:62.5%}body{color:#303030;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:1.4rem;font-weight:400;line-height:1.4}h1,h2,h3,h4,h5,h6{font-weight:400;margin-top:0}p{margin:0 0 1em}a{color:#008bdb;text-decoration:none}a:hover{color:#0fa7ff;text-decoration:underline}@font-face{font-family:Icons;src:url(../../pub/fonts/icons/icons.eot);src:url(../../pub/fonts/icons/icons.eot?#iefix) format('embedded-opentype'),url(../../pub/fonts/icons/icons.woff2) format('woff2'),url(../../pub/fonts/icons/icons.woff) format('woff'),url(../../pub/fonts/icons/icons.ttf) format('truetype'),url(../../pub/fonts/icons/icons.svg#Icons) format('svg');font-weight:400;font-style:normal}[class*=icon-]{display:inline-block;line-height:1}[class*=icon-]:after{font-family:Icons}.icon-success-thick:after{content:'\e600'}.icon-success:after{content:'\e601'}.icon-collapse:after{content:'\e602'}.icon-failed-thick:after{content:'\e603'}.icon-failed:after{content:'\e604'}.icon-expand:after{content:'\e605'}.icon-warning:after{content:'\e606'}.icon-failed-round,.icon-success-round{border-radius:100%;color:#fff;font-size:2.5rem;height:1em;position:relative;text-align:center;width:1em}.icon-failed-round:after,.icon-success-round:after{bottom:0;font-size:.8em;left:0;position:absolute;right:0;top:.15em}.icon-success-round{background-color:#79a22e}.icon-success-round:after{content:'\e600'}.icon-failed-round{background-color:#e22626}.icon-failed-round:after{content:'\e603'}dl,ol,ul{margin-top:0}.list{margin-bottom:1em;padding-left:0}.list>li{display:block;margin-bottom:.75em;position:relative}.list>li>.icon-failed,.list>li>.icon-success{font-size:1.6em;left:-.1em;position:absolute;top:0}.list>li>.icon-success{color:#79a22e}.list>li>.icon-failed{color:#e22626}.list-item-failed,.list-item-icon,.list-item-success{padding-left:3.5rem}.list-item-failed:before,.list-item-success:before{font-family:Icons;font-size:1.6em;left:-.1em;position:absolute;top:-.2em}.list-item-success:before{color:#79a22e;content:'\e601'}.list-item-failed:before{color:#e22626;content:'\e604'}.list-definition{margin:0 0 3rem;padding:0}.list-definition>dt{clear:left;float:left}.list-definition>dd{margin-bottom:1em;margin-left:20rem}.btn-wrap{margin:0 auto}.btn-wrap .btn{width:100%}.btn{background:#e3e3e3;border:none;color:#514943;display:inline-block;font-size:1.6rem;font-weight:600;padding:.45em .5em;text-align:center}.btn:hover{background-color:#dbdbdb;color:#514943;text-decoration:none}.btn:active{background-color:#d6d6d6}.btn.disabled,.btn[disabled]{cursor:default;opacity:.5;pointer-events:none}.ie9 .btn.disabled,.ie9 .btn[disabled]{background-color:#f0f0f0;opacity:1;text-shadow:none}.btn-large{padding:.75em 1.25em}.btn-link{background-color:transparent;border:none;color:#008bdb;font-family:1.6rem;font-size:1.5rem}.btn-link:hover{background-color:transparent;color:#0fa7ff}.btn-prime{background-color:#eb5202;color:#fff;text-shadow:1px 1px 0 rgba(0,0,0,.25)}.btn-prime:hover{background-color:#f65405;background-repeat:repeat-x;background-image:-webkit-linear-gradient(left,color-stop(#e04f00 0),color-stop(#f65405 100%));background-image:linear-gradient(to right,#e04f00 0,#f65405 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#e04f00', endColorstr='#f65405', GradientType=1);color:#fff}.btn-prime:active{background-color:#e04f00;background-repeat:repeat-x;background-image:-webkit-linear-gradient(left,color-stop(#f65405 0),color-stop(#e04f00 100%));background-image:linear-gradient(to right,#f65405 0,#e04f00 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f65405', endColorstr='#e04f00', GradientType=1)}.ie9 .btn-prime.disabled,.ie9 .btn-prime[disabled]{background-color:#fd6e23}.ie9 .btn-prime.disabled:active,.ie9 .btn-prime.disabled:hover,.ie9 .btn-prime[disabled]:active,.ie9 .btn-prime[disabled]:hover{background-color:#fd6e23;filter:none}.btn-secondary{background-color:#514943;color:#fff}.btn-secondary:hover{background-color:#5f564f;color:#fff}.btn-secondary:active{background-color:#574e48}.ie9 .btn-secondary.disabled,.ie9 .btn-secondary[disabled]{background-color:#514943}.ie9 .btn-secondary.disabled:active,.ie9 .btn-secondary.disabled:hover,.ie9 .btn-secondary[disabled]:active,.ie9 .btn-secondary[disabled]:hover{background-color:#514943;filter:none}[class*=btn-wrap-triangle]{overflow:hidden;position:relative}[class*=btn-wrap-triangle] .btn:after{border-style:solid;content:'';height:0;position:absolute;top:0;width:0}.btn-wrap-triangle-right{display:inline-block;padding-right:1.74rem;position:relative}.btn-wrap-triangle-right .btn{text-indent:.92rem}.btn-wrap-triangle-right .btn:after{border-color:transparent transparent transparent #e3e3e3;border-width:1.84rem 0 1.84rem 1.84rem;left:100%;margin-left:-1.74rem}.btn-wrap-triangle-right .btn:hover:after{border-left-color:#dbdbdb}.btn-wrap-triangle-right .btn:active:after{border-left-color:#d6d6d6}.btn-wrap-triangle-right .btn:not(.disabled):active,.btn-wrap-triangle-right .btn:not([disabled]):active{left:1px}.ie9 .btn-wrap-triangle-right .btn.disabled:after,.ie9 .btn-wrap-triangle-right .btn[disabled]:after{border-color:transparent transparent transparent #f0f0f0}.ie9 .btn-wrap-triangle-right .btn.disabled:active:after,.ie9 .btn-wrap-triangle-right .btn.disabled:hover:after,.ie9 .btn-wrap-triangle-right .btn[disabled]:active:after,.ie9 .btn-wrap-triangle-right .btn[disabled]:hover:after{border-left-color:#f0f0f0}.btn-wrap-triangle-right .btn-prime:after{border-color:transparent transparent transparent #eb5202}.btn-wrap-triangle-right .btn-prime:hover:after{border-left-color:#f65405}.btn-wrap-triangle-right .btn-prime:active:after{border-left-color:#e04f00}.btn-wrap-triangle-right .btn-prime:not(.disabled):active,.btn-wrap-triangle-right .btn-prime:not([disabled]):active{left:1px}.ie9 .btn-wrap-triangle-right .btn-prime.disabled:after,.ie9 .btn-wrap-triangle-right .btn-prime[disabled]:after{border-color:transparent transparent transparent #fd6e23}.ie9 .btn-wrap-triangle-right .btn-prime.disabled:active:after,.ie9 .btn-wrap-triangle-right .btn-prime.disabled:hover:after,.ie9 .btn-wrap-triangle-right .btn-prime[disabled]:active:after,.ie9 .btn-wrap-triangle-right .btn-prime[disabled]:hover:after{border-left-color:#fd6e23}.btn-wrap-triangle-left{display:inline-block;padding-left:1.74rem}.btn-wrap-triangle-left .btn{text-indent:-.92rem}.btn-wrap-triangle-left .btn:after{border-color:transparent #e3e3e3 transparent transparent;border-width:1.84rem 1.84rem 1.84rem 0;margin-right:-1.74rem;right:100%}.btn-wrap-triangle-left .btn:hover:after{border-right-color:#dbdbdb}.btn-wrap-triangle-left .btn:active:after{border-right-color:#d6d6d6}.btn-wrap-triangle-left .btn:not(.disabled):active,.btn-wrap-triangle-left .btn:not([disabled]):active{right:1px}.ie9 .btn-wrap-triangle-left .btn.disabled:after,.ie9 .btn-wrap-triangle-left .btn[disabled]:after{border-color:transparent #f0f0f0 transparent transparent}.ie9 .btn-wrap-triangle-left .btn.disabled:active:after,.ie9 .btn-wrap-triangle-left .btn.disabled:hover:after,.ie9 .btn-wrap-triangle-left .btn[disabled]:active:after,.ie9 .btn-wrap-triangle-left .btn[disabled]:hover:after{border-right-color:#f0f0f0}.btn-wrap-triangle-left .btn-prime:after{border-color:transparent #eb5202 transparent transparent}.btn-wrap-triangle-left .btn-prime:hover:after{border-right-color:#e04f00}.btn-wrap-triangle-left .btn-prime:active:after{border-right-color:#f65405}.btn-wrap-triangle-left .btn-prime:not(.disabled):active,.btn-wrap-triangle-left .btn-prime:not([disabled]):active{right:1px}.ie9 .btn-wrap-triangle-left .btn-prime.disabled:after,.ie9 .btn-wrap-triangle-left .btn-prime[disabled]:after{border-color:transparent #fd6e23 transparent transparent}.ie9 .btn-wrap-triangle-left .btn-prime.disabled:active:after,.ie9 .btn-wrap-triangle-left .btn-prime.disabled:hover:after,.ie9 .btn-wrap-triangle-left .btn-prime[disabled]:active:after,.ie9 .btn-wrap-triangle-left .btn-prime[disabled]:hover:after{border-right-color:#fd6e23}.btn-expand{background-color:transparent;border:none;color:#303030;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:1.4rem;font-weight:700;padding:0;position:relative}.btn-expand.expanded:after{border-color:transparent transparent #303030;border-width:0 .285em .36em}.btn-expand.expanded:hover:after{border-color:transparent transparent #3d3d3d}.btn-expand:hover{background-color:transparent;border:none;color:#3d3d3d}.btn-expand:hover:after{border-color:#3d3d3d transparent transparent}.btn-expand:after{border-color:#303030 transparent transparent;border-style:solid;border-width:.36em .285em 0;content:'';height:0;left:100%;margin-left:.5em;margin-top:-.18em;position:absolute;top:50%;width:0}[class*=col-] .form-el-input,[class*=col-] .form-el-select{width:100%}.form-fieldset{border:none;margin:0 0 1em;padding:0}.form-row{margin-bottom:2.2rem}.form-row .form-row{margin-bottom:.4rem}.form-row .form-label{display:block;font-weight:600;padding:.6rem 2.1em 0 0;text-align:right}.form-row .form-label.required{position:relative}.form-row .form-label.required:after{color:#eb5202;content:'*';font-size:1.15em;position:absolute;right:.7em;top:.5em}.form-row .form-el-checkbox+.form-label:before,.form-row .form-el-radio+.form-label:before{top:.7rem}.form-row .form-el-checkbox+.form-label:after,.form-row .form-el-radio+.form-label:after{top:1.1rem}input:not([disabled]):focus,textarea:not([disabled]):focus{box-shadow:none}.form-el-input{border:1px solid #adadad;border-radius:2px;color:#303030;padding:.35em .55em .5em}.form-el-input:hover{border-color:#949494}.form-el-input:focus{border-color:#008bdb}.form-label{margin-bottom:.5em}[class*=form-label][for]{cursor:pointer}.form-el-insider-wrap{display:table;width:100%}.form-el-insider-input{display:table-cell;width:100%}.form-el-insider{border-radius:2px;display:table-cell;vertical-align:top;padding:.43em .55em .5em 0}.form-legend,.form-legend-expand,.form-legend-light{display:block;margin:0}.form-legend,.form-legend-expand{margin-bottom:2.5em;padding-top:1.5em;font-weight:600;font-size:1.25em}.form-legend{width:100%;border-top:1px solid #ccc}.form-legend-light{margin-bottom:1.5em;font-size:1em}.form-legend-expand{transition:opacity .2s linear;cursor:pointer}.form-legend-expand:hover{opacity:.85}.form-legend-expand.expanded:after{content:'\e602'}.form-legend-expand:after{margin-left:.5em;font-weight:400;font-size:1.15em;font-family:Icons;content:'\e605';vertical-align:sub}.form-el-checkbox,.form-el-radio{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.form-el-checkbox.disabled+.form-label,.form-el-checkbox.disabled+.form-label:before,.form-el-checkbox[disabled]+.form-label,.form-el-checkbox[disabled]+.form-label:before,.form-el-radio.disabled+.form-label,.form-el-radio.disabled+.form-label:before,.form-el-radio[disabled]+.form-label,.form-el-radio[disabled]+.form-label:before{cursor:default;opacity:.5;pointer-events:none}.form-el-checkbox:not(.disabled)+.form-label:hover:before,.form-el-checkbox:not([disabled])+.form-label:hover:before,.form-el-radio:not(.disabled)+.form-label:hover:before,.form-el-radio:not([disabled])+.form-label:hover:before{border-color:#514943}.form-el-checkbox+.form-label,.form-el-radio+.form-label{font-weight:400;padding-left:2em;padding-right:0;position:relative;text-align:left;transition:border-color .1s linear}.form-el-checkbox+.form-label:before,.form-el-radio+.form-label:before{border:1px solid;content:'';left:0;position:absolute;top:.1rem;transition:border-color .1s linear}.form-el-checkbox+.form-label:before{border-color:#adadad;border-radius:2px;height:1.4rem;line-height:1;width:1.4rem}.form-el-checkbox:checked+.form-label::before{content:'\e600';font-family:Icons}.form-el-radio+.form-label:before{background-color:#fff;border:1px solid #adadad;border-radius:100%;height:1.6rem;width:1.6rem}.form-el-radio+.form-label:after{background:0 0;border:.5rem solid transparent;border-radius:100%;content:'';height:0;left:.4rem;position:absolute;top:.5rem;transition:background .3s linear;width:0}.form-el-radio:checked+.form-label{cursor:default}.form-el-radio:checked+.form-label:after{border-color:#514943}.form-select-label{border:1px solid #adadad;border-radius:2px;color:#303030;cursor:pointer;display:block;overflow:hidden;position:relative}.form-select-label:hover,.form-select-label:hover:after{border-color:#949494}.form-select-label:active,.form-select-label:active:after,.form-select-label:focus,.form-select-label:focus:after{border-color:#008bdb}.form-select-label:after{background:#e3e3e3;border-left:1px solid #adadad;bottom:0;content:'';position:absolute;right:0;top:0;width:2.36em;z-index:-2}.ie9 .form-select-label:after{display:none}.form-select-label:before{border-color:#303030 transparent transparent;border-style:solid;border-width:5px 4px 0;content:'';height:0;margin-right:-4px;margin-top:-2.5px;position:absolute;right:1.18em;top:50%;width:0;z-index:-1}.ie9 .form-select-label:before{display:none}.form-select-label .form-el-select{background:0 0;border:none;border-radius:0;content:'';display:block;margin:0;padding:.35em calc(2.36em + 10%) .5em .55em;width:110%}.ie9 .form-select-label .form-el-select{padding-right:.55em;width:100%}.form-el-select{background:#fff;border:1px solid #adadad;border-radius:2px;color:#303030;display:block;padding:.35em .55em}.multiselect-custom{position:relative;height:45.2rem;border:1px solid #adadad;overflow:auto;margin:0 0 1.5rem}.multiselect-custom ul{margin:0;padding:0;list-style:none;min-width:29rem}.multiselect-custom .item{padding:1rem 1.4rem}.multiselect-custom .selected{background-color:#e0f6fe}.multiselect-custom .form-label{margin-bottom:0}[class*=form-el-].invalid{border-color:#e22626}[class*=form-el-].invalid+.error-container{display:block}.error-container{background-color:#fffbbb;border:1px solid #ee7d7d;border-radius:2px;color:#514943;display:none;font-size:1.19rem;margin-top:.2rem;padding:.4235em .6655em .605em}.check-result-message{margin-left:.5em;min-height:3.68rem;-webkit-align-items:center;-ms-align-items:center;align-items:center;display:-webkit-flex;display:-ms-flexbox;display:flex}.check-result-text{margin-left:.5em}.pseudo-table{display:table}.pseudo-td{display:table-cell}.messages{margin:0 0 2rem}.message{background:#fffbbb;border:none;border-radius:0;color:#333;font-size:14px;margin:0 0 1px;padding:1.8rem 4rem 1.8rem 5.5rem;position:relative;text-shadow:none}.message:before{background:0 0;border:0;color:#007bdb;content:'\e61a';font-family:Icons;font-size:1.9rem;font-style:normal;font-weight:400;height:auto;left:1.9rem;line-height:inherit;margin-top:-1.3rem;position:absolute;speak:none;text-shadow:none;top:50%;width:auto}.message-notice:before{color:#007bdb;content:'\e61a'}.message-warning:before{color:#eb5202;content:'\e623'}.message-error{background:#fcc}.message-error:before{color:#e22626;content:'\e632';font-size:1.5rem;left:2.2rem;margin-top:-1rem}.message-success:before{color:#79a22e;content:'\e62d'}.message-spinner:before{display:none}.message-spinner .spinner{font-size:2.5rem;left:1.5rem;position:absolute;top:1.5rem}.message-in-rating-edit{margin-left:1.8rem;margin-right:1.8rem}.message{margin-bottom:3rem}.container{display:block;margin:0 auto 4rem;max-width:100rem;padding:0 2rem}.row{margin-left:0;margin-right:0}.col-l-1,.col-l-10,.col-l-11,.col-l-12,.col-l-2,.col-l-3,.col-l-4,.col-l-5,.col-l-6,.col-l-7,.col-l-8,.col-l-9,.col-m-1,.col-m-10,.col-m-11,.col-m-12,.col-m-2,.col-m-3,.col-m-4,.col-m-5,.col-m-6,.col-m-7,.col-m-8,.col-m-9,.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{min-height:1px;padding-left:0;padding-right:0;position:relative}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}.nav{background-color:#f8f8f8;border-bottom:1px solid #e3e3e3;border-top:1px solid #e3e3e3;display:none;padding:2.2rem 1.5rem 0 0}.nav .btn-group,.nav-bar-outer-actions{float:right;margin-bottom:1.7rem}.nav .btn-group .btn-wrap,.nav-bar-outer-actions .btn-wrap{float:right;margin-left:.5rem;margin-right:.5rem}.nav-bar-outer-actions{margin-top:-10.6rem;padding-right:1.5rem}.btn-wrap-try-again{width:9.5rem}.btn-wrap-next,.btn-wrap-prev{width:8.5rem}.nav-bar{counter-reset:i;float:left;margin:0 1rem 1.7rem 0;padding:0;position:relative;white-space:nowrap}.nav-bar:before{background-color:#d4d4d4;background-repeat:repeat-x;background-image:-webkit-linear-gradient(top,#d1d1d1 0,#d4d4d4 100%);background-image:linear-gradient(to bottom,#d1d1d1 0,#d4d4d4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d1d1d1', endColorstr='#d4d4d4', GradientType=0);border-bottom:1px solid #d9d9d9;border-top:1px solid #bfbfbf;content:'';height:.8rem;left:5.15rem;position:absolute;right:5.15rem;top:.7rem}.nav-bar>li{display:inline-block;font-size:0;position:relative;vertical-align:top;width:10.3rem}.nav-bar>li:first-child:after{display:none}.nav-bar>li:after{background-color:#514943;content:'';height:.5rem;left:calc(-50% + .25rem);position:absolute;right:calc(50% + .7rem);top:.9rem}.nav-bar>li.disabled:before{bottom:0;content:'';left:0;position:absolute;right:0;top:0;z-index:1}.nav-bar>li.active~li:after{display:none}.nav-bar>li.active~li a:after{background-color:transparent;border-color:transparent;color:#a6a6a6}.nav-bar>li.active a{color:#000}.nav-bar>li.active a:hover{cursor:default}.nav-bar>li.active a:after{background-color:#fff;content:''}.nav-bar a{color:#514943;display:block;font-size:1.2rem;font-weight:600;line-height:1.2;overflow:hidden;padding:3rem .5em 0;position:relative;text-align:center;text-overflow:ellipsis}.nav-bar a:hover{text-decoration:none}.nav-bar a:after{background-color:#514943;border:.4rem solid #514943;border-radius:100%;color:#fff;content:counter(i);counter-increment:i;height:.7rem;left:50%;line-height:.6;margin-left:-.8rem;position:absolute;right:auto;text-align:center;top:.4rem;width:.7rem}.nav-bar a:before{background-color:#d6d6d6;border:1px solid transparent;border-bottom-color:#d9d9d9;border-radius:100%;border-top-color:#bfbfbf;content:'';height:2.1rem;left:50%;line-height:1;margin-left:-1.2rem;position:absolute;top:0;width:2.1rem}.tooltip{display:block;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;font-size:1.19rem;font-weight:400;line-height:1.4;opacity:0;position:absolute;visibility:visible;z-index:10}.tooltip.in{opacity:.9}.tooltip.top{margin-top:-4px;padding:8px 0}.tooltip.right{margin-left:4px;padding:0 8px}.tooltip.bottom{margin-top:4px;padding:8px 0}.tooltip.left{margin-left:-4px;padding:0 8px}.tooltip-inner{background-color:#fff;border:1px solid #adadad;border-radius:0;box-shadow:1px 1px 1px #ccc;color:#41362f;max-width:20rem;padding:.5em 1em;text-decoration:none}.tooltip-arrow,.tooltip-arrow:after{border:solid transparent;height:0;position:absolute;width:0}.tooltip-arrow:after{content:'';position:absolute}.tooltip.top .tooltip-arrow,.tooltip.top .tooltip-arrow:after{border-top-color:#949494;border-width:8px 8px 0;bottom:0;left:50%;margin-left:-8px}.tooltip.top-left .tooltip-arrow,.tooltip.top-left .tooltip-arrow:after{border-top-color:#949494;border-width:8px 8px 0;bottom:0;margin-bottom:-8px;right:8px}.tooltip.top-right .tooltip-arrow,.tooltip.top-right .tooltip-arrow:after{border-top-color:#949494;border-width:8px 8px 0;bottom:0;left:8px;margin-bottom:-8px}.tooltip.right .tooltip-arrow,.tooltip.right .tooltip-arrow:after{border-right-color:#949494;border-width:8px 8px 8px 0;left:1px;margin-top:-8px;top:50%}.tooltip.right .tooltip-arrow:after{border-right-color:#fff;border-width:6px 7px 6px 0;margin-left:0;margin-top:-6px}.tooltip.left .tooltip-arrow,.tooltip.left .tooltip-arrow:after{border-left-color:#949494;border-width:8px 0 8px 8px;margin-top:-8px;right:0;top:50%}.tooltip.bottom .tooltip-arrow,.tooltip.bottom .tooltip-arrow:after{border-bottom-color:#949494;border-width:0 8px 8px;left:50%;margin-left:-8px;top:0}.tooltip.bottom-left .tooltip-arrow,.tooltip.bottom-left .tooltip-arrow:after{border-bottom-color:#949494;border-width:0 8px 8px;margin-top:-8px;right:8px;top:0}.tooltip.bottom-right .tooltip-arrow,.tooltip.bottom-right .tooltip-arrow:after{border-bottom-color:#949494;border-width:0 8px 8px;left:8px;margin-top:-8px;top:0}.password-strength{display:block;margin:0 -.3rem 1em;white-space:nowrap}.password-strength.password-strength-too-short .password-strength-item:first-child,.password-strength.password-strength-weak .password-strength-item:first-child,.password-strength.password-strength-weak .password-strength-item:first-child+.password-strength-item{background-color:#e22626}.password-strength.password-strength-fair .password-strength-item:first-child,.password-strength.password-strength-fair .password-strength-item:first-child+.password-strength-item,.password-strength.password-strength-fair .password-strength-item:first-child+.password-strength-item+.password-strength-item{background-color:#ef672f}.password-strength.password-strength-good .password-strength-item:first-child,.password-strength.password-strength-good .password-strength-item:first-child+.password-strength-item,.password-strength.password-strength-good .password-strength-item:first-child+.password-strength-item+.password-strength-item,.password-strength.password-strength-good .password-strength-item:first-child+.password-strength-item+.password-strength-item+.password-strength-item,.password-strength.password-strength-strong .password-strength-item{background-color:#79a22e}.password-strength .password-strength-item{background-color:#ccc;display:inline-block;font-size:0;height:1.4rem;margin-right:.3rem;width:calc(20% - .6rem)}@-webkit-keyframes progress-bar-stripes{from{background-position:4rem 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:4rem 0}to{background-position:0 0}}.progress{background-color:#fafafa;border:1px solid #ccc;height:3rem;margin-bottom:3rem;overflow:hidden}.progress-bar{background-color:#79a22e;color:#fff;float:left;font-size:1.19rem;height:100%;line-height:3rem;text-align:center;transition:width .6s ease;width:0}.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.spinner{display:inline-block;font-size:4rem;height:1em;margin-right:1.5rem;position:relative;width:1em}@-moz-keyframes fade{0%{background-color:#514943}100%{background-color:#fff}}@-webkit-keyframes fade{0%{background-color:#514943}100%{background-color:#fff}}@-ms-keyframes fade{0%{background-color:#514943}100%{background-color:#fff}}@keyframes fade{0%{background-color:#514943}100%{background-color:#fff}}.spinner>span:nth-child(1){-webkit-animation-delay:.27s;-moz-animation-delay:.27s;-ms-animation-delay:.27s;animation-delay:.27s;-webkit-transform:rotate(-315deg);-moz-transform:rotate(-315deg);-ms-transform:rotate(-315deg);transform:rotate(-315deg)}.spinner>span:nth-child(2){-webkit-animation-delay:.36s;-moz-animation-delay:.36s;-ms-animation-delay:.36s;animation-delay:.36s;-webkit-transform:rotate(-270deg);-moz-transform:rotate(-270deg);-ms-transform:rotate(-270deg);transform:rotate(-270deg)}.spinner>span:nth-child(3){-webkit-animation-delay:.45s;-moz-animation-delay:.45s;-ms-animation-delay:.45s;animation-delay:.45s;-webkit-transform:rotate(-225deg);-moz-transform:rotate(-225deg);-ms-transform:rotate(-225deg);transform:rotate(-225deg)}.spinner>span:nth-child(4){-webkit-animation-delay:.54s;-moz-animation-delay:.54s;-ms-animation-delay:.54s;animation-delay:.54s;-webkit-transform:rotate(-180deg);-moz-transform:rotate(-180deg);-ms-transform:rotate(-180deg);transform:rotate(-180deg)}.spinner>span:nth-child(5){-webkit-animation-delay:.63s;-moz-animation-delay:.63s;-ms-animation-delay:.63s;animation-delay:.63s;-webkit-transform:rotate(-135deg);-moz-transform:rotate(-135deg);-ms-transform:rotate(-135deg);transform:rotate(-135deg)}.spinner>span:nth-child(6){-webkit-animation-delay:.72s;-moz-animation-delay:.72s;-ms-animation-delay:.72s;animation-delay:.72s;-webkit-transform:rotate(-90deg);-moz-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg)}.spinner>span:nth-child(7){-webkit-animation-delay:.81s;-moz-animation-delay:.81s;-ms-animation-delay:.81s;animation-delay:.81s;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.spinner>span:nth-child(8){-webkit-animation-delay:.9;-moz-animation-delay:.9;-ms-animation-delay:.9;animation-delay:.9;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg)}.spinner>span{-webkit-animation-direction:linear;-moz-animation-direction:linear;-ms-animation-direction:linear;animation-direction:linear;-webkit-animation-duration:.72s;-moz-animation-duration:.72s;-ms-animation-duration:.72s;animation-duration:.72s;-webkit-animation-iteration-count:infinite;-moz-animation-iteration-count:infinite;-ms-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:fade;-moz-animation-name:fade;-ms-animation-name:fade;animation-name:fade;-webkit-transform:scale(0.4);-moz-transform:scale(0.4);-ms-transform:scale(0.4);transform:scale(0.4);background-color:#fff;border-radius:6px;clip:rect(0 .28571429em .1em 0);height:.1em;margin-top:.5em;position:absolute;width:1em}.ie9 .spinner{background:url(../../pub/images/ajax-loader.gif) center no-repeat}.ie9 .spinner>span{display:none}.main{padding-bottom:2rem;padding-top:3rem}.header{display:none}.header .logo{float:left;height:4.1rem;width:3.5rem}.header-title{font-size:2.8rem;letter-spacing:.02em;margin:2.5rem 0 3.5rem 5rem}.page-title{font-size:2rem;margin-bottom:1.3em}.accent-box{margin-bottom:2rem}.accent-box .btn-prime{margin-top:1.5rem}.page-landing{margin:7.6% auto 0;max-width:44rem;text-align:center}.page-landing .logo{height:5.6rem;margin-bottom:2rem;width:19.2rem}.page-landing .text-version{margin-bottom:3rem}.page-landing .text-welcome{margin-bottom:6.5rem}.page-landing .text-terms{margin-bottom:2.5rem;text-align:center}.page-landing .btn-submit{margin-bottom:20px}.page-license .license-text{margin-bottom:2rem}.page-license .page-license-footer{text-align:right}.rediness-check-item{margin-bottom:4rem}.readiness-check-title{font-size:1.4rem;font-weight:700;margin-bottom:.1rem;margin-left:7.5rem}.readiness-check-content{margin-left:7.5rem;margin-right:22rem}.readiness-check-content .readiness-check-title{margin-left:0}.readiness-check-content .list{margin-top:-.3rem}.rediness-check-side{float:right;padding-left:2.4rem;width:22rem}.rediness-check-side .side-title{margin-bottom:0}.readiness-check-icon{float:left;margin-left:2rem;margin-top:.7rem}.page-web-configuration .form-el-insider-wrap{width:auto}.page-web-configuration .form-el-insider{width:15.4rem}.page-web-configuration .form-el-insider-input .form-el-input{width:16.5rem}.customize-your-store .customize-your-store-default .legend{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.customize-your-store .advanced-modules-count,.customize-your-store .advanced-modules-select{padding-left:1.5rem}.customize-your-store .customize-your-store-advanced{min-width:0}.customize-your-store .message-error:before{margin-top:0;top:1.8rem}.customize-your-store .message-error a{color:#333;text-decoration:underline}.customize-your-store .message-error .form-label:before{background:#fff}.content-install{margin-bottom:2rem}.console{border:1px solid #ccc;font-family:'Courier New',Courier,monospace;font-weight:300;margin:1rem 0 2rem;max-height:20rem;overflow-y:auto;padding:1.5rem 2rem 2rem}.console .text-danger{color:#e22626}.console .text-success{color:#090}.console .hidden{display:none}.content-success .btn-prime{margin-top:1.5rem}.jumbo-title{font-size:3.6rem}.jumbo-title .jumbo-icon{font-size:3.8rem;margin-right:.25em;position:relative;top:.15em}@media all and (max-width:1047px){.nav{padding-bottom:5.38rem;padding-left:1.5rem;text-align:center}.nav-bar{display:inline-block;float:none;margin-right:0;vertical-align:top}.nav .btn-group,.nav-bar-outer-actions{display:inline-block;float:none;margin-top:-8.48rem;text-align:center;vertical-align:top;width:100%}.nav-bar-outer-actions{padding-right:0}.nav-bar-outer-actions .outer-actions-inner-wrap{display:inline-block}}@media all and (min-width:768px){html{margin-left:calc(100vw - 100%);margin-right:0;overflow:auto}.col-m-1,.col-m-10,.col-m-11,.col-m-12,.col-m-2,.col-m-3,.col-m-4,.col-m-5,.col-m-6,.col-m-7,.col-m-8,.col-m-9{float:left}.col-m-12{width:100%}.col-m-11{width:91.66666667%}.col-m-10{width:83.33333333%}.col-m-9{width:75%}.col-m-8{width:66.66666667%}.col-m-7{width:58.33333333%}.col-m-6{width:50%}.col-m-5{width:41.66666667%}.col-m-4{width:33.33333333%}.col-m-3{width:25%}.col-m-2{width:16.66666667%}.col-m-1{width:8.33333333%}.col-m-pull-12{right:100%}.col-m-pull-11{right:91.66666667%}.col-m-pull-10{right:83.33333333%}.col-m-pull-9{right:75%}.col-m-pull-8{right:66.66666667%}.col-m-pull-7{right:58.33333333%}.col-m-pull-6{right:50%}.col-m-pull-5{right:41.66666667%}.col-m-pull-4{right:33.33333333%}.col-m-pull-3{right:25%}.col-m-pull-2{right:16.66666667%}.col-m-pull-1{right:8.33333333%}.col-m-pull-0{right:auto}.col-m-push-12{left:100%}.col-m-push-11{left:91.66666667%}.col-m-push-10{left:83.33333333%}.col-m-push-9{left:75%}.col-m-push-8{left:66.66666667%}.col-m-push-7{left:58.33333333%}.col-m-push-6{left:50%}.col-m-push-5{left:41.66666667%}.col-m-push-4{left:33.33333333%}.col-m-push-3{left:25%}.col-m-push-2{left:16.66666667%}.col-m-push-1{left:8.33333333%}.col-m-push-0{left:auto}.col-m-offset-12{margin-left:100%}.col-m-offset-11{margin-left:91.66666667%}.col-m-offset-10{margin-left:83.33333333%}.col-m-offset-9{margin-left:75%}.col-m-offset-8{margin-left:66.66666667%}.col-m-offset-7{margin-left:58.33333333%}.col-m-offset-6{margin-left:50%}.col-m-offset-5{margin-left:41.66666667%}.col-m-offset-4{margin-left:33.33333333%}.col-m-offset-3{margin-left:25%}.col-m-offset-2{margin-left:16.66666667%}.col-m-offset-1{margin-left:8.33333333%}.col-m-offset-0{margin-left:0}}@media all and (min-width:1048px){.col-l-1,.col-l-10,.col-l-11,.col-l-12,.col-l-2,.col-l-3,.col-l-4,.col-l-5,.col-l-6,.col-l-7,.col-l-8,.col-l-9{float:left}.col-l-12{width:100%}.col-l-11{width:91.66666667%}.col-l-10{width:83.33333333%}.col-l-9{width:75%}.col-l-8{width:66.66666667%}.col-l-7{width:58.33333333%}.col-l-6{width:50%}.col-l-5{width:41.66666667%}.col-l-4{width:33.33333333%}.col-l-3{width:25%}.col-l-2{width:16.66666667%}.col-l-1{width:8.33333333%}.col-l-pull-12{right:100%}.col-l-pull-11{right:91.66666667%}.col-l-pull-10{right:83.33333333%}.col-l-pull-9{right:75%}.col-l-pull-8{right:66.66666667%}.col-l-pull-7{right:58.33333333%}.col-l-pull-6{right:50%}.col-l-pull-5{right:41.66666667%}.col-l-pull-4{right:33.33333333%}.col-l-pull-3{right:25%}.col-l-pull-2{right:16.66666667%}.col-l-pull-1{right:8.33333333%}.col-l-pull-0{right:auto}.col-l-push-12{left:100%}.col-l-push-11{left:91.66666667%}.col-l-push-10{left:83.33333333%}.col-l-push-9{left:75%}.col-l-push-8{left:66.66666667%}.col-l-push-7{left:58.33333333%}.col-l-push-6{left:50%}.col-l-push-5{left:41.66666667%}.col-l-push-4{left:33.33333333%}.col-l-push-3{left:25%}.col-l-push-2{left:16.66666667%}.col-l-push-1{left:8.33333333%}.col-l-push-0{left:auto}.col-l-offset-12{margin-left:100%}.col-l-offset-11{margin-left:91.66666667%}.col-l-offset-10{margin-left:83.33333333%}.col-l-offset-9{margin-left:75%}.col-l-offset-8{margin-left:66.66666667%}.col-l-offset-7{margin-left:58.33333333%}.col-l-offset-6{margin-left:50%}.col-l-offset-5{margin-left:41.66666667%}.col-l-offset-4{margin-left:33.33333333%}.col-l-offset-3{margin-left:25%}.col-l-offset-2{margin-left:16.66666667%}.col-l-offset-1{margin-left:8.33333333%}.col-l-offset-0{margin-left:0}}@media all and (min-width:1440px){.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9{float:left}.col-xl-12{width:100%}.col-xl-11{width:91.66666667%}.col-xl-10{width:83.33333333%}.col-xl-9{width:75%}.col-xl-8{width:66.66666667%}.col-xl-7{width:58.33333333%}.col-xl-6{width:50%}.col-xl-5{width:41.66666667%}.col-xl-4{width:33.33333333%}.col-xl-3{width:25%}.col-xl-2{width:16.66666667%}.col-xl-1{width:8.33333333%}.col-xl-pull-12{right:100%}.col-xl-pull-11{right:91.66666667%}.col-xl-pull-10{right:83.33333333%}.col-xl-pull-9{right:75%}.col-xl-pull-8{right:66.66666667%}.col-xl-pull-7{right:58.33333333%}.col-xl-pull-6{right:50%}.col-xl-pull-5{right:41.66666667%}.col-xl-pull-4{right:33.33333333%}.col-xl-pull-3{right:25%}.col-xl-pull-2{right:16.66666667%}.col-xl-pull-1{right:8.33333333%}.col-xl-pull-0{right:auto}.col-xl-push-12{left:100%}.col-xl-push-11{left:91.66666667%}.col-xl-push-10{left:83.33333333%}.col-xl-push-9{left:75%}.col-xl-push-8{left:66.66666667%}.col-xl-push-7{left:58.33333333%}.col-xl-push-6{left:50%}.col-xl-push-5{left:41.66666667%}.col-xl-push-4{left:33.33333333%}.col-xl-push-3{left:25%}.col-xl-push-2{left:16.66666667%}.col-xl-push-1{left:8.33333333%}.col-xl-push-0{left:auto}.col-xl-offset-12{margin-left:100%}.col-xl-offset-11{margin-left:91.66666667%}.col-xl-offset-10{margin-left:83.33333333%}.col-xl-offset-9{margin-left:75%}.col-xl-offset-8{margin-left:66.66666667%}.col-xl-offset-7{margin-left:58.33333333%}.col-xl-offset-6{margin-left:50%}.col-xl-offset-5{margin-left:41.66666667%}.col-xl-offset-4{margin-left:33.33333333%}.col-xl-offset-3{margin-left:25%}.col-xl-offset-2{margin-left:16.66666667%}.col-xl-offset-1{margin-left:8.33333333%}.col-xl-offset-0{margin-left:0}}@media all and (max-width:767px){.list-definition>dt{float:none}.list-definition>dd{margin-left:0}.form-row .form-label{text-align:left}.form-row .form-label.required:after{position:static}.nav{padding-bottom:0;padding-left:0;padding-right:0}.nav-bar-outer-actions{margin-top:0}.nav-bar{display:block;margin-bottom:0;margin-left:auto;margin-right:auto;width:30.9rem}.nav-bar:before{display:none}.nav-bar>li{float:left;min-height:9rem}.nav-bar>li:after{display:none}.nav-bar>li:nth-child(4n){clear:both}.nav-bar a{line-height:1.4}.tooltip{display:none!important}.readiness-check-content{margin-right:2rem}.form-el-insider,.form-el-insider-wrap,.page-web-configuration .form-el-insider-input,.page-web-configuration .form-el-insider-input .form-el-input{display:block;width:100%}}@media all and (max-width:479px){.nav-bar{width:23.175rem}.nav-bar>li{width:7.725rem}.nav .btn-group .btn-wrap-try-again,.nav-bar-outer-actions .btn-wrap-try-again{clear:both;display:block;float:none;margin-left:auto;margin-right:auto;margin-top:1rem;padding-top:1rem}} \ No newline at end of file diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 0b2772d9f45c4684f7baeab5b7dd3f1c063d35a9..650fe796f7adf819de1334f29f3d89871e19cf7c 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -612,6 +612,202 @@ class Installer } } + /** + * Set up core tables + * + * @param SchemaSetupInterface $setup + * @return void + */ + private function setupCoreTables(SchemaSetupInterface $setup) + { + /* @var $connection \Magento\Framework\DB\Adapter\AdapterInterface */ + $connection = $setup->getConnection(); + + $setup->startSetup(); + + $this->setupSessionTable($setup, $connection); + $this->setupCacheTable($setup, $connection); + $this->setupCacheTagTable($setup, $connection); + $this->setupFlagTable($setup, $connection); + + $setup->endSetup(); + } + + /** + * Create table 'session' + * + * @param SchemaSetupInterface $setup + * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection + * @return void + */ + private function setupSessionTable( + SchemaSetupInterface $setup, + \Magento\Framework\DB\Adapter\AdapterInterface $connection + ) { + $table = $connection->newTable( + $setup->getTable('session') + )->addColumn( + 'session_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false, 'primary' => true], + 'Session Id' + )->addColumn( + 'session_expires', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Date of Session Expiration' + )->addColumn( + 'session_data', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '2M', + ['nullable' => false], + 'Session Data' + )->setComment( + 'Database Sessions Storage' + ); + $connection->createTable($table); + } + + /** + * Create table 'cache' + * + * @param SchemaSetupInterface $setup + * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection + * @return void + */ + private function setupCacheTable( + SchemaSetupInterface $setup, + \Magento\Framework\DB\Adapter\AdapterInterface $connection + ) { + $table = $connection->newTable( + $setup->getTable('cache') + )->addColumn( + 'id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false, 'primary' => true], + 'Cache Id' + )->addColumn( + 'data', + \Magento\Framework\DB\Ddl\Table::TYPE_BLOB, + '2M', + [], + 'Cache Data' + )->addColumn( + 'create_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Cache Creation Time' + )->addColumn( + 'update_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Time of Cache Updating' + )->addColumn( + 'expire_time', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Cache Expiration Time' + )->addIndex( + $setup->getIdxName('cache', ['expire_time']), + ['expire_time'] + )->setComment( + 'Caches' + ); + $connection->createTable($table); + } + + /** + * Create table 'cache_tag' + * + * @param SchemaSetupInterface $setup + * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection + * @return void + */ + private function setupCacheTagTable( + SchemaSetupInterface $setup, + \Magento\Framework\DB\Adapter\AdapterInterface $connection + ) { + $table = $connection->newTable( + $setup->getTable('cache_tag') + )->addColumn( + 'tag', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 100, + ['nullable' => false, 'primary' => true], + 'Tag' + )->addColumn( + 'cache_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 200, + ['nullable' => false, 'primary' => true], + 'Cache Id' + )->addIndex( + $setup->getIdxName('cache_tag', ['cache_id']), + ['cache_id'] + )->setComment( + 'Tag Caches' + ); + $connection->createTable($table); + } + + /** + * Create table 'flag' + * + * @param SchemaSetupInterface $setup + * @param \Magento\Framework\DB\Adapter\AdapterInterface $connection + * @return void + */ + private function setupFlagTable( + SchemaSetupInterface $setup, + \Magento\Framework\DB\Adapter\AdapterInterface $connection + ) { + $table = $connection->newTable( + $setup->getTable('flag') + )->addColumn( + 'flag_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Flag Id' + )->addColumn( + 'flag_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Flag Code' + )->addColumn( + 'state', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Flag State' + )->addColumn( + 'flag_data', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Flag Data' + )->addColumn( + 'last_update', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], + 'Date of Last Flag Update' + )->addIndex( + $setup->getIdxName('flag', ['last_update']), + ['last_update'] + )->setComment( + 'Flag' + ); + $connection->createTable($table); + } + /** * Installs DB schema * @@ -624,6 +820,7 @@ class Installer ['resource' => $this->context->getResources()] ); $this->setupModuleRegistry($setup); + $this->setupCoreTables($setup); $this->log->log('Schema creation/updates:'); $this->handleDBSchemaData($setup, 'schema'); } diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php index 06d50d55d388e6a390971e730228fcf82aa97da1..9829a32e94d62e71f507b4d5565897c4f2a755a5 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile + namespace Magento\Setup\Test\Unit\Controller; use \Magento\Setup\Controller\ConsoleController; @@ -132,7 +134,7 @@ class ConsoleControllerTest extends \PHPUnit_Framework_TestCase { $errorMessage = 'Missing route matches; unsure how to retrieve action'; $event = $this->getMock('Zend\Mvc\MvcEvent'); - $exception = $this->getMock('Magento\Setup\Exception', [], [$errorMessage]); + $exception = $this->getMock('Magento\Setup\Exception', ['getCode'], [$errorMessage]); $event->expects($this->once())->method('getRouteMatch')->willThrowException($exception); $this->consoleLogger->expects($this->once())->method('log')->with($errorMessage); $this->controller->onDispatch($event); @@ -386,12 +388,12 @@ class ConsoleControllerTest extends \PHPUnit_Framework_TestCase $moduleListMock ->expects($this->once()) ->method('getNames') - ->will($this->returnValue(['Magento_Core', 'Magento_Store'])); + ->will($this->returnValue(['Magento_Theme', 'Magento_Store'])); $fullModuleListMock = $this->getMock('Magento\Framework\Module\FullModuleList', [], [], '', false); $fullModuleListMock ->expects($this->once()) ->method('getNames') - ->will($this->returnValue(['Magento_Core', 'Magento_Store', 'Magento_Directory'])); + ->will($this->returnValue(['Magento_Theme', 'Magento_Store', 'Magento_Directory'])); $returnValueMap = [ [ 'Magento\Framework\Module\ModuleList', diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php index b780bb25a335ac92aa8c0808d7acb6c5e0d265ab..459368efdeeeb93cb4dcb7a1964878cac86bcbca 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php @@ -239,6 +239,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $setup->expects($this->any())->method('getConnection')->willReturn($connection); $table->expects($this->any())->method('addColumn')->willReturn($table); $table->expects($this->any())->method('setComment')->willReturn($table); + $table->expects($this->any())->method('addIndex')->willReturn($table); $connection->expects($this->any())->method('newTable')->willReturn($table); $resource = $this->getMock('Magento\Framework\App\Resource', [], [], '', false); $this->contextMock->expects($this->any())->method('getResources')->willReturn($resource);