@@ -103,9 +103,11 @@ abstract class WebapiAbstract extends \PHPUnit\Framework\TestCase
103
103
104
104
/**
105
105
* Initialize fixture namespaces.
106
+ * //phpcs:disable
106
107
*/
107
108
public static function setUpBeforeClass ()
108
109
{
110
+ //phpcs:enable
109
111
parent ::setUpBeforeClass ();
110
112
self ::_setFixtureNamespace ();
111
113
}
@@ -114,9 +116,11 @@ public static function setUpBeforeClass()
114
116
* Run garbage collector for cleaning memory
115
117
*
116
118
* @return void
119
+ * //phpcs:disable
117
120
*/
118
121
public static function tearDownAfterClass ()
119
122
{
123
+ //phpcs:enable
120
124
//clear garbage in memory
121
125
gc_collect_cycles ();
122
126
@@ -134,8 +138,7 @@ public static function tearDownAfterClass()
134
138
}
135
139
136
140
/**
137
- * Call safe delete for models which added to delete list
138
- * Restore config values changed during the test
141
+ * Call safe delete for models which added to delete list, Restore config values changed during the test
139
142
*
140
143
* @return void
141
144
*/
@@ -179,6 +182,8 @@ protected function _webApiCall(
179
182
180
183
/**
181
184
* Mark test to be executed for SOAP adapter only.
185
+ *
186
+ * @param ?string $message
182
187
*/
183
188
protected function _markTestAsSoapOnly ($ message = null )
184
189
{
@@ -189,6 +194,8 @@ protected function _markTestAsSoapOnly($message = null)
189
194
190
195
/**
191
196
* Mark test to be executed for REST adapter only.
197
+ *
198
+ * @param ?string $message
192
199
*/
193
200
protected function _markTestAsRestOnly ($ message = null )
194
201
{
@@ -204,9 +211,11 @@ protected function _markTestAsRestOnly($message = null)
204
211
* @param mixed $fixture
205
212
* @param int $tearDown
206
213
* @return void
214
+ * //phpcs:disable
207
215
*/
208
216
public static function setFixture ($ key , $ fixture , $ tearDown = self ::AUTO_TEAR_DOWN_AFTER_METHOD )
209
217
{
218
+ //phpcs:enable
210
219
$ fixturesNamespace = self ::_getFixtureNamespace ();
211
220
if (!isset (self ::$ _fixtures [$ fixturesNamespace ])) {
212
221
self ::$ _fixtures [$ fixturesNamespace ] = [];
@@ -232,9 +241,11 @@ public static function setFixture($key, $fixture, $tearDown = self::AUTO_TEAR_DO
232
241
*
233
242
* @param string $key
234
243
* @return mixed
244
+ * //phpcs:disable
235
245
*/
236
246
public static function getFixture ($ key )
237
247
{
248
+ //phpcs:enable
238
249
$ fixturesNamespace = self ::_getFixtureNamespace ();
239
250
if (array_key_exists ($ key , self ::$ _fixtures [$ fixturesNamespace ])) {
240
251
return self ::$ _fixtures [$ fixturesNamespace ][$ key ];
@@ -248,9 +259,11 @@ public static function getFixture($key)
248
259
* @param \Magento\Framework\Model\AbstractModel $model
249
260
* @param bool $secure
250
261
* @return \Magento\TestFramework\TestCase\WebapiAbstract
262
+ * //phpcs:disable
251
263
*/
252
264
public static function callModelDelete ($ model , $ secure = false )
253
265
{
266
+ //phpcs:enable
254
267
if ($ model instanceof \Magento \Framework \Model \AbstractModel && $ model ->getId ()) {
255
268
if ($ secure ) {
256
269
self ::_enableSecureArea ();
@@ -301,9 +314,11 @@ protected function _getWebApiAdapter($webApiAdapterCode)
301
314
* Set fixtures namespace
302
315
*
303
316
* @throws \RuntimeException
317
+ * //phpcs:disable
304
318
*/
305
319
protected static function _setFixtureNamespace ()
306
320
{
321
+ //phpcs:enable
307
322
if (self ::$ _fixturesNamespace !== null ) {
308
323
throw new \RuntimeException ('Fixture namespace is already set. ' );
309
324
}
@@ -312,9 +327,11 @@ protected static function _setFixtureNamespace()
312
327
313
328
/**
314
329
* Unset fixtures namespace
330
+ * //phpcs:disable
315
331
*/
316
332
protected static function _unsetFixtureNamespace ()
317
333
{
334
+ //phpcs:enable
318
335
$ fixturesNamespace = self ::_getFixtureNamespace ();
319
336
unset(self ::$ _fixtures [$ fixturesNamespace ]);
320
337
self ::$ _fixturesNamespace = null ;
@@ -325,9 +342,12 @@ protected static function _unsetFixtureNamespace()
325
342
*
326
343
* @throws \RuntimeException
327
344
* @return string
345
+ * //phpcs:disable
328
346
*/
329
347
protected static function _getFixtureNamespace ()
330
348
{
349
+ //phpcs:enable
350
+
331
351
$ fixtureNamespace = self ::$ _fixturesNamespace ;
332
352
if ($ fixtureNamespace === null ) {
333
353
throw new \RuntimeException ('Fixture namespace must be set. ' );
@@ -340,9 +360,12 @@ protected static function _getFixtureNamespace()
340
360
*
341
361
* @param bool $flag
342
362
* @return void
363
+ * //phpcs:disable
343
364
*/
344
365
protected static function _enableSecureArea ($ flag = true )
345
366
{
367
+ //phpcs:enable
368
+
346
369
/** @var $objectManager \Magento\TestFramework\ObjectManager */
347
370
$ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
348
371
@@ -389,9 +412,11 @@ protected function _assertMessagesEqual($expectedMessages, $receivedMessages)
389
412
* Delete array of fixtures
390
413
*
391
414
* @param array $fixtures
415
+ * //phpcs:disable
392
416
*/
393
417
protected static function _deleteFixtures ($ fixtures )
394
418
{
419
+ //phpcs:enable
395
420
foreach ($ fixtures as $ fixture ) {
396
421
self ::deleteFixture ($ fixture , true );
397
422
}
@@ -403,9 +428,11 @@ protected static function _deleteFixtures($fixtures)
403
428
* @param string $key
404
429
* @param bool $secure
405
430
* @return void
431
+ * //phpcs:disable
406
432
*/
407
433
public static function deleteFixture ($ key , $ secure = false )
408
434
{
435
+ //phpcs:enable
409
436
$ fixturesNamespace = self ::_getFixtureNamespace ();
410
437
if (array_key_exists ($ key , self ::$ _fixtures [$ fixturesNamespace ])) {
411
438
self ::callModelDelete (self ::$ _fixtures [$ fixturesNamespace ][$ key ], $ secure );
@@ -457,11 +484,11 @@ protected function _cleanAppConfigCache()
457
484
/**
458
485
* Update application config data
459
486
*
460
- * @param string $path Config path with the form "section/group/node"
461
- * @param string|int|null $value Value of config item
462
- * @param bool $cleanAppCache If TRUE application cache will be refreshed
463
- * @param bool $updateLocalConfig If TRUE local config object will be updated too
464
- * @param bool $restore If TRUE config value will be restored after test run
487
+ * @param string $path Config path with the form "section/group/node"
488
+ * @param string|int|null $value Value of config item
489
+ * @param bool $cleanAppCache If TRUE application cache will be refreshed
490
+ * @param bool $updateLocalConfig If TRUE local config object will be updated too
491
+ * @param bool $restore If TRUE config value will be restored after test run
465
492
* @return \Magento\TestFramework\TestCase\WebapiAbstract
466
493
* @throws \RuntimeException
467
494
*/
@@ -521,6 +548,8 @@ protected function _restoreAppConfig()
521
548
}
522
549
523
550
/**
551
+ * Process rest exception result.
552
+ *
524
553
* @param \Exception $e
525
554
* @return array
526
555
* <pre> ex.
@@ -667,6 +696,8 @@ protected function _checkWrappedErrors($expectedWrappedErrors, $errorDetails)
667
696
}
668
697
669
698
/**
699
+ * Get actual wrapped errors.
700
+ *
670
701
* @param \stdClass $errorNode
671
702
* @return array
672
703
*/
@@ -695,6 +726,8 @@ private function getActualWrappedErrors(\stdClass $errorNode)
695
726
}
696
727
697
728
/**
729
+ * Assert webapi errors.
730
+ *
698
731
* @param array $serviceInfo
699
732
* @param array $data
700
733
* @param array $expectedErrorData
0 commit comments