Skip to content

Commit 767ea1d

Browse files
author
Michael Logvin
committed
Merge branch 'develop' into MAGETWO-35367
2 parents ff545ad + c0eef7c commit 767ea1d

File tree

22 files changed

+76
-55
lines changed

22 files changed

+76
-55
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
class Upload extends \Magento\Backend\App\Action
1212
{
1313
/**
14-
* @var \Magento\Framework\Controller\Result\JsonFactory
14+
* @var \Magento\Framework\Controller\Result\RawFactory
1515
*/
16-
protected $resultJsonFactory;
16+
protected $resultRawFactory;
1717

1818
/**
1919
* @param \Magento\Backend\App\Action\Context $context
20-
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
20+
* @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory
2121
*/
2222
public function __construct(
2323
\Magento\Backend\App\Action\Context $context,
24-
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
24+
\Magento\Framework\Controller\Result\RawFactory $resultRawFactory
2525
) {
2626
parent::__construct($context);
27-
$this->resultJsonFactory = $resultJsonFactory;
27+
$this->resultRawFactory = $resultRawFactory;
2828
}
2929

3030
/**
@@ -36,7 +36,7 @@ protected function _isAllowed()
3636
}
3737

3838
/**
39-
* @return \Magento\Framework\Controller\Result\Json
39+
* @return \Magento\Framework\Controller\Result\Raw
4040
*/
4141
public function execute()
4242
{
@@ -72,6 +72,10 @@ public function execute()
7272
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
7373
}
7474

75-
return $this->resultJsonFactory->create()->setData($result);
75+
/** @var \Magento\Framework\Controller\Result\Raw $response */
76+
$response = $this->resultRawFactory->create();
77+
$response->setHeader('Content-type', 'text/plain');
78+
$response->setContents(json_encode($result));
79+
return $response;
7680
}
7781
}

app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function execute()
9090
if ($storeId) {
9191
$product->setStoreId($storeId);
9292
}
93-
$setId = $this->getRequest()->getPost('set');
93+
$setId = $this->getRequest()->getPost('set') ?: $this->getRequest()->getParam('set');
9494
if ($setId) {
9595
$product->setAttributeSetId($setId);
9696
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ValidateTest.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class ValidateTest extends \Magento\Catalog\Test\Unit\Controller\Adminhtml\Produ
2828
protected $initializationHelper;
2929
/** @var \Magento\Catalog\Model\ProductFactory|\PHPUnit_Framework_MockObject_MockObject */
3030
protected $productFactory;
31-
/** @var \Magento\Framework\Controller\Result\JSON|\PHPUnit_Framework_MockObject_MockObject */
31+
/** @var \Magento\Framework\Controller\Result\Json|\PHPUnit_Framework_MockObject_MockObject */
3232
protected $resultJson;
33-
/** @var \Magento\Framework\Controller\Result\JSONFactory|\PHPUnit_Framework_MockObject_MockObject */
33+
/** @var \Magento\Framework\Controller\Result\JsonFactory|\PHPUnit_Framework_MockObject_MockObject */
3434
protected $resultJsonFactory;
3535

3636
protected function setUp()
@@ -104,8 +104,8 @@ protected function setUp()
104104
->getMock();
105105
$this->productFactory->expects($this->any())->method('create')->willReturn($this->product);
106106

107-
$this->resultJson = $this->getMock('Magento\Framework\Controller\Result\JSON', [], [], '', false);
108-
$this->resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JSONFactory')
107+
$this->resultJson = $this->getMock('Magento\Framework\Controller\Result\Json', [], [], '', false);
108+
$this->resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JsonFactory')
109109
->disableOriginalConstructor()
110110
->setMethods(['create'])
111111
->getMock();
@@ -126,15 +126,21 @@ protected function setUp()
126126
);
127127
}
128128

129-
/**
130-
* @return void
131-
*/
132-
public function testAttributeSetIsObtainedFromPost()
129+
public function testAttributeSetIsObtainedFromPostByDefault()
133130
{
131+
$this->request->expects($this->any())->method('getParam')->willReturnMap([['set', null, 4]]);
134132
$this->request->expects($this->any())->method('getPost')->willReturnMap([['set', null, 9]]);
135-
136133
$this->product->expects($this->once())->method('setAttributeSetId')->with(9);
137134

138135
$this->action->execute();
139136
}
137+
138+
public function testAttributeSetIsObtainedFromGetWhenThereIsNoOneInPost()
139+
{
140+
$this->request->expects($this->any())->method('getParam')->willReturnMap([['set', null, 4]]);
141+
$this->request->expects($this->any())->method('getPost')->willReturnMap([['set', null, null]]);
142+
$this->product->expects($this->once())->method('setAttributeSetId')->with(4);
143+
144+
$this->action->execute();
145+
}
140146
}

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
<?php $_divId = 'tree-div_' . time() ?>
1212
<div id="<?php echo $_divId ?>" class="tree"></div>
13-
13+
<!--[if IE]>
14+
<script id="ie-deferred-loader" defer="defer" src=""></script>
15+
<![endif]-->
1416
<script>
1517
require([
1618
'jquery',

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
<div><?php echo __('This operation can take much time'); ?></div>
3636
</div>
3737
</div>
38-
38+
<!--[if IE]>
39+
<script id="ie-deferred-loader" defer="defer" src=""></script>
40+
<![endif]-->
3941
<script>
4042
var tree;
4143
require([

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
<?php $_divId = 'tree' . $block->getId() ?>
1212
<div id="<?php echo $_divId ?>" class="tree"></div>
13-
13+
<!--[if IE]>
14+
<script id="ie-deferred-loader" defer="defer" src=""></script>
15+
<![endif]-->
1416
<script>
1517
require(['jquery', "prototype", "extjs/ext-tree-checkbox"], function(jQuery){
1618

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ require([
3838
<span class="title"><?php echo __('Unassigned Attributes') ?></span>
3939
</div>
4040
<div id="tree-div2" class="attribute-set-tree"></div>
41+
<!--[if IE]>
42+
<script id="ie-deferred-loader" defer="defer" src=""></script>
43+
<![endif]-->
4144
<script>
42-
require(["jquery", "extjs/ext-tree-checkbox", "prototype"], function(jQuery){
45+
define("tree-panel", ["jquery", "extjs/ext-tree-checkbox", "prototype"], function(jQuery){
4346

4447
//<![CDATA[
4548
var allowDragAndDrop = <?php echo($block->getIsReadOnly() ? 'false' : 'true'); ?>;
@@ -406,6 +409,7 @@ require(["jquery", "extjs/ext-tree-checkbox", "prototype"], function(jQuery){
406409
//]]>
407410

408411
});
412+
require(["tree-panel"]);
409413
</script>
410414
</div>
411415
</div>

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/attribute/set/js.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
?>
1111
<script>
12-
require(['jquery'], function(){
12+
require(["tree-panel"], function(){
1313
ConfigurableNodeExists = function(currentNode) {
1414
for (var i in currentNode.childNodes ) {
1515
if (currentNode.childNodes[i].id) {

app/code/Magento/DesignEditor/view/adminhtml/templates/editor/tools/files/tree.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
</div>
2929

3030
<div id="tree" style="width:100%; overflow:auto;"></div>
31-
31+
<!--[if IE]>
32+
<script id="ie-deferred-loader" defer="defer" src=""></script>
33+
<![endif]-->
3234
<script>
3335
require([
3436
'jquery',

app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<div class="actions"><?php echo $block->getAddLayoutButtonHtml() ?></div>
1616
</div>
1717
</fieldset>
18+
<!--[if IE]>
19+
<script id="ie-deferred-loader" defer="defer" src=""></script>
20+
<![endif]-->
1821
<script>
1922
require([
2023
'jquery',

dev/tests/functional/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"magento/mtf": "1.0.0-rc19",
3+
"magento/mtf": "1.0.0-rc20",
44
"php": "~5.5.0|~5.6.0",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2",

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Attribute/AttributeForm.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
namespace Magento\Catalog\Test\Block\Adminhtml\Product\Attribute;
88

9-
use Magento\Backend\Test\Block\Widget\Tab;
109
use Magento\Backend\Test\Block\Widget\FormTabs;
10+
use Magento\Backend\Test\Block\Widget\Tab;
11+
use Magento\Mtf\Block\BlockFactory;
12+
use Magento\Mtf\Block\Mapper;
1113
use Magento\Mtf\Client\BrowserInterface;
12-
use Magento\Mtf\Client\Element\SimpleElement;
1314
use Magento\Mtf\Client\Element;
15+
use Magento\Mtf\Client\Element\SimpleElement;
1416
use Magento\Mtf\Client\Locator;
1517
use Magento\Mtf\Fixture\FixtureInterface;
16-
use Magento\Mtf\Block\BlockFactory;
17-
use Magento\Mtf\Block\Mapper;
1818
use Magento\Mtf\Util\XmlConverter;
1919

2020
/**
@@ -64,14 +64,6 @@ public function __construct(
6464
$this->browser->switchToFrame(new Locator($this->iFrame));
6565
}
6666

67-
/**
68-
* @destructor
69-
*/
70-
public function __destruct()
71-
{
72-
$this->browser->switchToFrame();
73-
}
74-
7567
/**
7668
* Fill the attribute form.
7769
*

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ protected function verifySku()
150150
$fixtureProductSku = $this->product->getSku();
151151
$formProductSku = $this->productView->getProductSku();
152152

153-
if ($fixtureProductSku == $formProductSku) {
153+
if ($fixtureProductSku === null || $fixtureProductSku == $formProductSku) {
154154
return null;
155155
}
156156
return "Displayed product sku on product page(front-end) not equals passed from fixture. "

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Block/Adminhtml/Product/Edit/Tab/Super/Config/Attribute.php

100755100644
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
namespace Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\Edit\Tab\Super\Config;
88

9-
use Magento\Mtf\Client\Locator;
109
use Magento\Backend\Test\Block\Widget\Form;
11-
use Magento\Mtf\Client\Element\SimpleElement;
1210
use Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\Edit\Tab\Super\Config\Attribute\AttributeSelector;
11+
use Magento\Mtf\Client\Element\SimpleElement;
12+
use Magento\Mtf\Client\Locator;
13+
use Magento\Mtf\ObjectManager;
1314

1415
/**
1516
* Attribute block in Variation section.
@@ -158,13 +159,17 @@ public function fillAttributes(array $attributes)
158159
*/
159160
protected function createNewVariationSet(array $attribute)
160161
{
161-
$this->_rootElement->find($this->createNewVariationSet)->click();
162+
$attributeFixture = ObjectManager::getInstance()->create(
163+
'Magento\Catalog\Test\Fixture\CatalogProductAttribute',
164+
['data' => $attribute]
165+
);
162166

167+
$this->_rootElement->find($this->createNewVariationSet)->click();
163168
$newAttribute = $this->getEditAttributeForm();
164-
$newAttribute->getTabElement('properties')->fillFormTab($attribute);
169+
$newAttribute->fill($attributeFixture);
165170
$newAttribute->_rootElement->find($this->saveAttribute)->click();
166171

167-
$this->browser->selectWindow();
172+
$this->browser->switchToFrame();
168173
}
169174

170175
/**

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CreateConfigurableProductEntityTest extends Injectable
4040
{
4141
/* tags */
4242
const TEST_TYPE = 'acceptance_test';
43-
const STABLE = 'no';
43+
const STABLE = 'yes';
4444
const MVP = 'yes';
4545
const DOMAIN = 'MX';
4646
/* end tags */

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
1010
<testCase name="Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest">
1111
<variation name="CreateConfigurableProductEntityTestVariation1">
12-
<data name="issue" xsi:type="string">Bug: MAGETWO-34195</data>
1312
<data name="description" xsi:type="string">Create product with category and two new options</data>
1413
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
1514
<data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data>
@@ -55,7 +54,6 @@
5554
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/>
5655
</variation>
5756
<variation name="CreateConfigurableProductEntityTestVariation3">
58-
<data name="issue" xsi:type="string">Bug: MAGETWO-34195</data>
5957
<data name="description" xsi:type="string">Create product with special price</data>
6058
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
6159
<data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data>
@@ -116,13 +114,13 @@
116114
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" />
117115
</variation>
118116
<variation name="CreateConfigurableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test">
119-
<data name="issue" xsi:type="string">Bug: MAGETWO-34195</data>
120117
<data name="description" xsi:type="string">MAGETWO-13361: Create Configurable Product with Creating New Category and New Attribute (Required Fields Only)</data>
121118
<data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_searchable_options</data>
122119
<data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data>
123120
<data name="product/data/price/value" xsi:type="string">100</data>
124121
<data name="product/data/category_ids/new_category" xsi:type="string">no</data>
125122
<data name="product/data/category_ids/presets" xsi:type="string">default_subcategory</data>
123+
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
126124
<data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data>
127125
<data name="tag" xsi:type="string">test_type:acceptance_test</data>
128126
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />

dev/tests/functional/tests/app/Magento/User/Test/Handler/Role/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function persist(FixtureInterface $fixture = null)
6161
}
6262

6363
$url = 'admin/user_role/roleGrid/sort/role_id/dir/desc/';
64-
$regExpPattern = '/col\-role_id\W*(\d+)<.td><[^<>]*?>' . $data['rolename'] . '/siu';
64+
$regExpPattern = '/col\-role_id[\s\W]*(\d+)\s*<.td>\s*<[^<>]*?>' . $data['rolename'] . '/siu';
6565

6666
$extractor = new Extractor($url, $regExpPattern);
6767

dev/tests/functional/tests/app/Magento/User/Test/Handler/User/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function persist(FixtureInterface $fixture = null)
4747
}
4848

4949
$url = 'admin/user/roleGrid/sort/user_id/dir/desc';
50-
$regExpPattern = '/col-user_id\W*(\d+)<.td><[^<>]*?>' . $data['username'] . '/siu';
50+
$regExpPattern = '/col-user_id[\s\W]*(\d+)\s*<.td>\s*<[^<>]*?>' . $data['username'] . '/siu';
5151
$extractor = new Extractor($url, $regExpPattern);
5252

5353
return ['user_id' => $extractor->getData()[1]];

lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ public function formatDate($date = null, $format = \IntlDateFormatter::SHORT, $s
197197
public function scopeTimeStamp($scope = null)
198198
{
199199
$timezone = $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope);
200-
return (new \DateTime('now', new \DateTimeZone($timezone ?: 'UTC')))->getTimestamp();
200+
$currentTimezone = @date_default_timezone_get();
201+
@date_default_timezone_set($timezone);
202+
$date = date('Y-m-d H:i:s');
203+
@date_default_timezone_set($currentTimezone);
204+
return strtotime($date);
201205
}
202206

203207
/**

lib/internal/Magento/Framework/View/Layout/ScheduledStructure.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,7 @@ public function getListToMove()
9999
*/
100100
public function getListToRemove()
101101
{
102-
return array_keys(array_intersect_key(
103-
$this->_scheduledElements,
104-
array_merge($this->_scheduledRemoves, $this->_brokenParent)
105-
));
102+
return array_keys(array_intersect_key($this->_scheduledElements, $this->_scheduledRemoves));
106103
}
107104

108105
/**

lib/internal/Magento/Framework/View/Template/Html/Minifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function minify($file)
116116
'#(?<!]]>)\s+</#',
117117
'</',
118118
preg_replace(
119-
'#((?:<\?php\s+(?!echo|print)[^\?]*)\?>)\s+#',
119+
'#((?:<\?php\s+(?!echo|print|if|elseif|else)[^\?]*)\?>)\s+#',
120120
'$1',
121121
preg_replace(
122122
'#(?<!' . implode('|', $this->inlineHtmlTags) . ')\> \<#',

lib/internal/Magento/Framework/View/Test/Unit/Layout/ScheduledStructureTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public function testSetElementToBrokenParentList()
393393
{
394394
$element = 'element9';
395395
$expectedToRemove = ['element2', 'element3'];
396-
$expectedToRemoveWithBroken = ['element2', 'element3', $element];
396+
$expectedToRemoveWithBroken = ['element2', 'element3'];
397397
$this->assertEquals($expectedToRemove, $this->_model->getListToRemove());
398398

399399
$this->_model->setElementToBrokenParentList($element);

0 commit comments

Comments
 (0)