@@ -159,6 +159,152 @@ public function adminGetsPathForApp($appId) {
159159 );
160160 }
161161
162+ /**
163+ * @When the administrator lists the apps using the occ command
164+ *
165+ * @return void
166+ */
167+ public function adminListsTheApps () {
168+ $ occStatus = $ this ->featureContext ->runOcc (
169+ ['app:list ' , '--no-ansi ' ]
170+ );
171+ }
172+
173+ /**
174+ * @When the administrator lists the enabled apps using the occ command
175+ *
176+ * @return void
177+ */
178+ public function adminListsTheEnabledApps () {
179+ $ occStatus = $ this ->featureContext ->runOcc (
180+ ['app:list ' , '--enabled ' , '--no-ansi ' ]
181+ );
182+ }
183+
184+ /**
185+ * @When the administrator lists the disabled apps using the occ command
186+ *
187+ * @return void
188+ */
189+ public function adminListsTheDisabledApps () {
190+ $ occStatus = $ this ->featureContext ->runOcc (
191+ ['app:list ' , '--disabled ' , '--no-ansi ' ]
192+ );
193+ }
194+
195+ /**
196+ * @When the administrator lists the enabled and disabled apps using the occ command
197+ *
198+ * @return void
199+ */
200+ public function adminListsTheEnabledAndDisabledApps () {
201+ $ occStatus = $ this ->featureContext ->runOcc (
202+ ['app:list ' , '--enabled ' , '--disabled ' , '--no-ansi ' ]
203+ );
204+ }
205+
206+ /**
207+ * @Then app :appId with version :appVersion should have been listed in the enabled apps section
208+ *
209+ * @param string $appId
210+ * @param string $appVersion
211+ *
212+ * @return void
213+ */
214+ public function appWithVersionShouldHaveBeenListedInTheEnabledAppsSection (
215+ $ appId , $ appVersion
216+ ) {
217+ $ commandOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
218+ $ expectedStartOfOutput = "Enabled: " ;
219+ Assert::assertEquals (
220+ $ expectedStartOfOutput ,
221+ \substr ($ commandOutput , 0 , 8 ),
222+ "app:list command output did not start with ' $ expectedStartOfOutput' "
223+ );
224+ $ startOfDisabledSection = \strpos ($ commandOutput , "Disabled: " );
225+ if ($ startOfDisabledSection ) {
226+ $ commandOutput = \substr ($ commandOutput , 0 , $ startOfDisabledSection );
227+ }
228+ $ expectedString = "- $ appId: $ appVersion " ;
229+ Assert::assertNotFalse (
230+ \strpos ($ commandOutput , $ expectedString ),
231+ "app:list output did not contain ' $ expectedString' in the enabled section "
232+ );
233+ }
234+
235+ /**
236+ * @Then app :appId with version :appVersion should have been listed in the disabled apps section
237+ *
238+ * @param string $appId
239+ * @param string $appVersion
240+ *
241+ * @return void
242+ */
243+ public function appWithVersionShouldHaveBeenListedInTheDisabledAppsSection (
244+ $ appId , $ appVersion
245+ ) {
246+ $ commandOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
247+ $ startOfDisabledSection = \strpos ($ commandOutput , "Disabled: " );
248+ Assert::assertNotFalse (
249+ $ startOfDisabledSection ,
250+ "app:list output did not contain the disabled section "
251+ );
252+ $ commandOutput = \substr ($ commandOutput , $ startOfDisabledSection );
253+ $ expectedString = "- $ appId: $ appVersion " ;
254+ Assert::assertNotFalse (
255+ \strpos ($ commandOutput , $ expectedString ),
256+ "app:list output did not contain ' $ expectedString' in the disabled section "
257+ );
258+ }
259+
260+ /**
261+ * @Then app :appId should have been listed in the disabled apps section
262+ *
263+ * @param string $appId
264+ *
265+ * @return void
266+ */
267+ public function appShouldHaveBeenListedInTheDisabledAppsSection ($ appId ) {
268+ $ commandOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
269+ $ startOfDisabledSection = \strpos ($ commandOutput , "Disabled: " );
270+ Assert::assertNotFalse (
271+ $ startOfDisabledSection ,
272+ "app:list output did not contain the disabled section "
273+ );
274+ $ commandOutput = \substr ($ commandOutput , $ startOfDisabledSection );
275+ $ expectedString = "- $ appId " ;
276+ Assert::assertNotFalse (
277+ \strpos ($ commandOutput , $ expectedString ),
278+ "app:list output did not contain ' $ expectedString' in the disabled section "
279+ );
280+ }
281+
282+ /**
283+ * @Then the enabled apps section should not exist
284+ *
285+ * @return void
286+ */
287+ public function theEnabledAppsSectionShouldNotExist () {
288+ $ commandOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
289+ Assert::assertFalse (
290+ \strpos ($ commandOutput , "Enabled: " ),
291+ "app:list output contains the enabled section but it should not "
292+ );
293+ }
294+
295+ /**
296+ * @Then the disabled apps section should not exist
297+ *
298+ * @return void
299+ */
300+ public function theDisabledAppsSectionShouldNotExist () {
301+ $ commandOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
302+ Assert::assertFalse (
303+ \strpos ($ commandOutput , "Disabled: " ),
304+ "app:list output contains the disabled section but it should not "
305+ );
306+ }
307+
162308 /**
163309 * @Then the path to :appId should be :dir
164310 *
0 commit comments