Skip to content

Commit 5f5e06d

Browse files
Update unit tests.
1 parent 5786f65 commit 5f5e06d

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@ protected function setUp(): void
7272
*/
7373
public function testValidateCorrectComposerJson(): void
7474
{
75-
$this->magentoVersionMock->expects($this->atLeastOnce())
75+
$this->magentoVersionMock->expects($this->once())
7676
->method('isGreaterOrEqual')
7777
->with('2.3')
7878
->willReturn(true);
79+
$this->magentoVersionMock->expects($this->once())
80+
->method('isGreaterOrEqual')
81+
->with('2.4.3')
82+
->willReturn(false);
7983
$this->fileListMock->expects($this->once())
8084
->method('getMagentoComposer')
8185
->willReturn(__DIR__ . '/_files/correct_composer_2.3.json');
@@ -90,10 +94,14 @@ public function testValidateCorrectComposerJson(): void
9094
*/
9195
public function testValidateCorrectLaminasComposerJson(): void
9296
{
93-
$this->magentoVersionMock->expects($this->atLeastOnce())
97+
$this->magentoVersionMock->expects($this->once())
9498
->method('isGreaterOrEqual')
9599
->with('2.3')
96100
->willReturn(true);
101+
$this->magentoVersionMock->expects($this->once())
102+
->method('isGreaterOrEqual')
103+
->with('2.4.3')
104+
->willReturn(false);
97105
$this->fileListMock->expects($this->once())
98106
->method('getMagentoComposer')
99107
->willReturn(__DIR__ . '/_files/correct_composer_2.3_2.json');
@@ -108,10 +116,14 @@ public function testValidateCorrectLaminasComposerJson(): void
108116
*/
109117
public function testValidateCorrectAutoload243ComposerJson(): void
110118
{
111-
$this->magentoVersionMock->expects($this->atLeastOnce())
119+
$this->magentoVersionMock->expects($this->once())
112120
->method('isGreaterOrEqual')
113121
->with('2.3')
114122
->willReturn(true);
123+
$this->magentoVersionMock->expects($this->once())
124+
->method('isGreaterOrEqual')
125+
->with('2.4.3')
126+
->willReturn(false);
115127
$this->fileListMock->expects($this->once())
116128
->method('getMagentoComposer')
117129
->willReturn(__DIR__ . '/_files/correct_composer_2.3_2.json');
@@ -126,10 +138,14 @@ public function testValidateCorrectAutoload243ComposerJson(): void
126138
*/
127139
public function testValidateWrongComposerJson(): void
128140
{
129-
$this->magentoVersionMock->expects($this->atLeastOnce())
141+
$this->magentoVersionMock->expects($this->once())
130142
->method('isGreaterOrEqual')
131143
->with('2.3')
132144
->willReturn(true);
145+
$this->magentoVersionMock->expects($this->once())
146+
->method('isGreaterOrEqual')
147+
->with('2.4.3')
148+
->willReturn(false);
133149
$this->fileListMock->expects($this->once())
134150
->method('getMagentoComposer')
135151
->willReturn(__DIR__ . '/_files/wrong_composer_2.3.json');
@@ -155,10 +171,14 @@ public function testValidateWrongComposerJson(): void
155171
*/
156172
public function testValidateMagentoLower23(): void
157173
{
158-
$this->magentoVersionMock->expects($this->atLeastOnce())
174+
$this->magentoVersionMock->expects($this->once())
159175
->method('isGreaterOrEqual')
160176
->with('2.3')
161177
->willReturn(false);
178+
$this->magentoVersionMock->expects($this->once())
179+
->method('isGreaterOrEqual')
180+
->with('2.4.3')
181+
->willReturn(false);
162182
$this->fileListMock->expects($this->never())
163183
->method('getMagentoComposer');
164184
$this->resultFactoryMock->expects($this->once())
@@ -172,7 +192,11 @@ public function testValidateMagentoLower23(): void
172192
*/
173193
public function testValidateMagentoHigherEqual243(): void
174194
{
175-
$this->magentoVersionMock->expects($this->atLeastOnce())
195+
$this->magentoVersionMock->expects($this->once())
196+
->method('isGreaterOrEqual')
197+
->with('2.3')
198+
->willReturn(false);
199+
$this->magentoVersionMock->expects($this->once())
176200
->method('isGreaterOrEqual')
177201
->with('2.4.3')
178202
->willReturn(false);
@@ -189,10 +213,14 @@ public function testValidateMagentoHigherEqual243(): void
189213
*/
190214
public function testValidateComposerFileNotExists(): void
191215
{
192-
$this->magentoVersionMock->expects($this->atLeastOnce())
216+
$this->magentoVersionMock->expects($this->once())
193217
->method('isGreaterOrEqual')
194218
->with('2.3')
195219
->willReturn(true);
220+
$this->magentoVersionMock->expects($this->once())
221+
->method('isGreaterOrEqual')
222+
->with('2.4.3')
223+
->willReturn(true);
196224
$this->fileListMock->expects($this->once())
197225
->method('getMagentoComposer')
198226
->willReturn(__DIR__ . '/_files/file_not_exists.json');
@@ -212,7 +240,7 @@ public function testValidateComposerFileNotExists(): void
212240
*/
213241
public function testValidateCantGetMagentoVersion(): void
214242
{
215-
$this->magentoVersionMock->expects($this->atLeastOnce())
243+
$this->magentoVersionMock->expects($this->once())
216244
->method('isGreaterOrEqual')
217245
->willThrowException(new UndefinedPackageException('some error'));
218246
$this->fileListMock->expects($this->never())

0 commit comments

Comments
 (0)