Skip to content

Commit 9598e57

Browse files
committed
Static test fix.
1 parent 13ca551 commit 9598e57

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

dev/tests/api-functional/framework/Magento/TestFramework/TestCase/WebapiAbstract.php

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ abstract class WebapiAbstract extends \PHPUnit\Framework\TestCase
103103

104104
/**
105105
* Initialize fixture namespaces.
106+
* //phpcs:disable
106107
*/
107108
public static function setUpBeforeClass()
108109
{
110+
//phpcs:enable
109111
parent::setUpBeforeClass();
110112
self::_setFixtureNamespace();
111113
}
@@ -114,9 +116,11 @@ public static function setUpBeforeClass()
114116
* Run garbage collector for cleaning memory
115117
*
116118
* @return void
119+
* //phpcs:disable
117120
*/
118121
public static function tearDownAfterClass()
119122
{
123+
//phpcs:enable
120124
//clear garbage in memory
121125
gc_collect_cycles();
122126

@@ -134,8 +138,7 @@ public static function tearDownAfterClass()
134138
}
135139

136140
/**
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
139142
*
140143
* @return void
141144
*/
@@ -179,6 +182,8 @@ protected function _webApiCall(
179182

180183
/**
181184
* Mark test to be executed for SOAP adapter only.
185+
*
186+
* @param ?string $message
182187
*/
183188
protected function _markTestAsSoapOnly($message = null)
184189
{
@@ -189,6 +194,8 @@ protected function _markTestAsSoapOnly($message = null)
189194

190195
/**
191196
* Mark test to be executed for REST adapter only.
197+
*
198+
* @param ?string $message
192199
*/
193200
protected function _markTestAsRestOnly($message = null)
194201
{
@@ -204,9 +211,11 @@ protected function _markTestAsRestOnly($message = null)
204211
* @param mixed $fixture
205212
* @param int $tearDown
206213
* @return void
214+
* //phpcs:disable
207215
*/
208216
public static function setFixture($key, $fixture, $tearDown = self::AUTO_TEAR_DOWN_AFTER_METHOD)
209217
{
218+
//phpcs:enable
210219
$fixturesNamespace = self::_getFixtureNamespace();
211220
if (!isset(self::$_fixtures[$fixturesNamespace])) {
212221
self::$_fixtures[$fixturesNamespace] = [];
@@ -232,9 +241,11 @@ public static function setFixture($key, $fixture, $tearDown = self::AUTO_TEAR_DO
232241
*
233242
* @param string $key
234243
* @return mixed
244+
* //phpcs:disable
235245
*/
236246
public static function getFixture($key)
237247
{
248+
//phpcs:enable
238249
$fixturesNamespace = self::_getFixtureNamespace();
239250
if (array_key_exists($key, self::$_fixtures[$fixturesNamespace])) {
240251
return self::$_fixtures[$fixturesNamespace][$key];
@@ -248,9 +259,11 @@ public static function getFixture($key)
248259
* @param \Magento\Framework\Model\AbstractModel $model
249260
* @param bool $secure
250261
* @return \Magento\TestFramework\TestCase\WebapiAbstract
262+
* //phpcs:disable
251263
*/
252264
public static function callModelDelete($model, $secure = false)
253265
{
266+
//phpcs:enable
254267
if ($model instanceof \Magento\Framework\Model\AbstractModel && $model->getId()) {
255268
if ($secure) {
256269
self::_enableSecureArea();
@@ -301,9 +314,11 @@ protected function _getWebApiAdapter($webApiAdapterCode)
301314
* Set fixtures namespace
302315
*
303316
* @throws \RuntimeException
317+
* //phpcs:disable
304318
*/
305319
protected static function _setFixtureNamespace()
306320
{
321+
//phpcs:enable
307322
if (self::$_fixturesNamespace !== null) {
308323
throw new \RuntimeException('Fixture namespace is already set.');
309324
}
@@ -312,9 +327,11 @@ protected static function _setFixtureNamespace()
312327

313328
/**
314329
* Unset fixtures namespace
330+
* //phpcs:disable
315331
*/
316332
protected static function _unsetFixtureNamespace()
317333
{
334+
//phpcs:enable
318335
$fixturesNamespace = self::_getFixtureNamespace();
319336
unset(self::$_fixtures[$fixturesNamespace]);
320337
self::$_fixturesNamespace = null;
@@ -325,9 +342,12 @@ protected static function _unsetFixtureNamespace()
325342
*
326343
* @throws \RuntimeException
327344
* @return string
345+
* //phpcs:disable
328346
*/
329347
protected static function _getFixtureNamespace()
330348
{
349+
//phpcs:enable
350+
331351
$fixtureNamespace = self::$_fixturesNamespace;
332352
if ($fixtureNamespace === null) {
333353
throw new \RuntimeException('Fixture namespace must be set.');
@@ -340,9 +360,12 @@ protected static function _getFixtureNamespace()
340360
*
341361
* @param bool $flag
342362
* @return void
363+
* //phpcs:disable
343364
*/
344365
protected static function _enableSecureArea($flag = true)
345366
{
367+
//phpcs:enable
368+
346369
/** @var $objectManager \Magento\TestFramework\ObjectManager */
347370
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
348371

@@ -389,9 +412,11 @@ protected function _assertMessagesEqual($expectedMessages, $receivedMessages)
389412
* Delete array of fixtures
390413
*
391414
* @param array $fixtures
415+
* //phpcs:disable
392416
*/
393417
protected static function _deleteFixtures($fixtures)
394418
{
419+
//phpcs:enable
395420
foreach ($fixtures as $fixture) {
396421
self::deleteFixture($fixture, true);
397422
}
@@ -403,9 +428,11 @@ protected static function _deleteFixtures($fixtures)
403428
* @param string $key
404429
* @param bool $secure
405430
* @return void
431+
* //phpcs:disable
406432
*/
407433
public static function deleteFixture($key, $secure = false)
408434
{
435+
//phpcs:enable
409436
$fixturesNamespace = self::_getFixtureNamespace();
410437
if (array_key_exists($key, self::$_fixtures[$fixturesNamespace])) {
411438
self::callModelDelete(self::$_fixtures[$fixturesNamespace][$key], $secure);
@@ -457,11 +484,11 @@ protected function _cleanAppConfigCache()
457484
/**
458485
* Update application config data
459486
*
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
465492
* @return \Magento\TestFramework\TestCase\WebapiAbstract
466493
* @throws \RuntimeException
467494
*/
@@ -521,6 +548,8 @@ protected function _restoreAppConfig()
521548
}
522549

523550
/**
551+
* Process rest exception result.
552+
*
524553
* @param \Exception $e
525554
* @return array
526555
* <pre> ex.
@@ -667,6 +696,8 @@ protected function _checkWrappedErrors($expectedWrappedErrors, $errorDetails)
667696
}
668697

669698
/**
699+
* Get actual wrapped errors.
700+
*
670701
* @param \stdClass $errorNode
671702
* @return array
672703
*/
@@ -695,6 +726,8 @@ private function getActualWrappedErrors(\stdClass $errorNode)
695726
}
696727

697728
/**
729+
* Assert webapi errors.
730+
*
698731
* @param array $serviceInfo
699732
* @param array $data
700733
* @param array $expectedErrorData

0 commit comments

Comments
 (0)