@@ -68,14 +68,14 @@ protected function setUp(): void
68
68
}
69
69
70
70
/**
71
- * @throws UndefinedPackageException
71
+ * @inheritdoc
72
72
*/
73
73
public function testValidateCorrectComposerJson (): void
74
74
{
75
- $ this ->magentoVersionMock ->expects ($ this ->once ( ))
75
+ $ this ->magentoVersionMock ->expects ($ this ->exactly ( 2 ))
76
76
->method ('isGreaterOrEqual ' )
77
- ->with ( '2.3 ' )
78
- ->willReturn (true );
77
+ ->withConsecutive ([ '2.3 ' ], [ ' 2.4.3 ' ] )
78
+ ->willReturnOnConsecutiveCalls (true , false );
79
79
$ this ->fileListMock ->expects ($ this ->once ())
80
80
->method ('getMagentoComposer ' )
81
81
->willReturn (__DIR__ . '/_files/correct_composer_2.3.json ' );
@@ -86,14 +86,14 @@ public function testValidateCorrectComposerJson(): void
86
86
}
87
87
88
88
/**
89
- * @throws UndefinedPackageException
89
+ * @inheritdoc
90
90
*/
91
91
public function testValidateCorrectLaminasComposerJson (): void
92
92
{
93
- $ this ->magentoVersionMock ->expects ($ this ->once ( ))
93
+ $ this ->magentoVersionMock ->expects ($ this ->exactly ( 2 ))
94
94
->method ('isGreaterOrEqual ' )
95
- ->with ( '2.3 ' )
96
- ->willReturn (true );
95
+ ->withConsecutive ([ '2.3 ' ], [ ' 2.4.3 ' ] )
96
+ ->willReturnOnConsecutiveCalls (true , false );
97
97
$ this ->fileListMock ->expects ($ this ->once ())
98
98
->method ('getMagentoComposer ' )
99
99
->willReturn (__DIR__ . '/_files/correct_composer_2.3_2.json ' );
@@ -104,14 +104,32 @@ public function testValidateCorrectLaminasComposerJson(): void
104
104
}
105
105
106
106
/**
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
108
126
*/
109
127
public function testValidateWrongComposerJson (): void
110
128
{
111
- $ this ->magentoVersionMock ->expects ($ this ->once ( ))
129
+ $ this ->magentoVersionMock ->expects ($ this ->exactly ( 2 ))
112
130
->method ('isGreaterOrEqual ' )
113
- ->with ( '2.3 ' )
114
- ->willReturn (true );
131
+ ->withConsecutive ([ '2.3 ' ], [ ' 2.4.3 ' ] )
132
+ ->willReturnOnConsecutiveCalls (true , false );
115
133
$ this ->fileListMock ->expects ($ this ->once ())
116
134
->method ('getMagentoComposer ' )
117
135
->willReturn (__DIR__ . '/_files/wrong_composer_2.3.json ' );
@@ -133,14 +151,14 @@ public function testValidateWrongComposerJson(): void
133
151
}
134
152
135
153
/**
136
- * @throws UndefinedPackageException
154
+ * @inheritdoc
137
155
*/
138
156
public function testValidateMagentoLower23 (): void
139
157
{
140
- $ this ->magentoVersionMock ->expects ($ this ->once ( ))
158
+ $ this ->magentoVersionMock ->expects ($ this ->exactly ( 1 ))
141
159
->method ('isGreaterOrEqual ' )
142
- ->with ( '2.3 ' )
143
- ->willReturn (false );
160
+ ->withConsecutive ([ '2.3 ' ] )
161
+ ->willReturnOnConsecutiveCalls (false );
144
162
$ this ->fileListMock ->expects ($ this ->never ())
145
163
->method ('getMagentoComposer ' );
146
164
$ this ->resultFactoryMock ->expects ($ this ->once ())
@@ -150,14 +168,31 @@ public function testValidateMagentoLower23(): void
150
168
}
151
169
152
170
/**
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
154
189
*/
155
190
public function testValidateComposerFileNotExists (): void
156
191
{
157
- $ this ->magentoVersionMock ->expects ($ this ->once ( ))
192
+ $ this ->magentoVersionMock ->expects ($ this ->exactly ( 2 ))
158
193
->method ('isGreaterOrEqual ' )
159
- ->with ( '2.3 ' )
160
- ->willReturn (true );
194
+ ->withConsecutive ([ '2.3 ' ], [ ' 2.4.3 ' ] )
195
+ ->willReturnOnConsecutiveCalls (true , false );
161
196
$ this ->fileListMock ->expects ($ this ->once ())
162
197
->method ('getMagentoComposer ' )
163
198
->willReturn (__DIR__ . '/_files/file_not_exists.json ' );
0 commit comments