Skip to content

Commit 1798d26

Browse files
committed
MAGETWO-70277: Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-70277-PR-10062
2 parents 5eced8e + 68a79d9 commit 1798d26

File tree

7 files changed

+111
-13
lines changed

7 files changed

+111
-13
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function initializeFromData(\Magento\Catalog\Model\Product $product, arra
180180
} else {
181181
$productOptions = [];
182182
}
183-
183+
$productData['tier_price'] = isset($productData['tier_price']) ? $productData['tier_price'] : [];
184184
$product->addData($productData);
185185

186186
if ($wasLockedMedia) {

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,19 @@ protected function setUp()
165165
* @param array $links
166166
* @param array $linkTypes
167167
* @param array $expectedLinks
168+
* @param array|null $tierPrice
168169
* @dataProvider initializeDataProvider
169170
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
170171
*/
171-
public function testInitialize($isSingleStore, $websiteIds, $expWebsiteIds, $links, $linkTypes, $expectedLinks)
172-
{
172+
public function testInitialize(
173+
$isSingleStore,
174+
$websiteIds,
175+
$expWebsiteIds,
176+
$links,
177+
$linkTypes,
178+
$expectedLinks,
179+
$tierPrice = null
180+
) {
173181
$this->linkTypeProviderMock->expects($this->once())
174182
->method('getItems')
175183
->willReturn($this->assembleLinkTypes($linkTypes));
@@ -184,6 +192,9 @@ public function testInitialize($isSingleStore, $websiteIds, $expWebsiteIds, $lin
184192
'options' => $optionsData,
185193
'website_ids' => $websiteIds
186194
];
195+
if (!empty($tierPrice)) {
196+
$productData = array_merge($productData, ['tier_price' => $tierPrice]);
197+
}
187198
$attributeNonDate = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
188199
->disableOriginalConstructor()
189200
->getMock();
@@ -270,10 +281,11 @@ public function testInitialize($isSingleStore, $websiteIds, $expWebsiteIds, $lin
270281
$this->assertTrue('sku' == $option2->getData('product_sku'));
271282

272283
$productLinks = $this->productMock->getProductLinks();
273-
274284
$this->assertCount(count($expectedLinks), $productLinks);
275285
$resultLinks = [];
276286

287+
$this->assertEquals($tierPrice ?: [], $this->productMock->getData('tier_price'));
288+
277289
foreach ($productLinks as $link) {
278290
$this->assertInstanceOf(ProductLink::class, $link);
279291
$this->assertEquals('sku', $link->getSku());
@@ -297,6 +309,7 @@ public function initializeDataProvider()
297309
'links' => [],
298310
'linkTypes' => ['related', 'upsell', 'crosssell'],
299311
'expected_links' => [],
312+
'tierPrice' => [1, 2, 3],
300313
],
301314
[
302315
'single_store' => false,

app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@
151151
<column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date">
152152
<settings>
153153
<filter>dateRange</filter>
154-
<dateFormat>MMM dd, YYYY, H:mm:ss A</dateFormat>
155154
<dataType>date</dataType>
156155
<label translate="true">Purchase Date</label>
157156
</settings>

app/code/Magento/Swatches/etc/acl.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
9+
<acl>
10+
<resources>
11+
<resource id="Magento_Backend::admin">
12+
<resource id="Magento_Backend::stores">
13+
<resource id="Magento_Backend::stores_attributes">
14+
<resource id="Magento_Swatches::iframe" title="Swatches" translate="title" sortOrder="70" />
15+
</resource>
16+
</resource>
17+
</resource>
18+
</resources>
19+
</acl>
20+
</config>

dev/tests/integration/testsuite/Magento/SalesRule/Model/ResourceModel/Rule/CollectionTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,19 @@ public function testSetValidationFilter($couponCode, $expectedItems)
2626
$items = array_values($collection->setValidationFilter(1, 0, $couponCode)->getItems());
2727

2828
$ids = [];
29+
30+
$this->assertEquals(
31+
count($expectedItems),
32+
count($items),
33+
'Invalid number of items in the result collection'
34+
);
35+
2936
foreach ($items as $key => $item) {
3037
$this->assertEquals($expectedItems[$key], $item->getName());
31-
if (in_array($item->getId(), $ids)) {
32-
$this->fail('Item should be unique in result collection');
33-
}
38+
$this->assertFalse(
39+
in_array($item->getId(), $ids),
40+
'Item should be unique in result collection'
41+
);
3442
$ids[] = $item->getId();
3543
}
3644
}

dev/tests/integration/testsuite/Magento/SalesRule/_files/rules.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
'1'
2323
)->setCustomerGroupIds(
2424
'0'
25-
)->setDiscountStep(0)
25+
)->setDiscountStep(
26+
0
27+
)->setSortOrder(1)
2628
->save();
2729

2830
/** @var \Magento\SalesRule\Model\Rule $rule */
@@ -43,7 +45,9 @@
4345
'1'
4446
)->setCustomerGroupIds(
4547
'0'
46-
)->setDiscountStep(0)
48+
)->setDiscountStep(
49+
0
50+
)->setSortOrder(2)
4751
->save();
4852

4953
/** @var \Magento\SalesRule\Model\Rule $rule */
@@ -64,7 +68,9 @@
6468
'1'
6569
)->setCustomerGroupIds(
6670
'0'
67-
)->setDiscountStep(0)
71+
)->setDiscountStep(
72+
0
73+
)->setSortOrder(3)
6874
->save();
6975

7076
/** @var \Magento\SalesRule\Model\Rule $rule */
@@ -85,7 +91,9 @@
8591
'1'
8692
)->setCustomerGroupIds(
8793
'0'
88-
)->setDiscountStep(0)
94+
)->setDiscountStep(
95+
0
96+
)->setSortOrder(4)
8997
->save();
9098

9199
/** @var \Magento\SalesRule\Model\Rule $rule */
@@ -106,5 +114,7 @@
106114
'1'
107115
)->setCustomerGroupIds(
108116
'0'
109-
)->setDiscountStep(0)
117+
)->setDiscountStep(
118+
0
119+
)->setSortOrder(5)
110120
->save();
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Swatches\Controller\Adminhtml\Iframe;
7+
8+
/**
9+
* @magentoAppArea adminhtml
10+
*/
11+
class ShowTest extends \Magento\TestFramework\TestCase\AbstractBackendController
12+
{
13+
/**
14+
* Check Swatch Acl Access
15+
*/
16+
public function testAclAccess()
17+
{
18+
/** @var $acl \Magento\Framework\Acl */
19+
$acl = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
20+
->get(\Magento\Framework\Acl\Builder::class)
21+
->getAcl();
22+
23+
$acl->allow(null, \Magento\Swatches\Controller\Adminhtml\Iframe\Show::ADMIN_RESOURCE);
24+
25+
$this->dispatch('backend/swatches/iframe/show/');
26+
27+
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode());
28+
$this->assertNotContains('Access denied', $this->getResponse()->getBody());
29+
}
30+
31+
/**
32+
* Check Swatch Acl Access Denied
33+
*/
34+
public function testAclAccessDenied()
35+
{
36+
/** @var $acl \Magento\Framework\Acl */
37+
$acl = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
38+
->get(\Magento\Framework\Acl\Builder::class)
39+
->getAcl();
40+
41+
$acl->deny(null, \Magento\Swatches\Controller\Adminhtml\Iframe\Show::ADMIN_RESOURCE);
42+
43+
$this->dispatch('backend/swatches/iframe/show/');
44+
45+
$this->assertEquals(403, $this->getResponse()->getHttpResponseCode());
46+
$this->assertContains('Access denied', $this->getResponse()->getBody());
47+
}
48+
}

0 commit comments

Comments
 (0)