@@ -303,6 +303,20 @@ public function theAdministratorRetrievesAllTheUsersInJsonUsingTheOccCommand() {
303
303
);
304
304
}
305
305
306
+ /**
307
+ * @When the administrator gets the list of all users inactive for the last :numberOfDays days using the occ command
308
+ *
309
+ * @param integer $numberOfDays
310
+ *
311
+ * @return void
312
+ * @throws Exception
313
+ */
314
+ public function theAdministratorGetsTheListOfAllUsersInactiveForTheLastDays ($ numberOfDays ) {
315
+ $ this ->occContext ->invokingTheCommand (
316
+ "user:inactive $ numberOfDays --output=json "
317
+ );
318
+ }
319
+
306
320
/**
307
321
* @When the administrator retrieves the information of user :username in JSON format using the occ command
308
322
*
@@ -529,6 +543,42 @@ public function theUsersReturnedByTheOccCommandShouldBe(TableNode $useridTable)
529
543
}
530
544
}
531
545
546
+ /**
547
+ * @Then the inactive users returned by the occ command should be
548
+ *
549
+ * @param TableNode $userTable
550
+ *
551
+ * @return void
552
+ * @throws Exception
553
+ */
554
+ public function theInactiveUsersReturnedByTheOccCommandShouldBe (TableNode $ userTable ) {
555
+ $ this ->featureContext ->verifyTableNodeColumns ($ userTable , ['uid ' , 'display name ' , 'inactive days ' ]);
556
+ $ lastOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
557
+ $ lastOutputUsers = \json_decode ($ lastOutput , true );
558
+
559
+ Assert::assertEquals (\count ($ userTable ->getColumnsHash ()), \count ($ lastOutputUsers ));
560
+
561
+ $ found = false ;
562
+ foreach ($ userTable as $ row ) {
563
+ foreach ($ lastOutputUsers as $ user ) {
564
+ if ($ user ['uid ' ] === $ row ['uid ' ]) {
565
+ $ found = true ;
566
+ Assert::assertEquals (
567
+ $ user ['displayName ' ],
568
+ $ row ['display name ' ],
569
+ "expected {$ row ['display name ' ]} but got {$ user ['displayName ' ]}"
570
+ );
571
+ Assert::assertEquals (
572
+ $ user ['inactiveSinceDays ' ],
573
+ $ row ['inactive days ' ],
574
+ "expected {$ row ['inactive days ' ]} days but got {$ user ['inactiveSinceDays ' ]} days "
575
+ );
576
+ }
577
+ }
578
+ Assert::assertTrue ($ found );
579
+ }
580
+ }
581
+
532
582
/**
533
583
* @Then the groups returned by the occ command should be
534
584
*
0 commit comments