Skip to content

Commit ef7c87f

Browse files
authored
Merge branch 'develop' into imported-magento-magento2-functional-testing-framework-871
2 parents 738b490 + 746bbc8 commit ef7c87f

File tree

5 files changed

+20
-10
lines changed

5 files changed

+20
-10
lines changed

src/Magento/FunctionalTestingFramework/Config/Dom/ArrayNodeConfig.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct(
6464
public function isNumericArray($nodeXpath)
6565
{
6666
foreach ($this->numericArrays as $pathPattern) {
67-
if ($this->nodePathMatcher->match($pathPattern, $nodeXpath)) {
67+
if ($this->nodePathMatcher->pathMatch($pathPattern, $nodeXpath)) {
6868
return true;
6969
}
7070
}
@@ -84,7 +84,7 @@ public function getAssocArrayKeyAttribute($nodeXpath)
8484
}
8585

8686
foreach ($this->assocArrays as $pathPattern => $keyAttribute) {
87-
if ($this->nodePathMatcher->match($pathPattern, $nodeXpath)) {
87+
if ($this->nodePathMatcher->pathMatch($pathPattern, $nodeXpath)) {
8888
return $keyAttribute;
8989
}
9090
}

src/Magento/FunctionalTestingFramework/Config/Dom/NodeMergingConfig.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(NodePathMatcher $nodePathMatcher, array $idAttribute
4444
public function getIdAttribute($nodeXpath)
4545
{
4646
foreach ($this->idAttributes as $pathPattern => $idAttribute) {
47-
if ($this->nodePathMatcher->match($pathPattern, $nodeXpath)) {
47+
if ($this->nodePathMatcher->pathMatch($pathPattern, $nodeXpath)) {
4848
return $idAttribute;
4949
}
5050
}

src/Magento/FunctionalTestingFramework/Config/Dom/NodePathMatcher.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class NodePathMatcher
1717
* @param string $xpathSubject Example: '/some[@attr="value"]/static/ns:path'.
1818
* @return boolean
1919
*/
20-
public function match($pathPattern, $xpathSubject)
20+
public function pathMatch($pathPattern, $xpathSubject)
2121
{
2222
$pathSubject = $this->simplifyXpath($xpathSubject);
2323
$pathPattern = '#^' . $pathPattern . '$#';

src/Magento/FunctionalTestingFramework/DataTransport/Protocol/CurlTransport.php

+12-5
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,18 @@ public function write($url, $body = [], $method = CurlInterface::POST, $headers
132132
CURLOPT_RETURNTRANSFER => true,
133133
CURLOPT_FOLLOWLOCATION => true,
134134
CURLOPT_COOKIEFILE => '',
135-
CURLOPT_HTTPHEADER => $headers,
135+
CURLOPT_HTTPHEADER => is_object($headers) ? (array) $headers : $headers,
136136
CURLOPT_SSL_VERIFYPEER => false,
137137
CURLOPT_SSL_VERIFYHOST => false,
138138
];
139139
switch ($method) {
140140
case CurlInterface::POST:
141141
$options[CURLOPT_POST] = true;
142-
$options[CURLOPT_POSTFIELDS] = $body;
142+
$options[CURLOPT_POSTFIELDS] = is_object($body) ? (array) $body : $body;
143143
break;
144144
case CurlInterface::PUT:
145145
$options[CURLOPT_CUSTOMREQUEST] = self::PUT;
146-
$options[CURLOPT_POSTFIELDS] = $body;
146+
$options[CURLOPT_POSTFIELDS] = is_object($body) ? (array) $body : $body;
147147
break;
148148
case CurlInterface::DELETE:
149149
$options[CURLOPT_CUSTOMREQUEST] = self::DELETE;
@@ -189,7 +189,10 @@ public function read($successRegex = null, $returnRegex = null, $returnIndex = n
189189
*/
190190
public function close()
191191
{
192-
curl_close($this->getResource());
192+
if (version_compare(PHP_VERSION, '8.0') < 0) {
193+
// this function no longer has an effect in PHP 8.0, but it's required in earlier versions
194+
curl_close($this->getResource());
195+
}
193196
$this->resource = null;
194197
}
195198

@@ -271,7 +274,11 @@ public function multiRequest(array $urls, array $options = [])
271274
$result[$key] = curl_multi_getcontent($handle);
272275
curl_multi_remove_handle($multiHandle, $handle);
273276
}
274-
curl_multi_close($multiHandle);
277+
if (version_compare(PHP_VERSION, '8.0') < 0) {
278+
// this function no longer has an effect in PHP 8.0, but it's required in earlier versions
279+
curl_multi_close($multiHandle);
280+
}
281+
275282
return $result;
276283
}
277284

src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ public function testStart(\Codeception\Event\TestEvent $e)
7272
CURLOPT_URL => getenv('MAGENTO_BASE_URL') . "/test.php?test=" . $this->currentTest,
7373
]);
7474
curl_exec($cURLConnection);
75-
curl_close($cURLConnection);
75+
if (version_compare(PHP_VERSION, '8.0') < 0) {
76+
// this function no longer has an effect in PHP 8.0, but it's required in earlier versions
77+
curl_close($cURLConnection);
78+
}
7679
}
7780

7881
PersistedObjectHandler::getInstance()->clearHookObjects();

0 commit comments

Comments
 (0)