Skip to content

Commit e83c4e9

Browse files
author
Igor Melnikov
committed
Merge branch 'MAGETWO-58455-n-MAGETWO-58463' of github.com:magento-jackalopes/magento2ce into MAGETWO-58455-n-MAGETWO-58463
2 parents 22df83c + 10fb3ae commit e83c4e9

File tree

299 files changed

+14810
-752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+14810
-752
lines changed

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ public function isSalable($product)
550550
$selectionsCollection = $this->_bundleCollection->create();
551551
$selectionsCollection->addAttributeToSelect('status');
552552
$selectionsCollection->addQuantityFilter();
553+
$selectionsCollection->setFlag('product_children', true);
553554
$selectionsCollection->addFilterByRequiredOptions();
554555
$selectionsCollection->setOptionIdsFilter([$option->getId()]);
555556

app/code/Magento/Bundle/Test/Unit/Model/Product/PriceTest.php

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,59 +8,61 @@
88
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
99

1010
/**
11+
* Test for Model ProductPrice.
12+
*
1113
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1214
*/
1315
class PriceTest extends \PHPUnit_Framework_TestCase
1416
{
1517
/**
16-
* @var \PHPUnit_Framework_MockObject_MockObject
18+
* @var \Magento\CatalogRule\Model\ResourceModel\RuleFactory|\PHPUnit_Framework_MockObject_MockObject
1719
*/
18-
protected $ruleFactoryMock;
20+
private $ruleFactoryMock;
1921

2022
/**
21-
* @var \PHPUnit_Framework_MockObject_MockObject
23+
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
2224
*/
23-
protected $localeDateMock;
25+
private $localeDateMock;
2426

2527
/**
26-
* @var \PHPUnit_Framework_MockObject_MockObject
28+
* @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
2729
*/
28-
protected $storeManagerMock;
30+
private $storeManagerMock;
2931

3032
/**
31-
* @var \PHPUnit_Framework_MockObject_MockObject
33+
* @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject
3234
*/
33-
protected $customerSessionMock;
35+
private $customerSessionMock;
3436

3537
/**
36-
* @var \PHPUnit_Framework_MockObject_MockObject
38+
* @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
3739
*/
38-
protected $eventManagerMock;
40+
private $eventManagerMock;
3941

4042
/**
41-
* @var \PHPUnit_Framework_MockObject_MockObject
43+
* @var \Magento\Catalog\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
4244
*/
43-
protected $catalogHelperMock;
45+
private $catalogHelperMock;
4446

4547
/**
46-
* @var \PHPUnit_Framework_MockObject_MockObject
48+
* @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject
4749
*/
48-
protected $storeMock;
50+
private $storeMock;
4951

5052
/**
5153
* @var \Magento\Bundle\Model\Product\Price
5254
*/
53-
protected $model;
55+
private $model;
5456

5557
/**
5658
* @var \Magento\Framework\Pricing\PriceCurrencyInterface|\PHPUnit_Framework_MockObject_MockObject
5759
*/
58-
protected $priceCurrency;
60+
private $priceCurrency;
5961

6062
/**
61-
* @var \Magento\Customer\Api\GroupManagementInterface
63+
* @var \Magento\Customer\Api\GroupManagementInterface|\PHPUnit_Framework_MockObject_MockObject
6264
*/
63-
protected $groupManagement;
65+
private $groupManagement;
6466

6567
/**
6668
* Serializer interface instance.
@@ -69,6 +71,11 @@ class PriceTest extends \PHPUnit_Framework_TestCase
6971
*/
7072
private $serializer;
7173

74+
/**
75+
* Set up.
76+
*
77+
* @return void
78+
*/
7279
protected function setUp()
7380
{
7481
$this->ruleFactoryMock = $this->getMock(
@@ -128,6 +135,8 @@ function ($value) {
128135
}
129136

130137
/**
138+
* Test for calculateSpecialPrice().
139+
*
131140
* @param float $finalPrice
132141
* @param float $specialPrice
133142
* @param int $callsNumber
@@ -137,6 +146,7 @@ function ($value) {
137146
* @covers \Magento\Bundle\Model\Product\Price::calculateSpecialPrice
138147
* @covers \Magento\Bundle\Model\Product\Price::__construct
139148
* @dataProvider calculateSpecialPrice
149+
* @return void
140150
*/
141151
public function testCalculateSpecialPrice($finalPrice, $specialPrice, $callsNumber, $dateInInterval, $expected)
142152
{
@@ -156,6 +166,8 @@ public function testCalculateSpecialPrice($finalPrice, $specialPrice, $callsNumb
156166
}
157167

158168
/**
169+
* Data provider for calculateSpecialPrice() test.
170+
*
159171
* @return array
160172
*/
161173
public function calculateSpecialPrice()
@@ -170,6 +182,11 @@ public function calculateSpecialPrice()
170182
];
171183
}
172184

185+
/**
186+
* Test for getTotalBundleItemsPrice() with noCustom options.
187+
*
188+
* @return void
189+
*/
173190
public function testGetTotalBundleItemsPriceWithNoCustomOptions()
174191
{
175192
$productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
@@ -184,8 +201,11 @@ public function testGetTotalBundleItemsPriceWithNoCustomOptions()
184201
}
185202

186203
/**
204+
* Test for getTotalBundleItemsPrice() with empty options.
205+
*
187206
* @param string|null $value
188207
* @dataProvider dataProviderWithEmptyOptions
208+
* @return void
189209
*/
190210
public function testGetTotalBundleItemsPriceWithEmptyOptions($value)
191211
{
@@ -213,6 +233,8 @@ public function testGetTotalBundleItemsPriceWithEmptyOptions($value)
213233
}
214234

215235
/**
236+
* Data provider for getTotalBundleItemsPrice() with empty options.
237+
*
216238
* @return array
217239
*/
218240
public function dataProviderWithEmptyOptions()
@@ -224,6 +246,11 @@ public function dataProviderWithEmptyOptions()
224246
];
225247
}
226248

249+
/**
250+
* Test for getTotalBundleItemsPrice() with empty options.
251+
*
252+
* @return void
253+
*/
227254
public function testGetTotalBundleItemsPriceWithNoItems()
228255
{
229256
$storeId = 1;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Api;
8+
9+
/**
10+
* Base prices storage.
11+
* @api
12+
*/
13+
interface BasePriceStorageInterface
14+
{
15+
/**
16+
* Return product prices.
17+
*
18+
* @param string[] $skus
19+
* @return \Magento\Catalog\Api\Data\BasePriceInterface[]
20+
*/
21+
public function get(array $skus);
22+
23+
/**
24+
* Add or update product prices.
25+
*
26+
* @param \Magento\Catalog\Api\Data\BasePriceInterface[] $prices
27+
* @return bool Will returned True if updated.
28+
*/
29+
public function update(array $prices);
30+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Api;
8+
9+
/**
10+
* Product cost storage.
11+
* @api
12+
*/
13+
interface CostStorageInterface
14+
{
15+
/**
16+
* Return product prices.
17+
*
18+
* @param string[] $skus
19+
* @return \Magento\Catalog\Api\Data\CostInterface[]
20+
*/
21+
public function get(array $skus);
22+
23+
/**
24+
* Add or update product cost.
25+
*
26+
* @param \Magento\Catalog\Api\Data\CostInterface[] $prices
27+
* @return bool Will returned True if updated.
28+
*/
29+
public function update(array $prices);
30+
31+
/**
32+
* Delete product cost.
33+
*
34+
* @param string[] $skus
35+
* @return bool Will returned True if deleted.
36+
* @throws \Magento\Framework\Exception\CouldNotDeleteException
37+
*/
38+
public function delete(array $skus);
39+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Api\Data;
8+
9+
/**
10+
* Price interface.
11+
* @api
12+
*/
13+
interface BasePriceInterface extends \Magento\Framework\Api\ExtensibleDataInterface
14+
{
15+
/**#@+
16+
* Constants
17+
*/
18+
const PRICE = 'price';
19+
const STORE_ID = 'store_id';
20+
const SKU = 'sku';
21+
/**#@-*/
22+
23+
/**
24+
* Set price.
25+
*
26+
* @param float $price
27+
* @return $this
28+
*/
29+
public function setPrice($price);
30+
31+
/**
32+
* Get price.
33+
*
34+
* @return float
35+
*/
36+
public function getPrice();
37+
38+
/**
39+
* Set store id.
40+
*
41+
* @param int $storeId
42+
* @return $this
43+
*/
44+
public function setStoreId($storeId);
45+
46+
/**
47+
* Get store id.
48+
*
49+
* @return int
50+
*/
51+
public function getStoreId();
52+
53+
/**
54+
* Set SKU.
55+
*
56+
* @param string $sku
57+
* @return $this
58+
*/
59+
public function setSku($sku);
60+
61+
/**
62+
* Get SKU.
63+
*
64+
* @return string
65+
*/
66+
public function getSku();
67+
68+
/**
69+
* Retrieve existing extension attributes object or create a new one.
70+
*
71+
* @return \Magento\Catalog\Api\Data\BasePriceExtensionInterface|null
72+
*/
73+
public function getExtensionAttributes();
74+
75+
/**
76+
* Set an extension attributes object.
77+
*
78+
* @param \Magento\Catalog\Api\Data\BasePriceExtensionInterface $extensionAttributes
79+
* @return $this
80+
*/
81+
public function setExtensionAttributes(
82+
\Magento\Catalog\Api\Data\BasePriceExtensionInterface $extensionAttributes
83+
);
84+
}

0 commit comments

Comments
 (0)