From c4607819710fb16f81af64e5aad23a354798be78 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 25 Jul 2022 15:28:43 +1200 Subject: [PATCH] FIX Use usleep for fractions of a second --- src/Context/LoginContext.php | 4 ++-- src/Context/SilverStripeContext.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Context/LoginContext.php b/src/Context/LoginContext.php index dbed6446..085d6523 100644 --- a/src/Context/LoginContext.php +++ b/src/Context/LoginContext.php @@ -104,8 +104,8 @@ public function stepILogInWith($email, $password) if ($btn->getText() !== 'Setup later') { continue; } - // There's been issues clicking the button, so try waiting for a little bit - sleep(0.3); + // There's been issues clicking the button, so try waiting for 0.3 seconds + usleep(0.3 * 1000000); $btn->click(); $clicked = true; break; diff --git a/src/Context/SilverStripeContext.php b/src/Context/SilverStripeContext.php index 54f87987..197be81b 100644 --- a/src/Context/SilverStripeContext.php +++ b/src/Context/SilverStripeContext.php @@ -510,7 +510,7 @@ public function givenTheCurrentDateIs($date) } $state = $this->testSessionEnvironment->getState(); - $oldDatetime = \DateTime::createFromFormat('Y-m-d H:i:s', isset($state->datetime) ? $state->datetime : null); + $oldDatetime = \DateTime::createFromFormat('Y-m-d H:i:s', $state->datetime ?? ''); if ($oldDatetime) { $newDatetime->setTime($oldDatetime->format('H'), $oldDatetime->format('i'), $oldDatetime->format('s')); }