Skip to content

Commit 1d1c2ea

Browse files
authored
Merge pull request #4088 from magento-trigger/MAGETWO-99210
[trigger] MAGETWO-99210: Magento\Install\Test\TestCase\InstallTest is failing on php 7.1
2 parents 0ae802b + 264df42 commit 1d1c2ea

File tree

20 files changed

+201
-444
lines changed

20 files changed

+201
-444
lines changed

dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
use Magento\Mtf\Util\Protocol\CurlInterface;
1010
use Magento\Mtf\Util\Protocol\CurlTransport;
11-
use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator;
1211

1312
/**
1413
* Perform bin/magento commands from command line for functional tests executions.
@@ -18,7 +17,7 @@ class Cli
1817
/**
1918
* Url to command.php.
2019
*/
21-
const URL = '/dev/tests/functional/utils/command.php';
20+
const URL = 'dev/tests/functional/utils/command.php';
2221

2322
/**
2423
* Curl transport protocol.
@@ -27,21 +26,12 @@ class Cli
2726
*/
2827
private $transport;
2928

30-
/**
31-
* Webapi handler.
32-
*
33-
* @var WebapiDecorator
34-
*/
35-
private $webapiHandler;
36-
3729
/**
3830
* @param CurlTransport $transport
39-
* @param WebapiDecorator $webapiHandler
4031
*/
41-
public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler)
32+
public function __construct(CurlTransport $transport)
4233
{
4334
$this->transport = $transport;
44-
$this->webapiHandler = $webapiHandler;
4535
}
4636

4737
/**
@@ -53,31 +43,22 @@ public function __construct(CurlTransport $transport, WebapiDecorator $webapiHan
5343
*/
5444
public function execute($command, $options = [])
5545
{
56-
$this->transport->write(
57-
rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL,
58-
$this->prepareParamArray($command, $options),
59-
CurlInterface::POST,
60-
[]
61-
);
62-
$this->transport->read();
63-
$this->transport->close();
46+
$curl = $this->transport;
47+
$curl->write($this->prepareUrl($command, $options), [], CurlInterface::GET);
48+
$curl->read();
49+
$curl->close();
6450
}
6551

6652
/**
67-
* Prepare parameter array.
53+
* Prepare url.
6854
*
6955
* @param string $command
7056
* @param array $options [optional]
71-
* @return array
57+
* @return string
7258
*/
73-
private function prepareParamArray($command, $options = [])
59+
private function prepareUrl($command, $options = [])
7460
{
75-
if (!empty($options)) {
76-
$command .= ' ' . implode(' ', $options);
77-
}
78-
return [
79-
'token' => urlencode($this->webapiHandler->getWebapiToken()),
80-
'command' => urlencode($command)
81-
];
61+
$command .= ' ' . implode(' ', $options);
62+
return $_ENV['app_frontend_url'] . self::URL . '?command=' . urlencode($command);
8263
}
8364
}

dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/Reader.php

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Mtf\Util\Command\File\Export;
78

89
use Magento\Mtf\ObjectManagerInterface;
910
use Magento\Mtf\Util\Protocol\CurlTransport;
1011
use Magento\Mtf\Util\Protocol\CurlInterface;
11-
use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator;
1212

1313
/**
1414
* File reader for Magento export files.
@@ -36,29 +36,16 @@ class Reader implements ReaderInterface
3636
*/
3737
private $transport;
3838

39-
/**
40-
* Webapi handler.
41-
*
42-
* @var WebapiDecorator
43-
*/
44-
private $webapiHandler;
45-
4639
/**
4740
* @param ObjectManagerInterface $objectManager
4841
* @param CurlTransport $transport
49-
* @param WebapiDecorator $webapiHandler
5042
* @param string $template
5143
*/
52-
public function __construct(
53-
ObjectManagerInterface $objectManager,
54-
CurlTransport $transport,
55-
WebapiDecorator $webapiHandler,
56-
$template
57-
) {
44+
public function __construct(ObjectManagerInterface $objectManager, CurlTransport $transport, $template)
45+
{
5846
$this->objectManager = $objectManager;
5947
$this->template = $template;
6048
$this->transport = $transport;
61-
$this->webapiHandler = $webapiHandler;
6249
}
6350

6451
/**
@@ -83,27 +70,20 @@ public function getData()
8370
*/
8471
private function getFiles()
8572
{
86-
$this->transport->write(
87-
rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL,
88-
$this->prepareParamArray(),
89-
CurlInterface::POST,
90-
[]
91-
);
73+
$this->transport->write($this->prepareUrl(), [], CurlInterface::GET);
9274
$serializedFiles = $this->transport->read();
9375
$this->transport->close();
94-
return unserialize($serializedFiles);
76+
// phpcs:ignore Magento2.Security.InsecureFunction
77+
return unserialize($serializedFiles, ['allowed_classes' => false]);
9578
}
9679

9780
/**
98-
* Prepare parameter array.
81+
* Prepare url.
9982
*
100-
* @return array
83+
* @return string
10184
*/
102-
private function prepareParamArray()
85+
private function prepareUrl()
10386
{
104-
return [
105-
'token' => urlencode($this->webapiHandler->getWebapiToken()),
106-
'template' => urlencode($this->template)
107-
];
87+
return $_ENV['app_frontend_url'] . self::URL . '?template=' . urlencode($this->template);
10888
}
10989
}

dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Export/ReaderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface ReaderInterface
1414
/**
1515
* Url to export.php.
1616
*/
17-
const URL = '/dev/tests/functional/utils/export.php';
17+
const URL = 'dev/tests/functional/utils/export.php';
1818

1919
/**
2020
* Exporting files as Data object from Magento.

dev/tests/functional/lib/Magento/Mtf/Util/Command/File/Log.php

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace Magento\Mtf\Util\Command\File;
88

99
use Magento\Mtf\Util\Protocol\CurlTransport;
10-
use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator;
1110

1211
/**
1312
* Get content of log file in var/log folder.
@@ -17,7 +16,7 @@ class Log
1716
/**
1817
* Url to log.php.
1918
*/
20-
const URL = '/dev/tests/functional/utils/log.php';
19+
const URL = 'dev/tests/functional/utils/log.php';
2120

2221
/**
2322
* Curl transport protocol.
@@ -26,21 +25,12 @@ class Log
2625
*/
2726
private $transport;
2827

29-
/**
30-
* Webapi handler.
31-
*
32-
* @var WebapiDecorator
33-
*/
34-
private $webapiHandler;
35-
3628
/**
3729
* @param CurlTransport $transport
38-
* @param WebapiDecorator $webapiHandler
3930
*/
40-
public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler)
31+
public function __construct(CurlTransport $transport)
4132
{
4233
$this->transport = $transport;
43-
$this->webapiHandler = $webapiHandler;
4434
}
4535

4636
/**
@@ -51,28 +41,22 @@ public function __construct(CurlTransport $transport, WebapiDecorator $webapiHan
5141
*/
5242
public function getFileContent($name)
5343
{
54-
$this->transport->write(
55-
rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL,
56-
$this->prepareParamArray($name),
57-
CurlInterface::POST,
58-
[]
59-
);
60-
$data = $this->transport->read();
61-
$this->transport->close();
44+
$curl = $this->transport;
45+
$curl->write($this->prepareUrl($name), [], CurlTransport::GET);
46+
$data = $curl->read();
47+
$curl->close();
48+
// phpcs:ignore Magento2.Security.InsecureFunction
6249
return unserialize($data);
6350
}
6451

6552
/**
66-
* Prepare parameter array.
53+
* Prepare url.
6754
*
6855
* @param string $name
69-
* @return array
56+
* @return string
7057
*/
71-
private function prepareParamArray($name)
58+
private function prepareUrl($name)
7259
{
73-
return [
74-
'token' => urlencode($this->webapiHandler->getWebapiToken()),
75-
'name' => urlencode($name)
76-
];
60+
return $_ENV['app_frontend_url'] . self::URL . '?name=' . urlencode($name);
7761
}
7862
}

dev/tests/functional/lib/Magento/Mtf/Util/Command/GeneratedCode.php

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Mtf\Util\Protocol\CurlInterface;
99
use Magento\Mtf\Util\Protocol\CurlTransport;
10-
use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator;
1110

1211
/**
1312
* GeneratedCode removes generated code of Magento (like generated/code and generated/metadata).
@@ -17,7 +16,7 @@ class GeneratedCode
1716
/**
1817
* Url to deleteMagentoGeneratedCode.php.
1918
*/
20-
const URL = '/dev/tests/functional/utils/deleteMagentoGeneratedCode.php';
19+
const URL = 'dev/tests/functional/utils/deleteMagentoGeneratedCode.php';
2120

2221
/**
2322
* Curl transport protocol.
@@ -26,21 +25,12 @@ class GeneratedCode
2625
*/
2726
private $transport;
2827

29-
/**
30-
* Webapi handler.
31-
*
32-
* @var WebapiDecorator
33-
*/
34-
private $webapiHandler;
35-
3628
/**
3729
* @param CurlTransport $transport
38-
* @param WebapiDecorator $webapiHandler
3930
*/
40-
public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler)
31+
public function __construct(CurlTransport $transport)
4132
{
4233
$this->transport = $transport;
43-
$this->webapiHandler = $webapiHandler;
4434
}
4535

4636
/**
@@ -50,25 +40,10 @@ public function __construct(CurlTransport $transport, WebapiDecorator $webapiHan
5040
*/
5141
public function delete()
5242
{
53-
$this->transport->write(
54-
rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL,
55-
$this->prepareParamArray(),
56-
CurlInterface::POST,
57-
[]
58-
);
59-
$this->transport->read();
60-
$this->transport->close();
61-
}
62-
63-
/**
64-
* Prepare parameter array.
65-
*
66-
* @return array
67-
*/
68-
private function prepareParamArray()
69-
{
70-
return [
71-
'token' => urlencode($this->webapiHandler->getWebapiToken())
72-
];
43+
$url = $_ENV['app_frontend_url'] . self::URL;
44+
$curl = $this->transport;
45+
$curl->write($url, [], CurlInterface::GET);
46+
$curl->read();
47+
$curl->close();
7348
}
7449
}

dev/tests/functional/lib/Magento/Mtf/Util/Command/Locales.php

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Mtf\Util\Protocol\CurlInterface;
99
use Magento\Mtf\Util\Protocol\CurlTransport;
10-
use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator;
1110

1211
/**
1312
* Returns array of locales depends on fetching type.
@@ -27,7 +26,7 @@ class Locales
2726
/**
2827
* Url to locales.php.
2928
*/
30-
const URL = '/dev/tests/functional/utils/locales.php';
29+
const URL = 'dev/tests/functional/utils/locales.php';
3130

3231
/**
3332
* Curl transport protocol.
@@ -36,21 +35,12 @@ class Locales
3635
*/
3736
private $transport;
3837

39-
/**
40-
* Webapi handler.
41-
*
42-
* @var WebapiDecorator
43-
*/
44-
private $webapiHandler;
45-
4638
/**
4739
* @param CurlTransport $transport Curl transport protocol
48-
* @param WebapiDecorator $webapiHandler
4940
*/
50-
public function __construct(CurlTransport $transport, WebapiDecorator $webapiHandler)
41+
public function __construct(CurlTransport $transport)
5142
{
5243
$this->transport = $transport;
53-
$this->webapiHandler = $webapiHandler;
5444
}
5545

5646
/**
@@ -61,28 +51,12 @@ public function __construct(CurlTransport $transport, WebapiDecorator $webapiHan
6151
*/
6252
public function getList($type = self::TYPE_ALL)
6353
{
64-
$this->transport->write(
65-
rtrim(str_replace('index.php', '', $_ENV['app_frontend_url']), '/') . self::URL,
66-
$this->prepareParamArray($type),
67-
CurlInterface::POST,
68-
[]
69-
);
70-
$result = $this->transport->read();
71-
$this->transport->close();
72-
return explode('|', $result);
73-
}
54+
$url = $_ENV['app_frontend_url'] . self::URL . '?type=' . $type;
55+
$curl = $this->transport;
56+
$curl->write($url, [], CurlInterface::GET);
57+
$result = $curl->read();
58+
$curl->close();
7459

75-
/**
76-
* Prepare parameter array.
77-
*
78-
* @param string $type
79-
* @return array
80-
*/
81-
private function prepareParamArray($type)
82-
{
83-
return [
84-
'token' => urlencode($this->webapiHandler->getWebapiToken()),
85-
'type' => urlencode($type)
86-
];
60+
return explode('|', $result);
8761
}
8862
}

0 commit comments

Comments
 (0)