4
4
* Copyright © Magento, Inc. All rights reserved.
5
5
* See COPYING.txt for license details.
6
6
*/
7
+ declare (strict_types=1 );
7
8
8
9
namespace Magento \ConfigurableProduct \Api ;
9
10
@@ -21,8 +22,10 @@ class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstrac
21
22
22
23
/**
23
24
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
25
+ *
26
+ * @return void
24
27
*/
25
- public function testGet ()
28
+ public function testGet (): void
26
29
{
27
30
$ productSku = 'configurable ' ;
28
31
@@ -54,8 +57,10 @@ public function testGet()
54
57
55
58
/**
56
59
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
60
+ *
61
+ * @return void
57
62
*/
58
- public function testGetList ()
63
+ public function testGetList (): void
59
64
{
60
65
$ productSku = 'configurable ' ;
61
66
@@ -90,8 +95,9 @@ public function testGetList()
90
95
}
91
96
92
97
/**
98
+ * @return void
93
99
*/
94
- public function testGetUndefinedProduct ()
100
+ public function testGetUndefinedProduct (): void
95
101
{
96
102
$ this ->expectException (\Exception::class);
97
103
$ this ->expectExceptionMessage (
@@ -104,8 +110,10 @@ public function testGetUndefinedProduct()
104
110
105
111
/**
106
112
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
113
+ *
114
+ * @return void
107
115
*/
108
- public function testGetUndefinedOption ()
116
+ public function testGetUndefinedOption (): void
109
117
{
110
118
$ expectedMessage = 'The "%1" entity that was requested doesn \'t exist. Verify the entity and try again. ' ;
111
119
$ productSku = 'configurable ' ;
@@ -127,8 +135,10 @@ public function testGetUndefinedOption()
127
135
128
136
/**
129
137
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
138
+ *
139
+ * @return void
130
140
*/
131
- public function testDelete ()
141
+ public function testDelete (): void
132
142
{
133
143
$ productSku = 'configurable ' ;
134
144
@@ -144,8 +154,10 @@ public function testDelete()
144
154
/**
145
155
* @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
146
156
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/configurable_attribute.php
157
+ *
158
+ * @return void
147
159
*/
148
- public function testAdd ()
160
+ public function testAdd (): void
149
161
{
150
162
/** @var AttributeRepositoryInterface $attributeRepository */
151
163
$ attributeRepository = Bootstrap::getObjectManager ()->create (AttributeRepositoryInterface::class);
@@ -181,8 +193,10 @@ public function testAdd()
181
193
182
194
/**
183
195
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
196
+ *
197
+ * @return void
184
198
*/
185
- public function testUpdate ()
199
+ public function testUpdate (): void
186
200
{
187
201
$ productSku = 'configurable ' ;
188
202
$ configurableAttribute = $ this ->getConfigurableAttribute ($ productSku );
@@ -218,8 +232,10 @@ public function testUpdate()
218
232
219
233
/**
220
234
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
235
+ *
236
+ * @return void
221
237
*/
222
- public function testUpdateWithoutOptionId ()
238
+ public function testUpdateWithoutOptionId (): void
223
239
{
224
240
$ productSku = 'configurable ' ;
225
241
/** @var AttributeRepositoryInterface $attributeRepository */
@@ -257,6 +273,19 @@ public function testUpdateWithoutOptionId()
257
273
$ this ->assertEquals ($ option ['label ' ], $ configurableAttribute [0 ]['label ' ]);
258
274
}
259
275
276
+ /**
277
+ * @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
278
+ *
279
+ * @return void
280
+ */
281
+ public function testDeleteNotExistsOption (): void
282
+ {
283
+ $ message = (string )__ ('The option that was requested doesn \'t exist. Verify the entity and try again. ' );
284
+ $ this ->expectExceptionMessage ($ message );
285
+ $ this ->expectException (\Exception::class);
286
+ $ this ->delete ('configurable ' , 555 );
287
+ }
288
+
260
289
/**
261
290
* @param string $productSku
262
291
* @return array
0 commit comments