Skip to content

Commit ac48c86

Browse files
author
Stanislav Idolov
committed
magento-engcom/magento2ce#2203: Fixed tests failures
1 parent 37b0b1f commit ac48c86

File tree

5 files changed

+34
-12
lines changed

5 files changed

+34
-12
lines changed

app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/**
1313
* Responsible for Select object creation, works as a builder. Returns Select as result;
14+
*
1415
* Used in SQL assemblers.
1516
*/
1617
class SelectBuilder

app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Exception\NoSuchEntityException;
1111
use Magento\Framework\Exception\StateException;
1212

13+
/**
14+
* Eav Option Management
15+
*/
1316
class OptionManagement implements \Magento\Eav\Api\AttributeOptionManagementInterface
1417
{
1518
/**
@@ -36,7 +39,7 @@ public function __construct(
3639
}
3740

3841
/**
39-
* {@inheritdoc}
42+
* @inheritdoc
4043
*/
4144
public function add($entityType, $attributeCode, $option)
4245
{
@@ -79,7 +82,7 @@ public function add($entityType, $attributeCode, $option)
7982
}
8083

8184
/**
82-
* {@inheritdoc}
85+
* @inheritdoc
8386
*/
8487
public function delete($entityType, $attributeCode, $optionId)
8588
{
@@ -110,7 +113,7 @@ public function delete($entityType, $attributeCode, $optionId)
110113
}
111114

112115
/**
113-
* {@inheritdoc}
116+
* @inheritdoc
114117
*/
115118
public function getItems($entityType, $attributeCode)
116119
{
@@ -129,6 +132,8 @@ public function getItems($entityType, $attributeCode)
129132
}
130133

131134
/**
135+
* Validate option
136+
*
132137
* @param \Magento\Eav\Api\Data\AttributeInterface $attribute
133138
* @param int $optionId
134139
* @throws NoSuchEntityException
@@ -148,6 +153,8 @@ protected function validateOption($attribute, $optionId)
148153
}
149154

150155
/**
156+
* Returns option id
157+
*
151158
* @param \Magento\Eav\Api\Data\AttributeOptionInterface $option
152159
* @return string
153160
*/
@@ -157,6 +164,8 @@ private function getOptionId(\Magento\Eav\Api\Data\AttributeOptionInterface $opt
157164
}
158165

159166
/**
167+
* Set option value
168+
*
160169
* @param \Magento\Eav\Api\Data\AttributeOptionInterface $option
161170
* @param \Magento\Eav\Api\Data\AttributeInterface $attribute
162171
* @param string $optionLabel

app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/OptionManagementTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public function testAdd()
5959
$labelMock = $this->createMock(\Magento\Eav\Api\Data\AttributeOptionLabelInterface::class);
6060
$option =
6161
['value' => [
62-
'new_option' => [
62+
'id_new_option' => [
6363
0 => 'optionLabel',
6464
42 => 'labelLabel',
6565
],
6666
],
6767
'order' => [
68-
'new_option' => 'optionSortOrder',
68+
'id_new_option' => 'optionSortOrder',
6969
],
7070
];
7171

@@ -78,10 +78,10 @@ public function testAdd()
7878
$labelMock->expects($this->once())->method('getStoreId')->willReturn(42);
7979
$labelMock->expects($this->once())->method('getLabel')->willReturn('labelLabel');
8080
$optionMock->expects($this->once())->method('getIsDefault')->willReturn(true);
81-
$attributeMock->expects($this->once())->method('setDefault')->with(['new_option']);
81+
$attributeMock->expects($this->once())->method('setDefault')->with(['id_new_option']);
8282
$attributeMock->expects($this->once())->method('setOption')->with($option);
8383
$this->resourceModelMock->expects($this->once())->method('save')->with($attributeMock);
84-
$this->assertEquals('new_option', $this->model->add($entityType, $attributeCode, $optionMock));
84+
$this->assertEquals('id_new_option', $this->model->add($entityType, $attributeCode, $optionMock));
8585
}
8686

8787
/**
@@ -167,13 +167,13 @@ public function testAddWithCannotSaveException()
167167
$labelMock = $this->createMock(\Magento\Eav\Api\Data\AttributeOptionLabelInterface::class);
168168
$option =
169169
['value' => [
170-
'new_option' => [
170+
'id_new_option' => [
171171
0 => 'optionLabel',
172172
42 => 'labelLabel',
173173
],
174174
],
175175
'order' => [
176-
'new_option' => 'optionSortOrder',
176+
'id_new_option' => 'optionSortOrder',
177177
],
178178
];
179179

@@ -186,7 +186,7 @@ public function testAddWithCannotSaveException()
186186
$labelMock->expects($this->once())->method('getStoreId')->willReturn(42);
187187
$labelMock->expects($this->once())->method('getLabel')->willReturn('labelLabel');
188188
$optionMock->expects($this->once())->method('getIsDefault')->willReturn(true);
189-
$attributeMock->expects($this->once())->method('setDefault')->with(['new_option']);
189+
$attributeMock->expects($this->once())->method('setDefault')->with(['id_new_option']);
190190
$attributeMock->expects($this->once())->method('setOption')->with($option);
191191
$this->resourceModelMock->expects($this->once())->method('save')->with($attributeMock)
192192
->willThrowException(new \Exception());

app/code/Magento/Paypal/Model/AbstractConfig.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function setStoreId($storeId)
134134
* Returns payment configuration value
135135
*
136136
* @param string $key
137-
* @param null $storeId
137+
* @param null|int $storeId
138138
* @return null|string
139139
*
140140
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
@@ -254,7 +254,7 @@ public function isWppApiAvailable()
254254
/**
255255
* Check whether method available for checkout or not
256256
*
257-
* @param null $methodCode
257+
* @param null|string $methodCode
258258
*
259259
* @return bool
260260
*/

app/code/Magento/Paypal/Model/Config.php

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* Config model that is aware of all \Magento\Paypal payment methods
13+
*
1314
* Works with PayPal-specific system configuration
1415
1516
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
@@ -632,6 +633,7 @@ public function __construct(
632633

633634
/**
634635
* Check whether method available for checkout or not
636+
*
635637
* Logic based on merchant country, methods dependence
636638
*
637639
* @param string|null $methodCode
@@ -723,6 +725,7 @@ public function getMerchantCountry()
723725

724726
/**
725727
* Check whether method supported for specified country or not
728+
*
726729
* Use $_methodCode and merchant country by default
727730
*
728731
* @param string|null $method
@@ -896,6 +899,7 @@ public function getExpressCheckoutEditUrl($token)
896899

897900
/**
898901
* Get url for additional actions that PayPal may require customer to do after placing the order.
902+
*
899903
* For instance, redirecting customer to bank for payment confirmation.
900904
*
901905
* @param string $token
@@ -957,6 +961,7 @@ public function areButtonsDynamic()
957961

958962
/**
959963
* Express checkout shortcut pic URL getter
964+
*
960965
* PayPal will ignore "pal", if there is no total amount specified
961966
*
962967
* @param string $localeCode
@@ -996,6 +1001,7 @@ public function getExpressCheckoutInContextImageUrl($localeCode)
9961001

9971002
/**
9981003
* Get PayPal "mark" image URL
1004+
*
9991005
* Supposed to be used on payment methods selection
10001006
* $staticSize is applicable for static images only
10011007
*
@@ -1032,6 +1038,7 @@ public function getPaymentMarkImageUrl($localeCode, $orderTotal = null, $pal = n
10321038

10331039
/**
10341040
* Get "What Is PayPal" localized URL
1041+
*
10351042
* Supposed to be used with "mark" as popup window
10361043
*
10371044
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
@@ -1262,6 +1269,7 @@ public function getExpressCheckoutBASignupOptions()
12621269

12631270
/**
12641271
* Whether to ask customer to create billing agreements
1272+
*
12651273
* Unilateral payments are incompatible with the billing agreements
12661274
*
12671275
* @return bool
@@ -1376,6 +1384,7 @@ public function exportExpressCheckoutStyleSettings(\Magento\Framework\DataObject
13761384

13771385
/**
13781386
* Dynamic PayPal image URL getter
1387+
*
13791388
* Also can render dynamic Acceptance Mark
13801389
*
13811390
* @param string $type
@@ -1725,6 +1734,7 @@ public function getBmlPublisherId()
17251734

17261735
/**
17271736
* Get Display option from stored config
1737+
*
17281738
* @param string $section
17291739
*
17301740
* @return mixed
@@ -1752,6 +1762,7 @@ public function getBmlDisplay($section)
17521762

17531763
/**
17541764
* Get Position option from stored config
1765+
*
17551766
* @param string $section
17561767
*
17571768
* @return mixed
@@ -1767,6 +1778,7 @@ public function getBmlPosition($section)
17671778

17681779
/**
17691780
* Get Size option from stored config
1781+
*
17701782
* @param string $section
17711783
*
17721784
* @return mixed

0 commit comments

Comments
 (0)