Skip to content

Commit b2c21ff

Browse files
committed
MC-39901: Stabilize Web-API tests
- Fix static tests
1 parent f9979d7 commit b2c21ff

File tree

12 files changed

+64
-25
lines changed

12 files changed

+64
-25
lines changed

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: 2 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

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: 1 addition & 1 deletion
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
*/

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 */

dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderInvoiceCreateTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ public function testInvoiceCreate()
101101
public function testOrderWithBundleInvoicedWithInvalidQuantitiesReturnsError()
102102
{
103103
$this->expectException(\Exception::class);
104-
$this->expectExceptionMessageMatches('/Invoice Document Validation Error\\(s\\):(?:\\n|\\\\n)The invoice can\'t be created without products. Add products and try again./');
104+
$this->expectExceptionMessageMatches(
105+
'/Invoice Document Validation Error\\(s\\):(?:\\n|\\\\n)'
106+
. 'The invoice can\'t be created without products. Add products and try again./'
107+
);
105108

106109
/** @var \Magento\Sales\Model\Order $existingOrder */
107110
$existingOrder = $this->objectManager->create(\Magento\Sales\Model\Order::class)
@@ -148,7 +151,10 @@ public function testOrderWithBundleInvoicedWithInvalidQuantitiesReturnsError()
148151
public function testOrderWithConfigurableProductInvoicedWithInvalidQuantitiesReturnsError()
149152
{
150153
$this->expectException(\Exception::class);
151-
$this->expectExceptionMessageMatches('/Invoice Document Validation Error\\(s\\):(?:\\n|\\\\n)The invoice can\'t be created without products. Add products and try again./');
154+
$this->expectExceptionMessageMatches(
155+
'/Invoice Document Validation Error\\(s\\):(?:\\n|\\\\n)'
156+
. 'The invoice can\'t be created without products. Add products and try again./'
157+
);
152158

153159
/** @var \Magento\Sales\Model\Order $existingOrder */
154160
$existingOrder = $this->objectManager->create(\Magento\Sales\Model\Order::class)

dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipOrderTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ public function testShipOrder()
150150
public function testShipOrderWithoutTrackingNumberReturnsError()
151151
{
152152
$this->expectException(\Exception::class);
153-
$this->expectExceptionMessageMatches('/Shipment Document Validation Error\\(s\\):(?:\\n|\\\\n)Please enter a tracking number./');
153+
$this->expectExceptionMessageMatches(
154+
'/Shipment Document Validation Error\\(s\\):(?:\\n|\\\\n)Please enter a tracking number./'
155+
);
154156

155157
$this->_markTestAsRestOnly('SOAP requires an tracking number to be provided so this case is not possible.');
156158

0 commit comments

Comments
 (0)