@@ -243,6 +243,19 @@ public function theAdministratorGetsTheGroupsOfUserInJsonUsingTheOccCommand($use
243
243
);
244
244
}
245
245
246
+ /**
247
+ * @When the administrator retrieves the time when user :username was last seen using the occ command
248
+ *
249
+ * @param string $username
250
+ *
251
+ * @return void
252
+ */
253
+ public function theAdministratorRetrievesTheTimeWhenUserWasLastSeenUsingTheOccCommand ($ username ) {
254
+ $ this ->featureContext ->invokingTheCommand (
255
+ "user:lastseen $ username "
256
+ );
257
+ }
258
+
246
259
/**
247
260
* @When the administrator sends a group creation request for group :group using the occ command
248
261
*
@@ -500,6 +513,37 @@ public function theDisplayNameReturnedByTheOccCommandShouldBe($displayName) {
500
513
PHPUnit_Framework_Assert::assertEquals ($ displayName , $ lastOutputDisplayName );
501
514
}
502
515
516
+ /**
517
+ * @Then the command output of user last seen should be recently
518
+ *
519
+ * @return void
520
+ * @throws \Exception
521
+ */
522
+ public function theCommandOutputOfUserLastSeenShouldBeRecently () {
523
+ $ currentTime = \gmdate ('d.m.Y H:i ' );
524
+ $ currentTimeStamp = \strtotime ($ currentTime );
525
+ $ lastOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
526
+ \preg_match ("/([\d.]+ [\d:]+)/ " , $ lastOutput , $ userCreatedTime );
527
+ $ useCreatedTimeStamp = \strtotime (($ userCreatedTime [0 ]));
528
+ $ delta = $ currentTimeStamp - $ useCreatedTimeStamp ;
529
+ if ($ delta > 60 ) {
530
+ throw new Exception (__METHOD__ . "User was expected to be seen recently but wasn't " );
531
+ }
532
+ }
533
+
534
+ /**
535
+ * @Then the command output of user last seen should be never
536
+ *
537
+ * @return void
538
+ */
539
+ public function theCommandOutputOfUserLastSeenShouldBeNever () {
540
+ $ lastOutput = $ this ->featureContext ->getStdOutOfOccCommand ();
541
+ PHPUnit_Framework_Assert::assertContains (
542
+ "has never logged in, yet. " ,
543
+ $ lastOutput
544
+ );
545
+ }
546
+
503
547
/**
504
548
* @When the administrator sets the log level to :level using the occ command
505
549
*
0 commit comments