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/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/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/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/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/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/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/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/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php old mode 100644 new mode 100755 index 58c45fe736bbaaaa4cf3c23a050dad8845b48b24..40fb55c7a6626723e2ecd66afe8a16a3f36fb860 --- 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/Category/AttributeRepository.php b/app/code/Magento/Catalog/Model/Category/AttributeRepository.php index bf52fc7acb6dc2c02ae364cc603460edb96c2d58..7538322e36920ec192f3b49607c6a96d7278524d 100644 --- a/app/code/Magento/Catalog/Model/Category/AttributeRepository.php +++ b/app/code/Magento/Catalog/Model/Category/AttributeRepository.php @@ -24,22 +24,30 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface */ protected $eavAttributeRepository; + /** + * @var \Magento\Eav\Model\Config + */ + protected $eavConfig; + /** * @param \Magento\Framework\Api\Config\MetadataConfig $metadataConfig * @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\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; } /** @@ -69,11 +77,14 @@ class AttributeRepository implements CategoryAttributeRepositoryInterface */ 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(), ] ); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php index 6bbae5a2350c1005e73cbb8abf46f7ae87ef6159..03799df3732029c155c4c182a649d4b4df429575 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php @@ -216,11 +216,14 @@ class Repository implements \Magento\Catalog\Api\ProductAttributeRepositoryInter */ 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(), ] ); 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 3ab72e54450174bb329c7c0e80299fc13498dc3e..2338b3ca6ea9822c8ebcd7d095c140ac4ee7f6e4 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/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 13231c9c21935ec1922c7558ba6d7257e306a724..29eea2681c40df8de1ffcb39cacbd5535c8f63cb 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -71,6 +71,11 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa */ protected $metadataService; + /** + * @var \Magento\Eav\Model\Config + */ + protected $eavConfig; + /** * @param ProductFactory $productFactory * @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper @@ -81,6 +86,8 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa * @param Resource\Product $resourceModel * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface + * @param \Magento\Eav\Model\Config $eavConfig + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( ProductFactory $productFactory, @@ -91,7 +98,8 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa \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\Eav\Model\Config $eavConfig ) { $this->productFactory = $productFactory; $this->collectionFactory = $collectionFactory; @@ -102,6 +110,7 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa $this->attributeRepository = $attributeRepository; $this->filterBuilder = $filterBuilder; $this->metadataService = $metadataServiceInterface; + $this->eavConfig = $eavConfig; } /** @@ -263,12 +272,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(), ] ); 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 e5948f941ab03c593376010814923b26705c193b..ffba8e8113717a370bd4cd1823ce7dd16136f3c7 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 { @@ -43,6 +44,11 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase */ protected $searchResultMock; + /** + * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eavConfigMock; + protected function setUp() { $this->searchBuilderMock = @@ -63,16 +69,23 @@ class AttributeRepositoryTest extends \PHPUnit_Framework_TestCase 'setItems', 'setSearchCriteria', 'setTotalCount', - '__wakeup' + '__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', + [ + 'metadataConfig' => $this->metadataConfigMock, + 'searchCriteriaBuilder' => $this->searchBuilderMock, + 'filterBuilder' => $this->filterBuilderMock, + 'eavAttributeRepository' => $this->attributeRepositoryMock, + 'eavConfig' => $this->eavConfigMock, + ] ); } @@ -106,7 +119,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(); 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 e738b7e96bfeee4c68abcb87a6f07cfeffdf56fe..96744e487a0ddc76ed0ae8121e46e2233a152606 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,6 +79,8 @@ 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', [], @@ -101,7 +103,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase 'setItems', 'setSearchCriteria', 'setTotalCount', - '__wakeup' + '__wakeup', ], [], '', @@ -177,9 +179,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()) diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php index 33e3305cefa18a734566e56cfb55cd3d2985949e..4a9f671bcdb570bb3a26900d7b66aa7482bb84e9 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php @@ -60,6 +60,11 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase */ protected $searchResultsFactoryMock; + /** + * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eavConfigMock; + /** * @var array data to create product */ @@ -114,6 +119,9 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase 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->model = $this->objectManager->getObject( @@ -126,7 +134,8 @@ class ProductRepositoryTest extends \PHPUnit_Framework_TestCase 'collectionFactory' => $this->collectionFactoryMock, 'searchCriteriaBuilder' => $this->searchCriteriaBuilderMock, 'metadataServiceInterface' => $this->metadataServiceMock, - 'searchResultsFactory' => $this->searchResultsFactoryMock + 'searchResultsFactory' => $this->searchResultsFactoryMock, + 'eavConfig' => $this->eavConfigMock, ] ); } @@ -392,7 +401,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); @@ -461,44 +470,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/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/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 c41b3d8675dd9e6e510c84e62a17dc7e68613dc6..f15ccfdede8694ac96cdd2a991ce179e232474dd 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 52bb89966d7f105635e05d504a99d11c03b89836..69060c34e2058287cab7bbac92815ab7ff257d51 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/Test/Unit/Controller/Onepage/SaveBillingTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php index 790eee760fe609d826a9876f674e0175fba036bf..db14585d07495e6a39f49fc597f7e5544dc5866e 100755 --- a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/SaveBillingTest.php @@ -147,6 +147,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/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/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/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/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/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/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/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/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/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/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/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/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/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..ad58d32bcbe86077a511d6c2971e2e2efbe943ea 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; 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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 e48549364374ca18c17983f12cceb88f0525c657..d957719932a2bdac2c787d9f46b72e0a7b66bb72 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/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/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeManagementTest.php index 71a23320a189ff2d7b94a048bf9c7e30f5189edc..36d3dc65d184cfd95e09d4d3e97186b4d4770f04 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' => [ @@ -158,7 +158,7 @@ class ProductAttributeManagementTest extends \Magento\TestFramework\TestCase\Web $serviceInfo, [ 'attributeSetId' => $payload['attributeSetId'], - 'attributeCode' => $payload['attributeCode'] + 'attributeCode' => $payload['attributeCode'], ] ) ); @@ -167,10 +167,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/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/Checkout/Test/Block/Cart.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php index dcd021475a053f48137961d472a5dd119be6fa3b..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 @@ -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/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/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/Handler/Customer/Curl.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Curl.php index b42c48cbb8013423b8dd0e502972d240387331b5..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 @@ -93,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"); } 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/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/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/Product/Option/Type/File/ValidatorFileTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php index 5ce9ef1e7049ac53eb4da8f83037564b759f04ca..eb8ec06003ac4f24253b991563579c4818fe3335 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/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 1563fc9e8d6ea3b382a1bd7bffbdb622359f199a..eb7f1a37ba216ffaa43d603e87ae475e6b3accc6 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']]; 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/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/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/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/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/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/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/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/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 77afd6d62a2ffa35e950fbb7efb73914513aa736..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 @@ -2041,6 +2041,7 @@ return [ ['_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'], @@ -2104,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/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/bootstrap.php b/dev/tests/unit/framework/bootstrap.php index afd5f88e899199d6db3934bb2d3e2d64431a972f..96ff9c21b8765cddb3f750ce6aeb61e2dbece0a5 100755 --- a/dev/tests/unit/framework/bootstrap.php +++ b/dev/tests/unit/framework/bootstrap.php @@ -12,11 +12,6 @@ if (!defined('TESTS_TEMP_DIR')) { 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/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/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/App/Test/Unit/Response/HttpTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php index 973f461ee88b54e8ed4fa815d11af70c170f66c6..c1502736e273ec2e56af9c4faba802208d4172f3 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php @@ -114,13 +114,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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php index 06d50d55d388e6a390971e730228fcf82aa97da1..a248687ce6b24b07864012cc33f9b5bf9210cf09 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/ConsoleControllerTest.php @@ -132,7 +132,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);