Skip to content

Commit 9570f8f

Browse files
committed
Updates for static tests, removed Set-Cookie array initialization
1 parent e1d21cd commit 9570f8f

File tree

4 files changed

+42
-35
lines changed

4 files changed

+42
-35
lines changed

lib/internal/Magento/Framework/HTTP/Client/Curl.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,6 @@ protected function parseHeaders($ch, $data)
454454

455455
if (strlen($name)) {
456456
if ('set-cookie' === strtolower($name)) {
457-
if (!isset($this->_responseHeaders['Set-Cookie'])) {
458-
$this->_responseHeaders['Set-Cookie'] = [];
459-
}
460457
$this->_responseHeaders['Set-Cookie'][] = $value;
461458
} else {
462459
$this->_responseHeaders[$name] = $value;

lib/internal/Magento/Framework/HTTP/Test/Unit/Client/CurlMockTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Magento\Framework\HTTP\Test\Unit\Client;
1010

11-
use Magento\Framework\HTTP\Client\CurlMock;
11+
use Magento\Framework\HTTP\Test\Unit\Client\Mock\CurlMock;
1212
use PHPUnit\Framework\TestCase;
1313

1414
/**
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Framework\HTTP\Test\Unit\Client\Mock;
9+
10+
use Magento\Framework\HTTP\Client\Curl;
11+
12+
/**
13+
* Extended Curl class with modifications for testing
14+
*/
15+
class CurlMock extends Curl
16+
{
17+
// @codingStandardsIgnoreStart
18+
/**
19+
* Unfortunately, it is necessary for the tests to set this function public.
20+
*
21+
* @param resource $ch curl handle, not needed
22+
* @param string $data
23+
* @return int
24+
* @throws \Exception
25+
*/
26+
public function parseHeaders($ch, $data)
27+
{
28+
return parent::parseHeaders($ch, $data);
29+
}
30+
// @codingStandardsIgnoreEnd
31+
32+
/**
33+
* Return Curl resource, only used for testing.
34+
*
35+
* @return resource
36+
*/
37+
public function getResource()
38+
{
39+
return $this->_ch;
40+
}
41+
}

lib/internal/Magento/Framework/HTTP/Test/Unit/Client/_files/curl_exec_mock.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,3 @@ function curl_exec($resource)
2020
{
2121
return call_user_func(CurlMockTest::$curlExectClosure);
2222
}
23-
24-
/**
25-
* Extended Curl class with modifications for testing
26-
*/
27-
class CurlMock extends Curl
28-
{
29-
// @codingStandardsIgnoreStart
30-
/**
31-
* Unfortunately, it is necessary for the tests to set this function public.
32-
*
33-
* @param resource $ch curl handle, not needed
34-
* @param string $data
35-
* @return int
36-
* @throws \Exception
37-
*/
38-
public function parseHeaders($ch, $data)
39-
{
40-
return parent::parseHeaders($ch, $data);
41-
}
42-
// @codingStandardsIgnoreEnd
43-
44-
/**
45-
* Return Curl resource, only used for testing.
46-
*
47-
* @return resource
48-
*/
49-
public function getResource()
50-
{
51-
return $this->_ch;
52-
}
53-
}

0 commit comments

Comments
 (0)