Skip to content

Commit 548bdc0

Browse files
committed
MC-33071: Stabilize Web-API tests
1 parent a17fb2f commit 548bdc0

File tree

12 files changed

+58
-26
lines changed

12 files changed

+58
-26
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ public static function getFixture($key)
258258
*
259259
* @param \Magento\Framework\Model\AbstractModel $model
260260
* @param bool $secure
261-
* @return \Magento\TestFramework\TestCase\WebapiAbstract
261+
* @return void
262262
* //phpcs:disable
263263
*/
264-
public static function callModelDelete($model, $secure = false)
264+
public static function callModelDelete($model, $secure = false) : void
265265
{
266266
//phpcs:enable
267267
if ($model instanceof \Magento\Framework\Model\AbstractModel && $model->getId()) {

dev/tests/api-functional/testsuite/Magento/Catalog/Api/CostStorageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\Webapi\Exception as HTTPExceptionCodes;
1111

1212
/**
13-
* CostStorage test.
13+
* Catalog Cost Storage API test.
1414
*/
1515
class CostStorageTest extends WebapiAbstract
1616
{

dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ public function testGetList()
9494
public function testGetUndefinedProduct()
9595
{
9696
$this->expectException(\Exception::class);
97-
$this->expectExceptionMessage('The product that was requested doesn\'t exist. Verify the product and try again.');
97+
$this->expectExceptionMessage(
98+
'The product that was requested doesn\'t exist. Verify the product and try again.'
99+
);
98100

99101
$productSku = 'product_not_exist';
100102
$this->getList($productSku);

dev/tests/api-functional/testsuite/Magento/Customer/Api/AddressMetadataTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Magento\TestFramework\TestCase\WebapiAbstract;
1515

1616
/**
17-
* Class AddressMetadataTest
17+
* Customer Address Metadata API test
1818
*/
1919
class AddressMetadataTest extends WebapiAbstract
2020
{

dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\TestFramework\Helper\Bootstrap;
1313

1414
/**
15-
* Class CustomerMetadataTest
15+
* Customer Metadata API test
1616
*/
1717
class CustomerMetadataTest extends WebapiAbstract
1818
{
@@ -274,6 +274,7 @@ public function getAttributesDataProvider()
274274
];
275275
}
276276

277+
// phpcs:disable Generic.Metrics.NestingLevel
277278
/**
278279
* Checks that expected and actual attribute metadata validation rules are equal
279280
* and removes the validation rules entry from expected and actual attribute metadata
@@ -317,6 +318,7 @@ public function checkValidationRules($expectedResult, $actualResult)
317318
}
318319
return [$expectedResult, $actualResult];
319320
}
321+
// phpcs:enable
320322

321323
/**
322324
* Check specific attribute validation rules in set of multiple attributes

dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\TestFramework\TestCase\WebapiAbstract;
1414

1515
/**
16-
* Class GroupManagementTest
16+
* Customer Group Management API test
1717
*/
1818
class GroupManagementTest extends WebapiAbstract
1919
{

dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Magento\TestFramework\TestCase\WebapiAbstract;
2020

2121
/**
22-
* Class GroupRepositoryTest
22+
* Customer Group Repository API test
2323
*
2424
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2525
*/
@@ -40,7 +40,7 @@ class GroupRepositoryTest extends WebapiAbstract
4040
private $groupRepository;
4141

4242
/**
43-
* @var \Magento\Customer\Api\Data\groupInterfaceFactory
43+
* @var \Magento\Customer\Api\Data\GroupInterfaceFactory
4444
*/
4545
private $customerGroupFactory;
4646

dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,9 @@ public function getInvalidNumberOfDownloads()
677677
public function testCreateThrowsExceptionIfTargetProductTypeIsNotDownloadable()
678678
{
679679
$this->expectException(\Exception::class);
680-
$this->expectExceptionMessage('The product needs to be the downloadable type. Verify the product and try again.');
680+
$this->expectExceptionMessage(
681+
'The product needs to be the downloadable type. Verify the product and try again.'
682+
);
681683

682684
$this->createServiceInfo['rest']['resourcePath'] = '/V1/products/simple/downloadable-links';
683685
$requestData = [
@@ -703,7 +705,9 @@ public function testCreateThrowsExceptionIfTargetProductTypeIsNotDownloadable()
703705
public function testCreateThrowsExceptionIfTargetProductDoesNotExist()
704706
{
705707
$this->expectException(\Exception::class);
706-
$this->expectExceptionMessage('The product that was requested doesn\'t exist. Verify the product and try again.');
708+
$this->expectExceptionMessage(
709+
'The product that was requested doesn\'t exist. Verify the product and try again.'
710+
);
707711

708712
$this->createServiceInfo['rest']['resourcePath'] = '/V1/products/wrong-sku/downloadable-links';
709713
$requestData = [
@@ -803,7 +807,9 @@ public function testUpdateSavesDataInGlobalScopeAndDoesNotAffectValuesStoredInSt
803807
public function testUpdateThrowsExceptionIfTargetProductDoesNotExist()
804808
{
805809
$this->expectException(\Exception::class);
806-
$this->expectExceptionMessage('The product that was requested doesn\'t exist. Verify the product and try again.');
810+
$this->expectExceptionMessage(
811+
'The product that was requested doesn\'t exist. Verify the product and try again.'
812+
);
807813

808814
$this->updateServiceInfo['rest']['resourcePath'] = '/V1/products/wrong-sku/downloadable-links/1';
809815
$requestData = [
@@ -829,7 +835,9 @@ public function testUpdateThrowsExceptionIfTargetProductDoesNotExist()
829835
public function testUpdateThrowsExceptionIfThereIsNoDownloadableLinkWithGivenId()
830836
{
831837
$this->expectException(\Exception::class);
832-
$this->expectExceptionMessage('No downloadable link with the provided ID was found. Verify the ID and try again.');
838+
$this->expectExceptionMessage(
839+
'No downloadable link with the provided ID was found. Verify the ID and try again.'
840+
);
833841

834842
$linkId = 9999;
835843
$this->updateServiceInfo['rest']['resourcePath']
@@ -961,7 +969,9 @@ public function testDelete()
961969
public function testDeleteThrowsExceptionIfThereIsNoDownloadableLinkWithGivenId()
962970
{
963971
$this->expectException(\Exception::class);
964-
$this->expectExceptionMessage('No downloadable link with the provided ID was found. Verify the ID and try again.');
972+
$this->expectExceptionMessage(
973+
'No downloadable link with the provided ID was found. Verify the ID and try again.'
974+
);
965975

966976
$linkId = 9999;
967977
$this->deleteServiceInfo['rest']['resourcePath'] = "/V1/products/downloadable-links/{$linkId}";

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductTextAttributesTest.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,21 @@ public function testHtmlDirectivesRendering()
134134
QUERY;
135135
$response = $this->graphQlQuery($query);
136136

137-
self::assertStringContainsString($assertionCmsBlockText, $response['products']['items'][0]['description']['html']);
138-
self::assertStringNotContainsString('{{block id', $response['products']['items'][0]['description']['html']);
139-
self::assertStringContainsString($assertionCmsBlockText, $response['products']['items'][0]['short_description']['html']);
140-
self::assertStringNotContainsString('{{block id', $response['products']['items'][0]['short_description']['html']);
137+
self::assertStringContainsString(
138+
$assertionCmsBlockText,
139+
$response['products']['items'][0]['description']['html']
140+
);
141+
self::assertStringNotContainsString(
142+
'{{block id',
143+
$response['products']['items'][0]['description']['html']
144+
);
145+
self::assertStringContainsString(
146+
$assertionCmsBlockText,
147+
$response['products']['items'][0]['short_description']['html']
148+
);
149+
self::assertStringNotContainsString(
150+
'{{block id',
151+
$response['products']['items'][0]['short_description']['html']
152+
);
141153
}
142154
}

dev/tests/api-functional/testsuite/Magento/Quote/Api/CartManagementTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
use Magento\TestFramework\TestCase\WebapiAbstract;
1212

1313
/**
14-
* Class CartManagementTest
15-
* @package Magento\Quote\Api
14+
* Quote Cart Management API test
1615
* @magentoAppIsolation enabled
1716
*/
1817
class CartManagementTest extends WebapiAbstract
@@ -282,7 +281,9 @@ public function testAssignCustomerThrowsExceptionIfTargetCartIsNotAnonymous()
282281
public function testAssignCustomerThrowsExceptionIfCartIsAssignedToDifferentStore()
283282
{
284283
$this->expectException(\Exception::class);
285-
$this->expectExceptionMessage('The customer can\'t be assigned to the cart. The cart belongs to a different store.');
284+
$this->expectExceptionMessage(
285+
'The customer can\'t be assigned to the cart. The cart belongs to a different store.'
286+
);
286287

287288
$repository = $this->objectManager->create(\Magento\Customer\Api\CustomerRepositoryInterface::class);
288289
/** @var $customer \Magento\Customer\Api\Data\CustomerInterface */

0 commit comments

Comments
 (0)