Skip to content

Commit 34fcec3

Browse files
authored
Merge pull request #5611 from magento-tsg/2.4-develop-php74-pr34
[TSG][PHP7.4] Fixes for 2.4 (pr34) (2.4-develop-php74)
2 parents 039a827 + b7ddb8b commit 34fcec3

File tree

48 files changed

+216
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+216
-175
lines changed

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

Lines changed: 8 additions & 4 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()) {
@@ -592,7 +592,11 @@ protected function checkSoapFault(
592592
$expectedWrappedErrors = [],
593593
$traceString = null
594594
) {
595-
$this->assertContains($expectedMessage, $soapFault->getMessage(), "Fault message is invalid.");
595+
$this->assertStringContainsString(
596+
$expectedMessage,
597+
$soapFault->getMessage(),
598+
"Fault message is invalid."
599+
);
596600

597601
$errorDetailsNode = 'GenericFault';
598602
$errorDetails = isset($soapFault->detail->$errorDetailsNode) ? $soapFault->detail->$errorDetailsNode : null;
@@ -611,7 +615,7 @@ protected function checkSoapFault(
611615
->getMode();
612616
if ($mode == \Magento\Framework\App\State::MODE_DEVELOPER) {
613617
/** Developer mode changes tested behavior and it cannot properly be tested for now */
614-
$this->assertContains(
618+
$this->assertStringContainsString(
615619
$traceString,
616620
$errorDetails->$traceNode,
617621
'Trace Information is incorrect.'

dev/tests/api-functional/testsuite/Magento/Analytics/Api/LinkProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testGetAll()
6767
try {
6868
$this->_webApiCall($serviceInfo);
6969
} catch (\Exception $e) {
70-
$this->assertContains(
70+
$this->assertStringContainsString(
7171
'Operation allowed only in HTTPS',
7272
$e->getMessage()
7373
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function testCreateThrowsExceptionIfAttributeSetWithGivenNameAlreadyExist
185185
$this->_webApiCall($this->createServiceInfo, $arguments);
186186
$this->fail("Expected exception");
187187
} catch (\SoapFault $e) {
188-
$this->assertContains(
188+
$this->assertStringContainsString(
189189
$expectedMessage,
190190
$e->getMessage(),
191191
"SoapFault does not contain expected message."

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testInfoNoSuchEntityException()
3939
try {
4040
$this->getAssignedProducts(-1);
4141
} catch (\Exception $e) {
42-
$this->assertContains('No such entity with %fieldName = %fieldValue', $e->getMessage());
42+
$this->assertStringContainsString('No such entity with %fieldName = %fieldValue', $e->getMessage());
4343
}
4444
}
4545

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testInfoNoSuchEntityException()
8989
try {
9090
$this->getInfoCategory(-1);
9191
} catch (\Exception $e) {
92-
$this->assertContains('No such entity with %fieldName = %fieldValue', $e->getMessage());
92+
$this->assertStringContainsString('No such entity with %fieldName = %fieldValue', $e->getMessage());
9393
}
9494
}
9595

@@ -168,7 +168,7 @@ public function testDeleteNoSuchEntityException()
168168
try {
169169
$this->deleteCategory(-1);
170170
} catch (\Exception $e) {
171-
$this->assertContains('No such entity with %fieldName = %fieldValue', $e->getMessage());
171+
$this->assertStringContainsString('No such entity with %fieldName = %fieldValue', $e->getMessage());
172172
}
173173
}
174174

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

Lines changed: 3 additions & 3 deletions
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
{
@@ -58,7 +58,7 @@ public function testGet()
5858
$product = $productRepository->get(self::SIMPLE_PRODUCT_SKU);
5959

6060
$this->assertNotEmpty($response);
61-
$this->assertEquals($product->getCost(), $cost);
61+
$this->assertEquals($cost, (int)$product->getCost());
6262
}
6363

6464
/**
@@ -97,7 +97,7 @@ public function testUpdate()
9797
/** @var \Magento\Catalog\Api\Data\ProductInterface $product */
9898
$product = $productRepository->get(self::SIMPLE_PRODUCT_SKU);
9999
$this->assertEmpty($response);
100-
$this->assertEquals($product->getCost(), $newCost);
100+
$this->assertEquals($newCost, (int)$product->getCost());
101101
}
102102

103103
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testAssignAttributeWrongAttributeSet()
6363
$this->_webApiCall($this->getAssignServiceInfo(), $payload);
6464
$this->fail("Expected exception");
6565
} catch (\SoapFault $e) {
66-
$this->assertContains(
66+
$this->assertStringContainsString(
6767
$expectedMessage,
6868
$e->getMessage(),
6969
"SoapFault does not contain expected message."
@@ -86,7 +86,7 @@ public function testAssignAttributeWrongAttributeGroup()
8686
$this->_webApiCall($this->getAssignServiceInfo(), $payload);
8787
$this->fail("Expected exception");
8888
} catch (\SoapFault $e) {
89-
$this->assertContains(
89+
$this->assertStringContainsString(
9090
$expectedMessage,
9191
$e->getMessage(),
9292
"SoapFault does not contain expected message."
@@ -110,7 +110,7 @@ public function testAssignAttributeWrongAttribute()
110110
$this->_webApiCall($this->getAssignServiceInfo(), $payload);
111111
$this->fail("Expected exception");
112112
} catch (\SoapFault $e) {
113-
$this->assertContains(
113+
$this->assertStringContainsString(
114114
$expectedMessage,
115115
$e->getMessage(),
116116
"SoapFault does not contain expected message."

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public function testDeleteNoSuchEntityException()
362362
$this->_webApiCall($serviceInfo, ['attributeCode' => $attributeCode]);
363363
$this->fail("Expected exception");
364364
} catch (\SoapFault $e) {
365-
$this->assertContains(
365+
$this->assertStringContainsString(
366366
$expectedMessage,
367367
$e->getMessage(),
368368
"SoapFault does not contain expected message."

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ public function testGetTypes()
3838
'group' => __('Select'),
3939
];
4040
$this->assertGreaterThanOrEqual(10, count($types));
41-
$this->assertContains($excepted, $types);
41+
$this->assertContainsEquals($excepted, $types);
4242
}
4343
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testGetItems()
2929
];
3030
$actual = $this->_webApiCall($serviceInfo);
3131
$expectedItems = ['name' => 'related', 'code' => Link::LINK_TYPE_RELATED];
32-
$this->assertContains($expectedItems, $actual);
32+
$this->assertContainsEquals($expectedItems, $actual);
3333
}
3434

3535
public function testGetItemAttributes()

0 commit comments

Comments
 (0)