Skip to content

Commit d10e13a

Browse files
Update ComposerFileTest MTFT for new change in code.
1 parent 5f5e06d commit d10e13a

File tree

1 file changed

+21
-49
lines changed

1 file changed

+21
-49
lines changed

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

Lines changed: 21 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,10 @@ protected function setUp(): void
7272
*/
7373
public function testValidateCorrectComposerJson(): void
7474
{
75-
$this->magentoVersionMock->expects($this->once())
76-
->method('isGreaterOrEqual')
77-
->with('2.3')
78-
->willReturn(true);
79-
$this->magentoVersionMock->expects($this->once())
75+
$this->magentoVersionMock->expects($this->exactly(2))
8076
->method('isGreaterOrEqual')
81-
->with('2.4.3')
82-
->willReturn(false);
77+
->withConsecutive(['2.3'], ['2.4.3'])
78+
->willReturnOnConsecutiveCalls(true, false);
8379
$this->fileListMock->expects($this->once())
8480
->method('getMagentoComposer')
8581
->willReturn(__DIR__ . '/_files/correct_composer_2.3.json');
@@ -94,14 +90,10 @@ public function testValidateCorrectComposerJson(): void
9490
*/
9591
public function testValidateCorrectLaminasComposerJson(): void
9692
{
97-
$this->magentoVersionMock->expects($this->once())
98-
->method('isGreaterOrEqual')
99-
->with('2.3')
100-
->willReturn(true);
101-
$this->magentoVersionMock->expects($this->once())
93+
$this->magentoVersionMock->expects($this->exactly(2))
10294
->method('isGreaterOrEqual')
103-
->with('2.4.3')
104-
->willReturn(false);
95+
->withConsecutive(['2.3'], ['2.4.3'])
96+
->willReturnOnConsecutiveCalls(true, false);
10597
$this->fileListMock->expects($this->once())
10698
->method('getMagentoComposer')
10799
->willReturn(__DIR__ . '/_files/correct_composer_2.3_2.json');
@@ -116,14 +108,10 @@ public function testValidateCorrectLaminasComposerJson(): void
116108
*/
117109
public function testValidateCorrectAutoload243ComposerJson(): void
118110
{
119-
$this->magentoVersionMock->expects($this->once())
111+
$this->magentoVersionMock->expects($this->exactly(2))
120112
->method('isGreaterOrEqual')
121-
->with('2.3')
122-
->willReturn(true);
123-
$this->magentoVersionMock->expects($this->once())
124-
->method('isGreaterOrEqual')
125-
->with('2.4.3')
126-
->willReturn(false);
113+
->withConsecutive(['2.3'], ['2.4.3'])
114+
->willReturnOnConsecutiveCalls(true, false);
127115
$this->fileListMock->expects($this->once())
128116
->method('getMagentoComposer')
129117
->willReturn(__DIR__ . '/_files/correct_composer_2.3_2.json');
@@ -138,14 +126,10 @@ public function testValidateCorrectAutoload243ComposerJson(): void
138126
*/
139127
public function testValidateWrongComposerJson(): void
140128
{
141-
$this->magentoVersionMock->expects($this->once())
129+
$this->magentoVersionMock->expects($this->exactly(2))
142130
->method('isGreaterOrEqual')
143-
->with('2.3')
144-
->willReturn(true);
145-
$this->magentoVersionMock->expects($this->once())
146-
->method('isGreaterOrEqual')
147-
->with('2.4.3')
148-
->willReturn(false);
131+
->withConsecutive(['2.3'], ['2.4.3'])
132+
->willReturnOnConsecutiveCalls(true, false);
149133
$this->fileListMock->expects($this->once())
150134
->method('getMagentoComposer')
151135
->willReturn(__DIR__ . '/_files/wrong_composer_2.3.json');
@@ -171,14 +155,10 @@ public function testValidateWrongComposerJson(): void
171155
*/
172156
public function testValidateMagentoLower23(): void
173157
{
174-
$this->magentoVersionMock->expects($this->once())
158+
$this->magentoVersionMock->expects($this->exactly(1))
175159
->method('isGreaterOrEqual')
176-
->with('2.3')
177-
->willReturn(false);
178-
$this->magentoVersionMock->expects($this->once())
179-
->method('isGreaterOrEqual')
180-
->with('2.4.3')
181-
->willReturn(false);
160+
->withConsecutive(['2.3'])
161+
->willReturnOnConsecutiveCalls(false);
182162
$this->fileListMock->expects($this->never())
183163
->method('getMagentoComposer');
184164
$this->resultFactoryMock->expects($this->once())
@@ -192,14 +172,10 @@ public function testValidateMagentoLower23(): void
192172
*/
193173
public function testValidateMagentoHigherEqual243(): void
194174
{
195-
$this->magentoVersionMock->expects($this->once())
175+
$this->magentoVersionMock->expects($this->exactly(1))
196176
->method('isGreaterOrEqual')
197-
->with('2.3')
198-
->willReturn(false);
199-
$this->magentoVersionMock->expects($this->once())
200-
->method('isGreaterOrEqual')
201-
->with('2.4.3')
202-
->willReturn(false);
177+
->withConsecutive(['2.3'])
178+
->willReturnOnConsecutiveCalls(false);
203179
$this->fileListMock->expects($this->never())
204180
->method('getMagentoComposer');
205181
$this->resultFactoryMock->expects($this->once())
@@ -213,14 +189,10 @@ public function testValidateMagentoHigherEqual243(): void
213189
*/
214190
public function testValidateComposerFileNotExists(): void
215191
{
216-
$this->magentoVersionMock->expects($this->once())
217-
->method('isGreaterOrEqual')
218-
->with('2.3')
219-
->willReturn(true);
220-
$this->magentoVersionMock->expects($this->once())
192+
$this->magentoVersionMock->expects($this->exactly(2))
221193
->method('isGreaterOrEqual')
222-
->with('2.4.3')
223-
->willReturn(true);
194+
->withConsecutive(['2.3'], ['2.4.3'])
195+
->willReturnOnConsecutiveCalls(true, false);
224196
$this->fileListMock->expects($this->once())
225197
->method('getMagentoComposer')
226198
->willReturn(__DIR__ . '/_files/file_not_exists.json');

0 commit comments

Comments
 (0)