Skip to content

Commit 78a86f6

Browse files
authored
Merge pull request #72 from magento-commerce/imported-mediact-ece-tools-799
[Imported] Feature/resolve autoload
2 parents c6be6c8 + 38b4395 commit 78a86f6

File tree

2 files changed

+56
-21
lines changed

2 files changed

+56
-21
lines changed

src/Config/Validator/Build/ComposerFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function __construct(
8484
public function validate(): Validator\ResultInterface
8585
{
8686
try {
87-
if (!$this->magentoVersion->isGreaterOrEqual('2.3')) {
87+
if (!$this->magentoVersion->isGreaterOrEqual('2.3') || $this->magentoVersion->isGreaterOrEqual('2.4.3')) {
8888
return $this->resultFactory->success();
8989
}
9090

src/Test/Unit/Config/Validator/Build/ComposerFileTest.php

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ protected function setUp(): void
6868
}
6969

7070
/**
71-
* @throws UndefinedPackageException
71+
* @inheritdoc
7272
*/
7373
public function testValidateCorrectComposerJson(): void
7474
{
75-
$this->magentoVersionMock->expects($this->once())
75+
$this->magentoVersionMock->expects($this->exactly(2))
7676
->method('isGreaterOrEqual')
77-
->with('2.3')
78-
->willReturn(true);
77+
->withConsecutive(['2.3'], ['2.4.3'])
78+
->willReturnOnConsecutiveCalls(true, false);
7979
$this->fileListMock->expects($this->once())
8080
->method('getMagentoComposer')
8181
->willReturn(__DIR__ . '/_files/correct_composer_2.3.json');
@@ -86,14 +86,14 @@ public function testValidateCorrectComposerJson(): void
8686
}
8787

8888
/**
89-
* @throws UndefinedPackageException
89+
* @inheritdoc
9090
*/
9191
public function testValidateCorrectLaminasComposerJson(): void
9292
{
93-
$this->magentoVersionMock->expects($this->once())
93+
$this->magentoVersionMock->expects($this->exactly(2))
9494
->method('isGreaterOrEqual')
95-
->with('2.3')
96-
->willReturn(true);
95+
->withConsecutive(['2.3'], ['2.4.3'])
96+
->willReturnOnConsecutiveCalls(true, false);
9797
$this->fileListMock->expects($this->once())
9898
->method('getMagentoComposer')
9999
->willReturn(__DIR__ . '/_files/correct_composer_2.3_2.json');
@@ -104,14 +104,32 @@ public function testValidateCorrectLaminasComposerJson(): void
104104
}
105105

106106
/**
107-
* @throws UndefinedPackageException
107+
* @inheritdoc
108+
*/
109+
public function testValidateCorrectAutoload243ComposerJson(): void
110+
{
111+
$this->magentoVersionMock->expects($this->exactly(2))
112+
->method('isGreaterOrEqual')
113+
->withConsecutive(['2.3'], ['2.4.3'])
114+
->willReturnOnConsecutiveCalls(true, false);
115+
$this->fileListMock->expects($this->once())
116+
->method('getMagentoComposer')
117+
->willReturn(__DIR__ . '/_files/correct_composer_2.3_2.json');
118+
$this->resultFactoryMock->expects($this->once())
119+
->method('success');
120+
121+
$this->validator->validate();
122+
}
123+
124+
/**
125+
* @inheritdoc
108126
*/
109127
public function testValidateWrongComposerJson(): void
110128
{
111-
$this->magentoVersionMock->expects($this->once())
129+
$this->magentoVersionMock->expects($this->exactly(2))
112130
->method('isGreaterOrEqual')
113-
->with('2.3')
114-
->willReturn(true);
131+
->withConsecutive(['2.3'], ['2.4.3'])
132+
->willReturnOnConsecutiveCalls(true, false);
115133
$this->fileListMock->expects($this->once())
116134
->method('getMagentoComposer')
117135
->willReturn(__DIR__ . '/_files/wrong_composer_2.3.json');
@@ -133,14 +151,14 @@ public function testValidateWrongComposerJson(): void
133151
}
134152

135153
/**
136-
* @throws UndefinedPackageException
154+
* @inheritdoc
137155
*/
138156
public function testValidateMagentoLower23(): void
139157
{
140-
$this->magentoVersionMock->expects($this->once())
158+
$this->magentoVersionMock->expects($this->exactly(1))
141159
->method('isGreaterOrEqual')
142-
->with('2.3')
143-
->willReturn(false);
160+
->withConsecutive(['2.3'])
161+
->willReturnOnConsecutiveCalls(false);
144162
$this->fileListMock->expects($this->never())
145163
->method('getMagentoComposer');
146164
$this->resultFactoryMock->expects($this->once())
@@ -150,14 +168,31 @@ public function testValidateMagentoLower23(): void
150168
}
151169

152170
/**
153-
* @throws UndefinedPackageException
171+
* @inheritdoc
172+
*/
173+
public function testValidateMagentoHigherEqual243(): void
174+
{
175+
$this->magentoVersionMock->expects($this->exactly(2))
176+
->method('isGreaterOrEqual')
177+
->withConsecutive(['2.3'], ['2.4.3'])
178+
->willReturnOnConsecutiveCalls(true, true);
179+
$this->fileListMock->expects($this->never())
180+
->method('getMagentoComposer');
181+
$this->resultFactoryMock->expects($this->once())
182+
->method('success');
183+
184+
$this->validator->validate();
185+
}
186+
187+
/**
188+
* @inheritdoc
154189
*/
155190
public function testValidateComposerFileNotExists(): void
156191
{
157-
$this->magentoVersionMock->expects($this->once())
192+
$this->magentoVersionMock->expects($this->exactly(2))
158193
->method('isGreaterOrEqual')
159-
->with('2.3')
160-
->willReturn(true);
194+
->withConsecutive(['2.3'], ['2.4.3'])
195+
->willReturnOnConsecutiveCalls(true, false);
161196
$this->fileListMock->expects($this->once())
162197
->method('getMagentoComposer')
163198
->willReturn(__DIR__ . '/_files/file_not_exists.json');

0 commit comments

Comments
 (0)