Skip to content

Commit 7976cb1

Browse files
committed
MAGETWO-61829: SOAP/REST tests fail on develop branch but builds are green
2 parents 565032d + 6ae3418 commit 7976cb1

File tree

274 files changed

+14210
-635
lines changed

Some content is hidden

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

274 files changed

+14210
-635
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ public function isSalable($product)
546546
$selectionsCollection = $this->_bundleCollection->create();
547547
$selectionsCollection->addAttributeToSelect('status');
548548
$selectionsCollection->addQuantityFilter();
549+
$selectionsCollection->setFlag('product_children', true);
549550
$selectionsCollection->addFilterByRequiredOptions();
550551
$selectionsCollection->setOptionIdsFilter([$option->getId()]);
551552

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

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,67 @@
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

67+
/**
68+
* Set up.
69+
*
70+
* @return void
71+
*/
6572
protected function setUp()
6673
{
6774
$this->ruleFactoryMock = $this->getMock(
@@ -90,6 +97,7 @@ protected function setUp()
9097
false
9198
);
9299
$scopeConfig = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
100+
93101
$objectManagerHelper = new ObjectManagerHelper($this);
94102
$this->model = $objectManagerHelper->getObject(
95103
\Magento\Bundle\Model\Product\Price::class,
@@ -109,6 +117,8 @@ protected function setUp()
109117
}
110118

111119
/**
120+
* Test for calculateSpecialPrice().
121+
*
112122
* @param float $finalPrice
113123
* @param float $specialPrice
114124
* @param int $callsNumber
@@ -118,6 +128,7 @@ protected function setUp()
118128
* @covers \Magento\Bundle\Model\Product\Price::calculateSpecialPrice
119129
* @covers \Magento\Bundle\Model\Product\Price::__construct
120130
* @dataProvider calculateSpecialPrice
131+
* @return void
121132
*/
122133
public function testCalculateSpecialPrice($finalPrice, $specialPrice, $callsNumber, $dateInInterval, $expected)
123134
{
@@ -137,6 +148,8 @@ public function testCalculateSpecialPrice($finalPrice, $specialPrice, $callsNumb
137148
}
138149

139150
/**
151+
* Data provider for calculateSpecialPrice() test.
152+
*
140153
* @return array
141154
*/
142155
public function calculateSpecialPrice()
@@ -151,6 +164,11 @@ public function calculateSpecialPrice()
151164
];
152165
}
153166

167+
/**
168+
* Test for getTotalBundleItemsPrice() with noCustom options.
169+
*
170+
* @return void
171+
*/
154172
public function testGetTotalBundleItemsPriceWithNoCustomOptions()
155173
{
156174
$productMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)
@@ -165,8 +183,11 @@ public function testGetTotalBundleItemsPriceWithNoCustomOptions()
165183
}
166184

167185
/**
186+
* Test for getTotalBundleItemsPrice() with empty options.
187+
*
168188
* @param string|null $value
169189
* @dataProvider dataProviderWithEmptyOptions
190+
* @return void
170191
*/
171192
public function testGetTotalBundleItemsPriceWithEmptyOptions($value)
172193
{
@@ -194,6 +215,8 @@ public function testGetTotalBundleItemsPriceWithEmptyOptions($value)
194215
}
195216

196217
/**
218+
* Data provider for getTotalBundleItemsPrice() with empty options.
219+
*
197220
* @return array
198221
*/
199222
public function dataProviderWithEmptyOptions()
@@ -205,6 +228,11 @@ public function dataProviderWithEmptyOptions()
205228
];
206229
}
207230

231+
/**
232+
* Test for getTotalBundleItemsPrice() with empty options.
233+
*
234+
* @return void
235+
*/
208236
public function testGetTotalBundleItemsPriceWithNoItems()
209237
{
210238
$storeId = 1;
@@ -240,9 +268,8 @@ public function testGetTotalBundleItemsPriceWithNoItems()
240268
->method('getStoreId')
241269
->willReturn($storeId);
242270

243-
$dataObjectMock->expects($this->once())
244-
->method('getValue')
245-
->willReturn('a:1:{i:0;s:1:"1";}');
271+
$customOptionValue = 'a:1:{i:0;s:1:"1";}';
272+
$dataObjectMock->expects($this->once())->method('getValue')->willReturn($customOptionValue);
246273
$productTypeMock->expects($this->once())
247274
->method('getSelectionsByIds')
248275
->with([1], $productMock)
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)