Skip to content

Commit 0c17136

Browse files
committed
Merge branch 'develop' into MCLOUD-12022
2 parents e6b5901 + 776fcbb commit 0c17136

File tree

15 files changed

+112
-70
lines changed

15 files changed

+112
-70
lines changed

composer.json

Lines changed: 2 additions & 2 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.17",
5+
"version": "2002.1.18",
66
"license": "OSL-3.0",
77
"repositories": {
88
"repo.magento.com": {
@@ -45,7 +45,7 @@
4545
"consolidation/robo": "^1.2 || ^3.0",
4646
"php-mock/php-mock-phpunit": "^2.0",
4747
"phpmd/phpmd": "@stable",
48-
"phpstan/phpstan": "^0.12",
48+
"phpstan/phpstan": "^1.10",
4949
"phpunit/php-code-coverage": "^7.0 || ^9.2",
5050
"phpunit/phpunit": "^8.5 || ^9.5",
5151
"squizlabs/php_codesniffer": "^3.0",

src/App/Logger/Gelf/TransportFactory.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ class TransportFactory
2222
public const TRANSPORT_UDP = 'udp';
2323
public const TRANSPORT_TCP = 'tcp';
2424

25+
private const DEFAULT_HOST = '127.0.0.1';
26+
private const DEFAULT_PORT_HTTP = 12202;
27+
private const DEFAULT_PORT_TCP = 12201;
28+
private const DEFAULT_PORT_UDP = 12201;
29+
private const DEFAULT_PATH_HTTP = '/gelf';
30+
2531
/**
2632
* @param string $type
2733
* @param array $config
@@ -34,27 +40,27 @@ public function create(string $type, array $config): AbstractTransport
3440
switch ($type) {
3541
case self::TRANSPORT_HTTP:
3642
$transport = new HttpTransport(
37-
$config['host'] ?? null,
38-
$config['port'] ?? null,
39-
$config['path'] ?? null
43+
$config['host'] ?? self::DEFAULT_HOST,
44+
$config['port'] ?? self::DEFAULT_PORT_HTTP,
45+
$config['path'] ?? self::DEFAULT_PATH_HTTP
4046
);
4147
if (isset($config['connection_timeout'])) {
4248
$transport->setConnectTimeout($config['connection_timeout']);
4349
}
4450
break;
4551
case self::TRANSPORT_TCP:
4652
$transport = new TcpTransport(
47-
$config['host'] ?? TcpTransport::DEFAULT_HOST,
48-
$config['port'] ?? TcpTransport::DEFAULT_PORT
53+
$config['host'] ?? self::DEFAULT_HOST,
54+
$config['port'] ?? self::DEFAULT_PORT_TCP
4955
);
5056
if (isset($config['connection_timeout'])) {
5157
$transport->setConnectTimeout($config['connection_timeout']);
5258
}
5359
break;
5460
case self::TRANSPORT_UDP:
5561
$transport = new UdpTransport(
56-
$config['host'] ?? UdpTransport::DEFAULT_HOST,
57-
$config['port'] ?? UdpTransport::DEFAULT_PORT,
62+
$config['host'] ?? self::DEFAULT_HOST,
63+
$config['port'] ?? self::DEFAULT_PORT_UDP,
5864
$config['chunk_size'] ?? UdpTransport::CHUNK_SIZE_WAN
5965
);
6066
break;

src/Filesystem/DirectoryList.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ public function getPath(string $code, bool $relativePath = false): string
8080
throw new \RuntimeException("Code {$code} is not registered");
8181
}
8282

83-
if (!array_key_exists(static::PATH, $directories[$code])) {
83+
if (!array_key_exists(self::PATH, $directories[$code])) {
8484
throw new \RuntimeException(
85-
sprintf('Config var "%s" does not exists', static::PATH)
85+
sprintf('Config var "%s" does not exists', self::PATH)
8686
);
8787
}
8888

@@ -113,7 +113,7 @@ public function getMagentoRoot(): string
113113
*/
114114
public function getInit(): string
115115
{
116-
return $this->getPath(static::DIR_INIT);
116+
return $this->getPath(self::DIR_INIT);
117117
}
118118

119119
/**
@@ -122,7 +122,7 @@ public function getInit(): string
122122
*/
123123
public function getVar(): string
124124
{
125-
return $this->getPath(static::DIR_VAR);
125+
return $this->getPath(self::DIR_VAR);
126126
}
127127

128128
/**
@@ -131,7 +131,7 @@ public function getVar(): string
131131
*/
132132
public function getLog(): string
133133
{
134-
return $this->getPath(static::DIR_LOG);
134+
return $this->getPath(self::DIR_LOG);
135135
}
136136

137137
/**
@@ -140,7 +140,7 @@ public function getLog(): string
140140
*/
141141
public function getGeneratedCode(): string
142142
{
143-
return $this->getPath(static::DIR_GENERATED_CODE);
143+
return $this->getPath(self::DIR_GENERATED_CODE);
144144
}
145145

146146
/**
@@ -149,7 +149,7 @@ public function getGeneratedCode(): string
149149
*/
150150
public function getGeneratedMetadata(): string
151151
{
152-
return $this->getPath(static::DIR_GENERATED_METADATA);
152+
return $this->getPath(self::DIR_GENERATED_METADATA);
153153
}
154154

155155
/**
@@ -161,15 +161,15 @@ public function getGeneratedMetadata(): string
161161
public function getWritableDirectories(): array
162162
{
163163
$writableDirs = [
164-
static::DIR_ETC,
165-
static::DIR_MEDIA,
166-
static::DIR_LOG,
167-
static::DIR_VIEW_PREPROCESSED,
164+
self::DIR_ETC,
165+
self::DIR_MEDIA,
166+
self::DIR_LOG,
167+
self::DIR_VIEW_PREPROCESSED,
168168
];
169169

170170
if ($this->magentoVersion->satisfies('2.1.*')) {
171-
$writableDirs[] = static::DIR_GENERATED_METADATA;
172-
$writableDirs[] = static::DIR_GENERATED_CODE;
171+
$writableDirs[] = self::DIR_GENERATED_METADATA;
172+
$writableDirs[] = self::DIR_GENERATED_CODE;
173173
}
174174

175175
return array_map(function ($path) {
@@ -186,10 +186,10 @@ public function getWritableDirectories(): array
186186
public function getMountPoints(): array
187187
{
188188
$mountPoints = [
189-
static::DIR_ETC,
190-
static::DIR_VAR,
191-
static::DIR_MEDIA,
192-
static::DIR_STATIC
189+
self::DIR_ETC,
190+
self::DIR_VAR,
191+
self::DIR_MEDIA,
192+
self::DIR_STATIC
193193
];
194194

195195
return array_map(function ($path) {
@@ -203,13 +203,13 @@ public function getMountPoints(): array
203203
private function getDefaultDirectories(): array
204204
{
205205
$config = [
206-
static::DIR_INIT => [static::PATH => 'init'],
207-
static::DIR_VAR => [static::PATH => 'var'],
208-
static::DIR_LOG => [static::PATH => 'var/log'],
209-
static::DIR_ETC => [static::PATH => 'app/etc'],
210-
static::DIR_MEDIA => [static::PATH => 'pub/media'],
211-
static::DIR_STATIC => [static::PATH => 'pub/static'],
212-
static::DIR_VIEW_PREPROCESSED => [static::PATH => 'var/view_preprocessed'],
206+
self::DIR_INIT => [self::PATH => 'init'],
207+
self::DIR_VAR => [self::PATH => 'var'],
208+
self::DIR_LOG => [self::PATH => 'var/log'],
209+
self::DIR_ETC => [self::PATH => 'app/etc'],
210+
self::DIR_MEDIA => [self::PATH => 'pub/media'],
211+
self::DIR_STATIC => [self::PATH => 'pub/static'],
212+
self::DIR_VIEW_PREPROCESSED => [self::PATH => 'var/view_preprocessed'],
213213
];
214214

215215
return $config;
@@ -224,11 +224,11 @@ private function getDefaultVariadicDirectories(): array
224224
$config = [];
225225

226226
if ($this->magentoVersion->satisfies('2.1.*')) {
227-
$config[static::DIR_GENERATED_CODE] = [static::PATH => 'var/generation'];
228-
$config[static::DIR_GENERATED_METADATA] = [static::PATH => 'var/di'];
227+
$config[self::DIR_GENERATED_CODE] = [self::PATH => 'var/generation'];
228+
$config[self::DIR_GENERATED_METADATA] = [self::PATH => 'var/di'];
229229
} else {
230-
$config[static::DIR_GENERATED_CODE] = [static::PATH => 'generated/code'];
231-
$config[static::DIR_GENERATED_METADATA] = [static::PATH => 'generated/metadata'];
230+
$config[self::DIR_GENERATED_CODE] = [self::PATH => 'generated/code'];
231+
$config[self::DIR_GENERATED_METADATA] = [self::PATH => 'generated/metadata'];
232232
}
233233

234234
return $config;

src/Service/Validator.php

Lines changed: 2 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 || ~6.2.0 || ~7.0.0',
23+
'*' => '~3.2.0 || ~4.0.0 || ~5.0.0 || ~6.0.0 || ~6.2.0 || ~7.0.0 || ~7.2.0',
2424
];
2525

2626
/**
@@ -91,7 +91,7 @@ class Validator
9191
'>=2.3.0 <2.3.7-p4 || >=2.4.0 <2.4.3-p3' => '~3.5.0 || ~3.7.0 || ~3.8.0',
9292
'>=2.4.3-p3 <2.4.5-p3 || ~2.3.7-p4' => '~3.5.0 || ~3.7.0 || ~3.8.0 || ~3.9.0',
9393
'>=2.4.5-p3 <2.4.7' => '~3.9.0 || ~3.11.0',
94-
'>=2.4.7' => '~3.11.0',
94+
'>=2.4.7' => '~3.12.0 || ~3.13.0',
9595
],
9696
ServiceInterface::NAME_NODE => [
9797
'*' => '^6 || ^8 || ^10 || ^11',

src/Test/Unit/App/Logger/Gelf/MessageFormatterTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ public function testSetAdditional()
4040
'datetime' => new \DateTime(),
4141
'level' => Logger::INFO,
4242
'extra' => [],
43-
'context' => []
43+
'context' => [],
44+
'channel' => 'some_channel'
4445
]);
4546

4647
$this->assertEquals(
4748
[
48-
'some_key' => 'some_value'
49+
'some_key' => 'some_value',
50+
'facility' => 'some_channel'
4951
],
5052
$message->getAllAdditionals()
5153
);

src/Test/Unit/ApplicationTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
use Composer\Composer;
1111
use Composer\Package\PackageInterface;
12+
use Composer\Package\RootPackageInterface;
1213
use Magento\MagentoCloud\App\ContainerInterface;
1314
use Magento\MagentoCloud\Application;
1415
use Magento\MagentoCloud\Command;
1516
use PHPUnit\Framework\MockObject\MockObject;
1617
use PHPUnit\Framework\TestCase;
18+
use Symfony\Component\Console\Input\InputDefinition;
1719

1820
/**
1921
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -36,10 +38,15 @@ class ApplicationTest extends TestCase
3638
private $composerMock;
3739

3840
/**
39-
* @var PackageInterface|MockObject
41+
* @var RootPackageInterface|MockObject
4042
*/
4143
private $packageMock;
4244

45+
/**
46+
* @var InputDefinition|MockObject
47+
*/
48+
private $inputDefinitionMock;
49+
4350
/**
4451
* @var string
4552
*/
@@ -94,8 +101,9 @@ class ApplicationTest extends TestCase
94101
public function setUp(): void
95102
{
96103
$this->containerMock = $this->getMockForAbstractClass(ContainerInterface::class);
97-
$this->packageMock = $this->getMockForAbstractClass(PackageInterface::class);
104+
$this->packageMock = $this->getMockForAbstractClass(RootPackageInterface::class);
98105
$this->composerMock = $this->createMock(Composer::class);
106+
$this->inputDefinitionMock = $this->createMock(InputDefinition::class);
99107

100108
$map = [
101109
[Composer::class, [], $this->composerMock],
@@ -108,7 +116,7 @@ public function setUp(): void
108116
$mock->method('isEnabled')
109117
->willReturn(true);
110118
$mock->method('getDefinition')
111-
->willReturn([]);
119+
->willReturn($this->inputDefinitionMock);
112120
$mock->method('getAliases')
113121
->willReturn([]);
114122

src/Test/Unit/Config/AdminDataTest.php

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

1010
use Magento\MagentoCloud\Config\AdminData;
1111
use Magento\MagentoCloud\Config\EnvironmentDataInterface;
12-
use PHPStan\Testing\TestCase;
1312
use PHPUnit\Framework\MockObject\MockObject;
13+
use PHPUnit\Framework\TestCase;
1414

1515
/**
1616
* @inheritDoc

src/Test/Unit/Config/EnvironmentDataTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
use Magento\MagentoCloud\Filesystem\Driver\File;
1818
use Magento\MagentoCloud\Filesystem\FileSystemException;
1919
use phpmock\phpunit\PHPMock;
20-
use PHPStan\Testing\TestCase;
2120
use PHPUnit\Framework\MockObject\MockObject;
21+
use PHPUnit\Framework\TestCase;
2222

2323
/**
2424
* @inheritDoc

src/Test/Unit/Config/Validator/Deploy/PhpVersionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\MagentoCloud\Test\Unit\Config\Validator\Deploy;
99

1010
use Composer\Composer;
11+
use Composer\Repository\LockArrayRepository;
1112
use Magento\MagentoCloud\Config\GlobalSection;
1213
use Magento\MagentoCloud\Config\Validator\Deploy\PhpVersion;
1314
use Composer\Package\Version\VersionParser;
@@ -19,7 +20,6 @@
1920
use PHPUnit\Framework\TestCase;
2021
use Magento\MagentoCloud\Config\Validator\ResultInterface;
2122
use Composer\Package\Locker;
22-
use Composer\Repository\RepositoryInterface;
2323
use Composer\Package\PackageInterface;
2424
use Composer\Package\Link;
2525
use Magento\MagentoCloud\Config\Validator\Result\Error;
@@ -175,7 +175,7 @@ public function testValidationSuccessInstallFromComposerVersion(): void
175175
->with(GlobalSection::VAR_DEPLOYED_MAGENTO_VERSION_FROM_GIT)
176176
->willReturn(null);
177177

178-
$repoMock = $this->getMockForAbstractClass(RepositoryInterface::class);
178+
$repoMock = $this->createMock(LockArrayRepository::class);
179179
$lockerMock = $this->createMock(Locker::class);
180180
$repoMock->method('findPackage')
181181
->with('magento/magento2-base', '*')
@@ -199,7 +199,7 @@ protected function setUpComposerMocks(): void
199199
$constraintMock = $this->getMockForAbstractClass(ConstraintInterface::class);
200200
$linkMock = $this->createMock(Link::class);
201201
$packageMock = $this->getMockForAbstractClass(PackageInterface::class);
202-
$repoMock = $this->getMockForAbstractClass(RepositoryInterface::class);
202+
$repoMock = $this->createMock(LockArrayRepository::class);
203203
$lockerMock = $this->createMock(Locker::class);
204204
$this->composerConstraintMock = $this->getMockForAbstractClass(ConstraintInterface::class);
205205
$this->phpConstraintMock = $this->getMockForAbstractClass(ConstraintInterface::class);

src/Test/Unit/Package/MagentoVersionTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,6 @@ public function testIsGitInstallationException(): void
305305
->method('get')
306306
->with(GlobalConfig::VAR_DEPLOYED_MAGENTO_VERSION_FROM_GIT)
307307
->willReturn(false);
308-
$this->rootPackageMock->method('getPrettyVersion')
309-
->willReturn(null);
310308

311309
self::assertTrue($this->magentoVersion->isGitInstallation());
312310
}

0 commit comments

Comments
 (0)