Skip to content

Commit 64732a0

Browse files
author
Karpenko, Oleksandr
committed
Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-69515
2 parents 0bc4bf6 + 711ad81 commit 64732a0

File tree

22 files changed

+363
-93
lines changed

22 files changed

+363
-93
lines changed

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ protected function setUp()
5656
$this->productMock = $this->getMockBuilder(ProductInterface::class)
5757
->setMethods([
5858
'getId',
59+
'getTypeId',
5960
'getStoreId',
6061
'getResource',
6162
'getData',

app/code/Magento/Catalog/etc/mview.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<table name="catalog_product_entity_decimal" entity_column="entity_id" />
3737
<table name="catalog_product_entity_gallery" entity_column="entity_id" />
3838
<table name="catalog_product_entity_int" entity_column="entity_id" />
39-
<table name="catalog_product_entity_media_gallery" entity_column="value_id" />
4039
<table name="catalog_product_entity_media_gallery_value" entity_column="entity_id" />
4140
<table name="catalog_product_entity_text" entity_column="entity_id" />
4241
<table name="catalog_product_entity_tier_price" entity_column="entity_id" />

app/code/Magento/CatalogRule/etc/mview.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<table name="catalog_product_entity_decimal" entity_column="entity_id" />
1919
<table name="catalog_product_entity_gallery" entity_column="entity_id" />
2020
<table name="catalog_product_entity_int" entity_column="entity_id" />
21-
<table name="catalog_product_entity_media_gallery" entity_column="value_id" />
2221
<table name="catalog_product_entity_media_gallery_value" entity_column="entity_id" />
2322
<table name="catalog_product_entity_text" entity_column="entity_id" />
2423
<table name="catalog_product_entity_tier_price" entity_column="entity_id" />

app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,11 @@ protected function getDefaultValue($attributeCode)
321321
return $this->getCustomer()->getFirstname();
322322
}
323323
break;
324+
case 'middlename':
325+
if ($this->getCustomer()) {
326+
return $this->getCustomer()->getMiddlename();
327+
}
328+
break;
324329
case 'lastname':
325330
if ($this->getCustomer()) {
326331
return $this->getCustomer()->getLastname();

app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
-->
77
<div class="billing-address-details" data-bind="if: isAddressDetailsVisible() && currentBillingAddress()">
8-
<!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname --><!-- /ko -->
8+
<!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname --><!-- /ko --> <!-- ko text: currentBillingAddress().middlename --><!-- /ko -->
99
<!-- ko text: currentBillingAddress().lastname --><!-- /ko --> <!-- ko text: currentBillingAddress().suffix --><!-- /ko --><br/>
1010
<!-- ko text: currentBillingAddress().street --><!-- /ko --><br/>
1111
<!-- ko text: currentBillingAddress().city --><!-- /ko -->, <span data-bind="html: currentBillingAddress().region"></span> <!-- ko text: currentBillingAddress().postcode --><!-- /ko --><br/>

app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
-->
77
<div class="shipping-address-item" data-bind="css: isSelected() ? 'selected-item' : 'not-selected-item'">
8-
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko -->
8+
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko --> <!-- ko text: address().middlename --><!-- /ko -->
99
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
1010
<!-- ko text: address().street --><!-- /ko --><br/>
1111
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>

app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
-->
77
<!-- ko if: (visible()) -->
8-
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko -->
8+
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko --> <!-- ko text: address().middlename --><!-- /ko -->
99
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
1010
<!-- ko text: address().street --><!-- /ko --><br/>
1111
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>

app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getProducts(ProductInterface $product)
6363
);
6464

6565
$this->linkedProductMap[$product->getId()] = $this->collectionFactory->create()
66-
->addAttributeToSelect(['price', 'special_price'])
66+
->addAttributeToSelect(['price', 'special_price', 'special_from_date', 'special_to_date'])
6767
->addIdFilter($productIds)
6868
->getItems();
6969
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\ConfigurableProduct\Test\Unit\Pricing\Price;
8+
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
10+
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Catalog\Model\ResourceModel\Product\LinkedProductSelectBuilderInterface;
12+
13+
class LowestPriceOptionsProviderTest extends \PHPUnit_Framework_TestCase
14+
{
15+
/**
16+
* @var \Magento\ConfigurableProduct\Pricing\Price\LowestPriceOptionsProvider
17+
*/
18+
private $model;
19+
20+
/**
21+
* @var \Magento\Framework\App\ResourceConnection|\PHPUnit_Framework_MockObject_MockObject
22+
*/
23+
private $resourceConnection;
24+
25+
/**
26+
* @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
27+
*/
28+
protected $connection;
29+
30+
/**
31+
* @var LinkedProductSelectBuilderInterface|\PHPUnit_Framework_MockObject_MockObject
32+
*/
33+
private $linkedProductSelectBuilder;
34+
35+
/**
36+
* @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
37+
*/
38+
private $collectionFactory;
39+
40+
/**
41+
* @var \Magento\Catalog\Model\ResourceModel\Product\Collection|\PHPUnit_Framework_MockObject_MockObject
42+
*/
43+
private $productCollection;
44+
45+
protected function setUp()
46+
{
47+
$this->connection = $this
48+
->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
49+
->getMock();
50+
$this->resourceConnection = $this
51+
->getMockBuilder(\Magento\Framework\App\ResourceConnection::class)
52+
->disableOriginalConstructor()
53+
->setMethods(['getConnection'])
54+
->getMock();
55+
$this->resourceConnection->expects($this->once())->method('getConnection')->willReturn($this->connection);
56+
$this->linkedProductSelectBuilder = $this
57+
->getMockBuilder(LinkedProductSelectBuilderInterface::class)
58+
->setMethods(['build'])
59+
->getMock();
60+
$this->productCollection = $this
61+
->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\Collection::class)
62+
->disableOriginalConstructor()
63+
->setMethods(['addAttributeToSelect', 'addIdFilter', 'getItems'])
64+
->getMock();
65+
$this->collectionFactory = $this
66+
->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class)
67+
->disableOriginalConstructor()
68+
->setMethods(['create'])
69+
->getMock();
70+
$this->collectionFactory->expects($this->once())->method('create')->willReturn($this->productCollection);
71+
72+
$objectManager = new ObjectManager($this);
73+
$this->model = $objectManager->getObject(
74+
\Magento\ConfigurableProduct\Pricing\Price\LowestPriceOptionsProvider::class,
75+
[
76+
'resourceConnection' => $this->resourceConnection,
77+
'linkedProductSelectBuilder' => $this->linkedProductSelectBuilder,
78+
'collectionFactory' => $this->collectionFactory,
79+
]
80+
);
81+
}
82+
83+
public function testGetProducts()
84+
{
85+
$productId = 1;
86+
$linkedProducts = ['some', 'linked', 'products', 'dataobjects'];
87+
$product = $this->getMockBuilder(ProductInterface::class)->disableOriginalConstructor()->getMock();
88+
$product->expects($this->any())->method('getId')->willReturn($productId);
89+
$this->linkedProductSelectBuilder->expects($this->any())->method('build')->with($productId)->willReturn([]);
90+
$this->productCollection
91+
->expects($this->once())
92+
->method('addAttributeToSelect')
93+
->with(['price', 'special_price', 'special_from_date', 'special_to_date'])
94+
->willReturnSelf();
95+
$this->productCollection->expects($this->once())->method('addIdFilter')->willReturnSelf();
96+
$this->productCollection->expects($this->once())->method('getItems')->willReturn($linkedProducts);
97+
98+
$this->assertEquals($linkedProducts, $this->model->getProducts($product));
99+
}
100+
}

app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ConfigurablePriceTest.php

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,106 @@ class ConfigurablePriceTest extends AbstractModifierTest
1515
*/
1616
protected function createModel()
1717
{
18-
return $this->objectManager->getObject(ConfigurablePriceModifier::class);
18+
return $this->objectManager->getObject(ConfigurablePriceModifier::class, ['locator' => $this->locatorMock]);
1919
}
2020

21-
public function testModifyMeta()
21+
/**
22+
* @param array $metaInput
23+
* @param array $metaOutput
24+
* @dataProvider metaDataProvider
25+
*/
26+
public function testModifyMeta($metaInput, $metaOutput)
2227
{
23-
$meta = ['initial' => 'meta'];
28+
$this->productMock->expects($this->any())
29+
->method('getTypeId')
30+
->willReturn(\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE);
31+
32+
$metaResult = $this->getModel()->modifyMeta($metaInput);
33+
$this->assertEquals($metaResult, $metaOutput);
34+
}
2435

25-
$this->assertArrayHasKey('initial', $this->getModel()->modifyMeta($meta));
36+
/**
37+
* @return array
38+
*/
39+
public function metaDataProvider()
40+
{
41+
return [
42+
[
43+
'metaInput' => [
44+
'pruduct-details' => [
45+
'children' => [
46+
'container_price' => [
47+
'children' => [
48+
'advanced_pricing_button' => [
49+
'arguments' => []
50+
]
51+
]
52+
]
53+
]
54+
]
55+
],
56+
'metaOutput' => [
57+
'pruduct-details' => [
58+
'children' => [
59+
'container_price' => [
60+
'children' => [
61+
'advanced_pricing_button' => [
62+
'arguments' => [
63+
'data' => [
64+
'config' => [
65+
'visible' => 0,
66+
'disabled' => 1,
67+
'componentType' => 'container'
68+
],
69+
],
70+
],
71+
],
72+
'price' => [
73+
'arguments' => [
74+
'data' => [
75+
'config' => [
76+
'component' =>
77+
'Magento_ConfigurableProduct/js/components/price-configurable'
78+
],
79+
],
80+
],
81+
],
82+
],
83+
],
84+
],
85+
]
86+
]
87+
], [
88+
'metaInput' => [
89+
'pruduct-details' => [
90+
'children' => [
91+
'container_price' => [
92+
'children' => []
93+
]
94+
]
95+
]
96+
],
97+
'metaOutput' => [
98+
'pruduct-details' => [
99+
'children' => [
100+
'container_price' => [
101+
'children' => [
102+
'price' => [
103+
'arguments' => [
104+
'data' => [
105+
'config' => [
106+
'component' =>
107+
'Magento_ConfigurableProduct/js/components/price-configurable'
108+
]
109+
]
110+
]
111+
]
112+
]
113+
]
114+
]
115+
]
116+
]
117+
]
118+
];
26119
}
27120
}

0 commit comments

Comments
 (0)