Skip to content

Commit 89957f8

Browse files
MCLOUD-13707: Included newer versions for ECE tools package dependency
1 parent bd6d2ca commit 89957f8

File tree

3 files changed

+79
-39
lines changed

3 files changed

+79
-39
lines changed

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@
2020
"composer/semver": "@stable",
2121
"graylog2/gelf-php": "^2.0.1",
2222
"guzzlehttp/guzzle": "^7.3 || ^7.5",
23-
"illuminate/config": "^10.0 || ^11.0",
23+
"illuminate/config": "^10.0 || ^11.0 || ^12.15",
2424
"magento/magento-cloud-components": "^1.0.8",
2525
"magento/magento-cloud-docker": "^1.4.0",
2626
"magento/magento-cloud-patches": "^1.0.20",
2727
"magento/quality-patches": "^1.1.0",
2828
"monolog/monolog": "^2.3 || ^2.7 || ^3.6",
2929
"nesbot/carbon": "^1.0 || ^2.0 || ^3.8",
30-
"psr/container": "^1.0",
30+
"psr/container": "^1.0 || ^2.0",
3131
"psr/log": "^1.0 || ^2.0 || ^3.0",
32-
"symfony/config": "^4.4 || ^5.1 || ^5.4 || ^6.4",
33-
"symfony/console": "^4.4 || ^5.1 || ^5.4 || ^6.4",
34-
"symfony/dependency-injection": "^4.4 || ^5.1 || ^5.4 || ^6.4",
35-
"symfony/process": "^4.4 || ^5.1 || ^5.4 || ^6.4",
36-
"symfony/serializer": "^4.4 || ^5.4 || ^6.4",
37-
"symfony/yaml": "^4.4 || ^5.1 || ^5.4 || ^6.4"
32+
"symfony/config": "^4.4 || ^5.1 || ^5.4 || ^6.4 || ^7.2",
33+
"symfony/console": "^4.4 || ^5.1 || ^5.4 || ^6.4 || ^7.2",
34+
"symfony/dependency-injection": "^4.4 || ^5.1 || ^5.4 || ^6.4 || ^7.2",
35+
"symfony/process": "^4.4 || ^5.1 || ^5.4 || ^6.4 || ^7.2",
36+
"symfony/serializer": "^4.4 || ^5.4 || ^6.4 || ^7.2",
37+
"symfony/yaml": "^4.4 || ^5.1 || ^5.4 || ^6.4 || ^7.2"
3838
},
3939
"require-dev": {
4040
"codeception/codeception": "^5.1",
4141
"codeception/module-asserts": "^3.0",
4242
"codeception/module-db": "^3.0",
4343
"codeception/module-phpbrowser": "^3.0",
4444
"codeception/module-rest": "^3.0",
45-
"consolidation/robo": "^3.0",
45+
"consolidation/robo": "^3.0 || ^4.0 || ^5.0",
4646
"php-mock/php-mock-phpunit": "^2.0",
4747
"phpmd/phpmd": "@stable",
4848
"phpstan/phpstan": "1.2.0 || ^2.0",

src/Test/Unit/StaticContent/ThemeResolverTest.php

Lines changed: 53 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
use PHPUnit\Framework\TestCase;
1414

1515
/**
16-
* @inheritdoc
16+
* Test class for ThemeResolver
1717
*/
1818
class ThemeResolverTest extends TestCase
1919
{
2020
/**
21-
* @var ThemeResolver
21+
* @var ThemeResolver|MockObject
2222
*/
2323
private $themeResolver;
2424

@@ -36,34 +36,46 @@ protected function setUp(): void
3636

3737
$this->themeResolver = $this->getMockBuilder(ThemeResolver::class)
3838
->onlyMethods(['getThemes'])
39-
->setConstructorArgs([
40-
$this->loggerMock,
41-
])->getMock();
39+
->setConstructorArgs([$this->loggerMock])
40+
->getMock();
4241
}
4342

4443
/**
45-
* @param string $expectedReturn
46-
* @param string $passedTheme
47-
*
44+
* @param string $expectedReturn
45+
* @param string $passedTheme
4846
* @dataProvider testResolveDataProvider
4947
*/
5048
public function testResolve(string $expectedReturn, string $passedTheme): void
5149
{
52-
$this->themeResolver->expects($this->once())
53-
->method('getThemes')
50+
$this->themeResolver->method('getThemes')
5451
->willReturn(['SomeVendor/sometheme']);
5552

56-
$this->loggerMock->expects($this->exactly(2))
57-
->method('warning')
58-
->willReturnOnConsecutiveCalls(
59-
'Theme SomeVendor/Sometheme does not exist, attempting to resolve.',
60-
'Theme found as SomeVendor/sometheme Using corrected name instead'
53+
$messages = [];
54+
55+
$this->loggerMock->method('warning')
56+
->willReturnCallback(
57+
function ($msg) use (&$messages) {
58+
$messages[] = $msg;
59+
}
6160
);
6261

62+
$this->loggerMock->expects($this->never())
63+
->method('error');
64+
6365
$this->assertEquals(
6466
$expectedReturn,
6567
$this->themeResolver->resolve($passedTheme)
6668
);
69+
70+
$this->assertCount(2, $messages);
71+
$this->assertSame(
72+
'Theme ' . $passedTheme . ' does not exist, attempting to resolve.',
73+
$messages[0]
74+
);
75+
$this->assertSame(
76+
'Theme found as SomeVendor/sometheme. Using corrected name instead.',
77+
$messages[1]
78+
);
6779
}
6880

6981
public function testResolveDataProvider(): array
@@ -82,9 +94,9 @@ public function testResolveDataProvider(): array
8294

8395
public function testCorrect(): void
8496
{
85-
$this->themeResolver->expects($this->once())
86-
->method('getThemes')
97+
$this->themeResolver->method('getThemes')
8798
->willReturn(['SomeVendor/sometheme']);
99+
88100
$this->loggerMock->expects($this->never())
89101
->method('warning');
90102
$this->loggerMock->expects($this->never())
@@ -98,19 +110,35 @@ public function testCorrect(): void
98110

99111
public function testNoResolve(): void
100112
{
101-
$this->themeResolver->expects($this->once())
102-
->method('getThemes')
113+
$this->themeResolver->method('getThemes')
103114
->willReturn(['SomeVendor/sometheme']);
104-
$this->loggerMock->expects($this->once())
105-
->method('warning')
106-
->willReturn('Theme SomeVendor/doesntExist does not exist, attempting to resolve.');
107-
$this->loggerMock->expects($this->once())
108-
->method('error')
109-
->willReturn('Unable to resolve theme.');
115+
116+
$warnings = [];
117+
$errors = [];
118+
119+
$this->loggerMock->method('warning')
120+
->willReturnCallback(
121+
function ($msg) use (&$warnings) {
122+
$warnings[] = $msg;
123+
}
124+
);
125+
126+
$this->loggerMock->method('error')
127+
->willReturnCallback(
128+
function ($msg) use (&$errors) {
129+
$errors[] = $msg;
130+
}
131+
);
110132

111133
$this->assertEquals(
112134
'',
113135
$this->themeResolver->resolve('SomeVendor/doesntExist')
114136
);
137+
138+
$this->assertCount(1, $warnings);
139+
$this->assertSame('Theme SomeVendor/doesntExist does not exist, attempting to resolve.', $warnings[0]);
140+
141+
$this->assertCount(1, $errors);
142+
$this->assertSame('Unable to resolve theme.', $errors[0]);
115143
}
116144
}

src/Test/Unit/Step/SetProductionModeTest.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,17 @@ public function testExecute(): void
5757
{
5858
$this->loggerMock->expects($this->once())
5959
->method('info')
60-
->willReturn("Set Magento application mode to 'production'");
60+
->willReturnCallback(
61+
function (string $message): void {
62+
// Simulate logging without returning anything (void)
63+
$this->assertSame("Set Magento application mode to 'production'", $message);
64+
}
65+
);
66+
6167
$this->writer->expects($this->once())
6268
->method('update')
6369
->with(['MAGE_MODE' => 'production']);
64-
70+
6571
$this->step->execute();
6672
}
6773

@@ -71,15 +77,21 @@ public function testExecute(): void
7177
public function testExecuteWitException(): void
7278
{
7379
$this->expectException(StepException::class);
74-
$this->expectExceptionMessage('can\'t update file');
80+
$this->expectExceptionMessage("can't update file");
7581
$this->expectExceptionCode(Error::BUILD_ENV_PHP_IS_NOT_WRITABLE);
7682

7783
$this->loggerMock->expects($this->once())
7884
->method('info')
79-
->willReturn("Set Magento application mode to 'production'");
85+
->willReturnCallback(
86+
function (string $message): void {
87+
// Simulate logging without returning anything (void)
88+
$this->assertSame("Set Magento application mode to 'production'", $message);
89+
}
90+
);
91+
8092
$this->writer->expects($this->once())
8193
->method('update')
82-
->willThrowException(new FileSystemException('can\'t update file'));
94+
->willThrowException(new FileSystemException("can't update file"));
8395

8496
$this->step->execute();
8597
}

0 commit comments

Comments
 (0)