Skip to content

Commit 77c270e

Browse files
authored
ACMP-1459: Make ece-tools compatible with php 8.0/8.1 (#74)
1 parent 6239dcc commit 77c270e

File tree

235 files changed

+1173
-754
lines changed

Some content is hidden

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

235 files changed

+1173
-754
lines changed

composer.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/ece-tools",
33
"description": "Provides tools to build and deploy Magento 2 Enterprise Edition",
44
"type": "magento2-component",
5-
"version": "2002.1.8",
5+
"version": "2002.1.9",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {
@@ -11,7 +11,7 @@
1111
}
1212
},
1313
"require": {
14-
"php": "^7.1.3",
14+
"php": "^7.2 || ^8.0",
1515
"ext-PDO": "*",
1616
"ext-json": "*",
1717
"ext-sockets": "*",
@@ -20,7 +20,7 @@
2020
"composer/semver": "@stable",
2121
"graylog2/gelf-php": "^1.4.2",
2222
"guzzlehttp/guzzle": "^6.3||^7.3",
23-
"illuminate/config": "^5.5",
23+
"illuminate/config": "^5.5||^8.77",
2424
"magento/magento-cloud-components": "^1.0.8",
2525
"magento/magento-cloud-docker": "^1.0.0",
2626
"magento/magento-cloud-patches": "^1.0.11",
@@ -37,13 +37,17 @@
3737
"symfony/yaml": "^3.3 || ^4.0 || ^5.1"
3838
},
3939
"require-dev": {
40-
"codeception/codeception": "^2.5.3",
40+
"codeception/codeception": "^4.1",
41+
"codeception/module-asserts": "^1.2",
42+
"codeception/module-db": "^1.0",
43+
"codeception/module-phpbrowser": "^1.0",
44+
"codeception/module-rest": "^1.2",
4145
"consolidation/robo": "^1.2",
4246
"php-mock/php-mock-phpunit": "^2.0",
4347
"phpmd/phpmd": "@stable",
4448
"phpstan/phpstan": "^0.12",
45-
"phpunit/php-code-coverage": "^6.0",
46-
"phpunit/phpunit": "^7.2",
49+
"phpunit/php-code-coverage": "^7.0 || ^9.2",
50+
"phpunit/phpunit": "^8.5 || ^9.5",
4751
"squizlabs/php_codesniffer": "^3.0",
4852
"funkjedi/composer-include-files": "^1.0"
4953
},

src/Config/Validator/Deploy/MagentoCloudVariables.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function validateIntegers(array $variables): array
8989
foreach ($intVariables as $intVarName) {
9090
if (isset($variables[$intVarName])
9191
&& !is_int($variables[$intVarName])
92-
&& !ctype_digit($variables[$intVarName])
92+
&& !ctype_digit(strval($variables[$intVarName]))
9393
) {
9494
$errors[] = sprintf(
9595
' The variable %s has wrong value "%s" and will be ignored, use only integer value',
@@ -100,7 +100,7 @@ private function validateIntegers(array $variables): array
100100
}
101101

102102
if (isset($variables[DeployInterface::VAR_SCD_COMPRESSION_LEVEL])) {
103-
if (!ctype_digit($variables[DeployInterface::VAR_SCD_COMPRESSION_LEVEL])
103+
if (!ctype_digit(strval($variables[DeployInterface::VAR_SCD_COMPRESSION_LEVEL]))
104104
|| !in_array(intval($variables[DeployInterface::VAR_SCD_COMPRESSION_LEVEL]), range(0, 9))
105105
) {
106106
$errors[] = sprintf(

src/Service/Validator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Validator
2020
* Supported version constraints of Redis services
2121
*/
2222
private const REDIS_SUPPORT_VERSIONS = [
23-
'*' => '~3.2.0 || ~4.0.0 || ~5.0.0 || ~6.0.0',
23+
'*' => '~3.2.0 || ~4.0.0 || ~5.0.0 || ~6.0.0 || ~6.2.0',
2424
];
2525

2626
/**
@@ -76,7 +76,8 @@ class Validator
7676
],
7777
ServiceInterface::NAME_RABBITMQ => [
7878
'<2.3.0' => '~3.5.0',
79-
'>=2.3.0' => '~3.5.0 || ~3.7.0 || ~3.8.0',
79+
'>=2.3.0 <2.4.4' => '~3.5.0 || ~3.7.0 || ~3.8.0',
80+
'>=2.4.4' => '~3.5.0 || ~3.7.0 || ~3.8.0 || ~3.9.0',
8081
],
8182
ServiceInterface::NAME_NODE => [
8283
'*' => '^6 || ^8 || ^10 || ^11',

src/Step/PostDeploy/WarmUp.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ public function execute()
8888
$this->logger->info('Warmed up page: ' . $urls[$index]);
8989
};
9090

91-
$config['rejected'] = function (RequestException $exception, $index) use ($urls) {
91+
$config['rejected'] = function ($exception, $index) use ($urls) {
9292
$context = [];
9393

94-
if ($exception->getResponse()) {
94+
if (method_exists($exception, 'getResponse') && $exception->getResponse()) {
9595
$context = [
9696
'error' => $exception->getResponse()->getReasonPhrase(),
9797
'code' => $exception->getResponse()->getStatusCode(),
9898
];
99-
} elseif ($exception->getHandlerContext()) {
99+
} elseif (method_exists($exception, 'getHandlerContext') && $exception->getHandlerContext()) {
100100
$context = [
101101
'error' => $exception->getHandlerContext()['error'] ?? '',
102102
'errno' => $exception->getHandlerContext()['errno'] ?? '',

src/Test/Functional/Acceptance/AbstractCest.php

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

88
namespace Magento\MagentoCloud\Test\Functional\Acceptance;
99

10+
use Magento\MagentoCloud\Util\ArrayManager;
11+
1012
/**
1113
* General Cest
1214
* @SuppressWarnings(PHPMD.NumberOfChildren)
@@ -28,6 +30,11 @@ abstract class AbstractCest
2830
*/
2931
protected $magentoCloudTemplate = 'master';
3032

33+
/**
34+
* @var ArrayManager
35+
*/
36+
protected $arrayManager;
37+
3138
/**
3239
* @param \CliTester $I
3340
*/
@@ -136,4 +143,34 @@ protected function removeESIfExists(\CliTester $I, string $templateVersion): voi
136143
}
137144
}
138145
}
146+
147+
/**
148+
* @return ArrayManager
149+
*/
150+
protected function getArrayManager(): ArrayManager
151+
{
152+
if ($this->arrayManager == null) {
153+
$this->arrayManager = new ArrayManager();
154+
}
155+
156+
return $this->arrayManager;
157+
}
158+
159+
/**
160+
* Perform asserts for arrays to check that $array contains information from $subset
161+
*
162+
* @param array $subset
163+
* @param array $array
164+
* @param \CliTester $I
165+
* @return void
166+
*/
167+
protected function checkArraySubset(array $subset, array $array, \CliTester $I): void
168+
{
169+
$flattenArray = $this->getArrayManager()->flatten($array);
170+
$flattenSubset = $this->getArrayManager()->flatten($subset);
171+
foreach ($flattenSubset as $path => $value) {
172+
$I->assertArrayHasKey($path, $flattenArray);
173+
$I->assertEquals($value, $flattenArray[$path]);
174+
}
175+
}
139176
}

src/Test/Functional/Acceptance/Acceptance72Ce22Cest.php renamed to src/Test/Functional/Acceptance/Acceptance74Ce244Cest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
/**
1515
* @inheritDoc
1616
*
17-
* @group php72
17+
* @group php74
1818
* @group edition-ce
1919
*/
20-
class Acceptance72Ce22Cest extends AcceptanceCeCest
20+
class Acceptance74Ce244Cest extends AcceptanceCeCest
2121
{
2222
/**
2323
* @var string
2424
*/
25-
protected $magentoCloudTemplate = '2.2.10';
25+
protected $magentoCloudTemplate = '2.4.4';
2626
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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\MagentoCloud\Test\Functional\Acceptance;
9+
10+
use CliTester;
11+
use Robo\Exception\TaskException;
12+
use Codeception\Example;
13+
use Magento\CloudDocker\Test\Functional\Codeception\Docker;
14+
15+
/**
16+
* @inheritDoc
17+
*
18+
* @group php74
19+
*/
20+
class Acceptance74Cest extends AcceptanceCest
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $magentoCloudTemplate = '2.4.3';
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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\MagentoCloud\Test\Functional\Acceptance;
9+
10+
use CliTester;
11+
use Robo\Exception\TaskException;
12+
use Codeception\Example;
13+
use Magento\CloudDocker\Test\Functional\Codeception\Docker;
14+
use Magento\MagentoCloud\Util\ArrayManager;
15+
16+
/**
17+
* @inheritDoc
18+
*
19+
* @group php74
20+
*/
21+
class Acceptance74M244Cest extends AcceptanceCest
22+
{
23+
/**
24+
* @var string
25+
*/
26+
protected $magentoCloudTemplate = '2.4.4';
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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\MagentoCloud\Test\Functional\Acceptance;
9+
10+
use Magento\CloudDocker\Test\Functional\Codeception\Docker;
11+
use Robo\Exception\TaskException;
12+
use CliTester;
13+
14+
/**
15+
* @inheritDoc
16+
*
17+
* @group php74
18+
* @group edition-ce
19+
*/
20+
class AcceptanceCe74Cest extends AcceptanceCeCest
21+
{
22+
/**
23+
* @var string
24+
*/
25+
protected $magentoCloudTemplate = '2.4.0';
26+
}

src/Test/Functional/Acceptance/AcceptanceCeCest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@
1414
/**
1515
* @inheritDoc
1616
*
17-
* @group php74
17+
* @group php81
1818
* @group edition-ce
1919
*/
2020
class AcceptanceCeCest extends AbstractCest
2121
{
22+
/**
23+
* @var string
24+
*/
25+
protected $magentoCloudTemplate = '2.4.4';
26+
2227
/**
2328
* @var boolean
2429
*/

0 commit comments

Comments
 (0)