Skip to content

Commit d651d50

Browse files
committed
Merge remote-tracking branch 'origin/MC-33071-CE-3' into MC-33071
2 parents d5eb185 + ad582c2 commit d651d50

13 files changed

+48
-43
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
@@ -592,7 +592,7 @@ protected function checkSoapFault(
592592
$expectedWrappedErrors = [],
593593
$traceString = null
594594
) {
595-
$this->assertContains($expectedMessage, $soapFault->getMessage(), "Fault message is invalid.");
595+
$this->assertStringContainsString($expectedMessage, $soapFault->getMessage(), "Fault message is invalid.");
596596

597597
$errorDetailsNode = 'GenericFault';
598598
$errorDetails = isset($soapFault->detail->$errorDetailsNode) ? $soapFault->detail->$errorDetailsNode : null;
@@ -611,7 +611,7 @@ protected function checkSoapFault(
611611
->getMode();
612612
if ($mode == \Magento\Framework\App\State::MODE_DEVELOPER) {
613613
/** Developer mode changes tested behavior and it cannot properly be tested for now */
614-
$this->assertContains(
614+
$this->assertStringContainsString(
615615
$traceString,
616616
$errorDetails->$traceNode,
617617
'Trace Information is incorrect.'

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected function verifyImageAttribute($customAttributeArray, $expectedFileName
171171
$imageAttributeFound = false;
172172
foreach ($customAttributeArray as $customAttribute) {
173173
if ($customAttribute[AttributeValue::ATTRIBUTE_CODE] == 'customer_image') {
174-
$this->assertContains($expectedFileName, $customAttribute[AttributeValue::VALUE]);
174+
$this->assertStringContainsString($expectedFileName, $customAttribute[AttributeValue::VALUE]);
175175
$mediaDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::MEDIA);
176176
$customerMediaPath = $mediaDirectory->getAbsolutePath(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER);
177177
$imageAttributeFound = file_exists($customerMediaPath . $customAttribute[AttributeValue::VALUE]);
@@ -211,7 +211,7 @@ public function testCreateCustomerWithInvalidImageAttribute()
211211
try {
212212
$this->createCustomerWithImageAttribute($imageData);
213213
} catch (\SoapFault $e) {
214-
$this->assertContains(
214+
$this->assertStringContainsString(
215215
$expectedMessage,
216216
$e->getMessage(),
217217
"Exception message does not match"
@@ -271,6 +271,6 @@ public function testUpdateCustomerWithImageAttribute()
271271
$customerMediaPath = $mediaDirectory->getAbsolutePath(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER);
272272
$previousImagePath =
273273
$previousCustomerData[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES][0][AttributeValue::VALUE];
274-
$this->assertFileNotExists($customerMediaPath . $previousImagePath);
274+
$this->assertFileDoesNotExist($customerMediaPath . $previousImagePath);
275275
}
276276
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public function testValidateResetPasswordLinkTokenInvalidToken()
372372
}
373373
$this->fail("Expected exception to be thrown.");
374374
} catch (\SoapFault $e) {
375-
$this->assertContains(
375+
$this->assertStringContainsString(
376376
$expectedMessage,
377377
$e->getMessage(),
378378
"Exception message does not match"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function testGetAllAttributesMetadata()
217217
$postcode = $this->getAttributeMetadataDataProvider()[Address::POSTCODE][2];
218218
$validationResult = $this->checkMultipleAttributesValidationRules($postcode, $attributeMetadata);
219219
list($postcode, $attributeMetadata) = $validationResult;
220-
$this->assertContains($postcode, $attributeMetadata);
220+
$this->assertContainsEquals($postcode, $attributeMetadata);
221221
}
222222

223223
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ public function testSetDefaultGroupNonExistingGroup()
6565
$this->_webApiCall($serviceInfo, $requestData);
6666
$this->fail("Expected exception");
6767
} catch (\SoapFault $e) {
68-
$this->assertContains(
68+
$this->assertStringContainsString(
6969
$expectedMessage,
7070
$e->getMessage(),
7171
"SoapFault does not contain expected message."
7272
);
7373
} catch (\Exception $e) {
74-
$this->assertContains(
74+
$this->assertStringContainsString(
7575
$expectedMessage,
7676
$e->getMessage(),
7777
"Exception does not contain expected message."
7878
);
79-
$this->assertContains((string)$customerGroupId, $e->getMessage());
79+
$this->assertStringContainsString((string)$customerGroupId, $e->getMessage());
8080
}
8181
}
8282
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ public function testGetAllAttributesMetadata()
187187
$firstName = $this->getAttributeMetadataDataProvider()[Customer::FIRSTNAME][1];
188188
$validationResult = $this->checkMultipleAttributesValidationRules($firstName, $attributeMetadata);
189189
list($firstName, $attributeMetadata) = $validationResult;
190-
$this->assertContains($firstName, $attributeMetadata);
190+
$this->assertContainsEquals($firstName, $attributeMetadata);
191191

192192
$websiteId = $this->getAttributeMetadataDataProvider()[Customer::WEBSITE_ID][1];
193193
$validationResult = $this->checkMultipleAttributesValidationRules($websiteId, $attributeMetadata);
194194
list($websiteId, $attributeMetadata) = $validationResult;
195-
$this->assertContains($websiteId, $attributeMetadata);
195+
$this->assertContainsEquals($websiteId, $attributeMetadata);
196196
}
197197

198198
/**

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function testDeleteCustomerInvalidCustomerId()
253253

254254
$this->fail("Expected exception");
255255
} catch (\SoapFault $e) {
256-
$this->assertContains(
256+
$this->assertStringContainsString(
257257
$expectedMessage,
258258
$e->getMessage(),
259259
"SoapFault does not contain expected message."
@@ -342,7 +342,7 @@ public function testUpdateCustomerNoWebsiteId()
342342
$this->_webApiCall($serviceInfo, $requestData);
343343
$this->fail("Expected exception.");
344344
} catch (\SoapFault $e) {
345-
$this->assertContains(
345+
$this->assertStringContainsString(
346346
$expectedMessage,
347347
$e->getMessage(),
348348
"SoapFault does not contain expected message."
@@ -393,7 +393,7 @@ public function testUpdateCustomerException()
393393
$this->_webApiCall($serviceInfo, $requestData);
394394
$this->fail("Expected exception.");
395395
} catch (\SoapFault $e) {
396-
$this->assertContains(
396+
$this->assertStringContainsString(
397397
$expectedMessage,
398398
$e->getMessage(),
399399
"SoapFault does not contain expected message."
@@ -851,7 +851,8 @@ public function testRevokeAllAccessTokensForCustomer()
851851
$customerLoadedData = $this->_webApiCall($serviceInfo, ['customerId' => $customerData[Customer::ID]]);
852852
self::assertGreaterThanOrEqual($customerData[Customer::UPDATED_AT], $customerLoadedData[Customer::UPDATED_AT]);
853853
unset($customerData[Customer::UPDATED_AT]);
854-
self::assertArraySubset($customerData, $customerLoadedData);
854+
unset($customerLoadedData[Customer::UPDATED_AT], $customerLoadedData[Customer::CONFIRMATION]);
855+
self::assertEquals($customerData, $customerLoadedData);
855856

856857
$revokeToken = $customerTokenService->revokeCustomerAccessToken($customerData[Customer::ID]);
857858
self::assertTrue($revokeToken);
@@ -868,7 +869,7 @@ public function testRevokeAllAccessTokensForCustomer()
868869
try {
869870
$this->_webApiCall($serviceInfo, ['customerId' => $customerData[Customer::ID]]);
870871
} catch (\SoapFault $e) {
871-
$this->assertContains(
872+
$this->assertStringContainsString(
872873
$expectedMessage,
873874
$e->getMessage(),
874875
'SoapFault does not contain expected message.'

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,18 @@ public function testGetDefaultGroupNonExistentStore()
123123
$this->_webApiCall($serviceInfo, $requestData);
124124
$this->fail("Expected exception");
125125
} catch (\SoapFault $e) {
126-
$this->assertContains(
126+
$this->assertStringContainsString(
127127
$expectedMessage,
128128
$e->getMessage(),
129129
"SoapFault does not contain expected message."
130130
);
131131
} catch (\Exception $e) {
132-
$this->assertContains(
132+
$this->assertStringContainsString(
133133
$expectedMessage,
134134
$e->getMessage(),
135135
"Exception does not contain expected message."
136136
);
137-
$this->assertContains((string)$nonExistentStoreId, $e->getMessage());
137+
$this->assertStringContainsString((string)$nonExistentStoreId, $e->getMessage());
138138
}
139139
}
140140

@@ -212,18 +212,18 @@ public function testIsReadonlyNoSuchGroup()
212212
$this->_webApiCall($serviceInfo, $requestData);
213213
$this->fail("Expected exception.");
214214
} catch (\SoapFault $e) {
215-
$this->assertContains(
215+
$this->assertStringContainsString(
216216
$expectedMessage,
217217
$e->getMessage(),
218218
"SoapFault does not contain expected message."
219219
);
220220
} catch (\Exception $e) {
221-
$this->assertContains(
221+
$this->assertStringContainsString(
222222
$expectedMessage,
223223
$e->getMessage(),
224224
"Exception does not contain expected message."
225225
);
226-
$this->assertContains((string)$groupId, $e->getMessage());
226+
$this->assertStringContainsString((string)$groupId, $e->getMessage());
227227
}
228228
}
229229
}

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function testCreateGroupNoCodeExpectExceptionRest()
262262
$this->fail("Expected exception");
263263
} catch (\Exception $e) {
264264
// @codingStandardsIgnoreStart
265-
$this->assertContains(
265+
$this->assertStringContainsString(
266266
'\"%fieldName\" is required. Enter and try again.","parameters":{"fieldName":"code"}',
267267
$e->getMessage(),
268268
"Exception does not contain expected message."
@@ -299,7 +299,7 @@ public function testCreateGroupInvalidTaxClassIdRest()
299299
$this->fail("Expected exception");
300300
} catch (\Exception $e) {
301301
// @codingStandardsIgnoreStart
302-
$this->assertContains(
302+
$this->assertStringContainsString(
303303
'{"message":"Invalid value of \"%value\" provided for the %fieldName field.","parameters":{"fieldName":"taxClassId","value":9999}',
304304
$e->getMessage(),
305305
"Exception does not contain expected message."
@@ -332,7 +332,7 @@ public function testCreateGroupWithIdRest()
332332
$this->_webApiCall($serviceInfo, $requestData);
333333
$this->fail('Expected exception');
334334
} catch (\Exception $e) {
335-
$this->assertContains(
335+
$this->assertStringContainsString(
336336
'{"message":"No such entity with %fieldName = %fieldValue","parameters":{"fieldName":"id","fieldValue":88}',
337337
$e->getMessage(),
338338
"Exception does not contain expected message."
@@ -366,7 +366,7 @@ public function testCreateGroupWithIdSoap()
366366
$this->_webApiCall($serviceInfo, $requestData);
367367
$this->fail("Expected exception");
368368
} catch (\SoapFault $e) {
369-
$this->assertContains(
369+
$this->assertStringContainsString(
370370
'No such entity with %fieldName = %fieldValue',
371371
$e->getMessage(),
372372
"SoapFault does not contain expected message."
@@ -440,7 +440,7 @@ public function testUpdateGroupNotExistingGroupRest()
440440
} catch (\Exception $e) {
441441
$expectedMessage = '{"message":"No such entity with %fieldName = %fieldValue",'
442442
. '"parameters":{"fieldName":"id","fieldValue":9999}';
443-
$this->assertContains(
443+
$this->assertStringContainsString(
444444
$expectedMessage,
445445
$e->getMessage(),
446446
"Exception does not contain expected message."
@@ -518,7 +518,7 @@ public function testCreateGroupDuplicateGroupSoap()
518518
$this->_webApiCall($serviceInfo, $requestData);
519519
$this->fail("Expected exception");
520520
} catch (\SoapFault $e) {
521-
$this->assertContains(
521+
$this->assertStringContainsString(
522522
$expectedMessage,
523523
$e->getMessage(),
524524
"Exception does not contain expected message."
@@ -589,7 +589,7 @@ public function testCreateGroupNoCodeExpectExceptionSoap()
589589
$this->_webApiCall($serviceInfo, $requestData);
590590
$this->fail("Expected exception");
591591
} catch (\SoapFault $e) {
592-
$this->assertContains(
592+
$this->assertStringContainsString(
593593
'"%fieldName" is required. Enter and try again.',
594594
$e->getMessage(),
595595
"SoapFault does not contain expected message."
@@ -627,7 +627,7 @@ public function testCreateGroupInvalidTaxClassIdSoap()
627627
$this->_webApiCall($serviceInfo, $requestData);
628628
$this->fail("Expected exception");
629629
} catch (\SoapFault $e) {
630-
$this->assertContains(
630+
$this->assertStringContainsString(
631631
$expectedMessage,
632632
$e->getMessage(),
633633
"SoapFault does not contain expected message."
@@ -700,7 +700,7 @@ public function testUpdateGroupNotExistingGroupSoap()
700700
} catch (\Exception $e) {
701701
$expectedMessage = 'No such entity with %fieldName = %fieldValue';
702702

703-
$this->assertContains(
703+
$this->assertStringContainsString(
704704
$expectedMessage,
705705
$e->getMessage(),
706706
"Exception does not contain expected message."
@@ -774,7 +774,11 @@ public function testDeleteGroupNotExists()
774774
try {
775775
$this->_webApiCall($serviceInfo, $requestData);
776776
} catch (\SoapFault $e) {
777-
$this->assertContains($expectedMessage, $e->getMessage(), "SoapFault does not contain expected message.");
777+
$this->assertStringContainsString(
778+
$expectedMessage,
779+
$e->getMessage(),
780+
"SoapFault does not contain expected message."
781+
);
778782
} catch (\Exception $e) {
779783
$errorObj = $this->processRestExceptionResult($e);
780784
$this->assertEquals($expectedMessage, $errorObj['message']);
@@ -809,13 +813,13 @@ public function testDeleteGroupCannotDelete()
809813
$this->_webApiCall($serviceInfo, $requestData);
810814
$this->fail("Expected exception");
811815
} catch (\SoapFault $e) {
812-
$this->assertContains(
816+
$this->assertStringContainsString(
813817
$expectedMessage,
814818
$e->getMessage(),
815819
"SoapFault does not contain expected message."
816820
);
817821
} catch (\Exception $e) {
818-
$this->assertContains(
822+
$this->assertStringContainsString(
819823
$expectedMessage,
820824
$e->getMessage(),
821825
"Exception does not contain expected message."

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testAddItem()
7272
1,
7373
$response['product_option']['extension_attributes']['downloadable_option']['downloadable_links']
7474
);
75-
$this->assertContains(
75+
$this->assertContainsEquals(
7676
$linkId,
7777
$response['product_option']['extension_attributes']['downloadable_option']['downloadable_links']
7878
);
@@ -175,7 +175,7 @@ public function testUpdateItem()
175175
1,
176176
$response['product_option']['extension_attributes']['downloadable_option']['downloadable_links']
177177
);
178-
$this->assertContains(
178+
$this->assertContainsEquals(
179179
$linkId,
180180
$response['product_option']['extension_attributes']['downloadable_option']['downloadable_links']
181181
);
@@ -321,7 +321,7 @@ public function testUpdateItemQty()
321321
1,
322322
$response['product_option']['extension_attributes']['downloadable_option']['downloadable_links']
323323
);
324-
$this->assertContains(
324+
$this->assertContainsEquals(
325325
$linkId,
326326
$response['product_option']['extension_attributes']['downloadable_option']['downloadable_links']
327327
);

0 commit comments

Comments
 (0)