mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-10-22 18:18:07 +02:00
Issue #26 - Added the option to preview how a warning bar will look before and during an outage.
This commit is contained in:
1 parent
9cc954961a
commit
92681c7ec4
8 files changed
+176
-32
No files matched your search
+47
-3
@@ -44,8 +44,8 @@ class outage_test extends basic_testcase {
|
||||
|
||||
// In the past.
|
||||
$outage = new outage([
|
||||
'starttime' => $now + (-3 * 60 * 60),
|
||||
'stoptime' => $now + (-2 * 60 * 60),
|
||||
'starttime' => $now - (3 * 60 * 60),
|
||||
'stoptime' => $now - (2 * 60 * 60),
|
||||
'warntime' => $now - (2 * 60 * 60),
|
||||
'title' => '',
|
||||
'description' => ''
|
||||
@@ -54,7 +54,7 @@ class outage_test extends basic_testcase {
|
||||
|
||||
// In the present (ongoing).
|
||||
$outage = new outage([
|
||||
'starttime' => $now + (-1 * 60 * 60),
|
||||
'starttime' => $now - (1 * 60 * 60),
|
||||
'stoptime' => $now + (1 * 60 * 60),
|
||||
'warntime' => $now - (2 * 60 * 60),
|
||||
'title' => '',
|
||||
@@ -72,4 +72,48 @@ class outage_test extends basic_testcase {
|
||||
]);
|
||||
self::assertFalse($outage->is_ongoing($now));
|
||||
}
|
||||
|
||||
public function test_isactive() {
|
||||
$now = time();
|
||||
|
||||
// In the past.
|
||||
$outage = new outage([
|
||||
'starttime' => $now - (3 * 60 * 60),
|
||||
'stoptime' => $now - (2 * 60 * 60),
|
||||
'warntime' => $now - (2 * 60 * 60),
|
||||
'title' => '',
|
||||
'description' => ''
|
||||
]);
|
||||
self::assertFalse($outage->is_active($now));
|
||||
|
||||
// In the present (ongoing).
|
||||
$outage = new outage([
|
||||
'starttime' => $now - (1 * 60 * 60),
|
||||
'stoptime' => $now + (1 * 60 * 60),
|
||||
'warntime' => $now - (2 * 60 * 60),
|
||||
'title' => '',
|
||||
'description' => ''
|
||||
]);
|
||||
self::assertTrue($outage->is_active($now));
|
||||
|
||||
// In the future (warning).
|
||||
$outage = new outage([
|
||||
'starttime' => $now + (1 * 60 * 60),
|
||||
'stoptime' => $now + (2 * 60 * 60),
|
||||
'warntime' => $now - (2 * 60 * 60),
|
||||
'title' => '',
|
||||
'description' => ''
|
||||
]);
|
||||
self::assertTrue($outage->is_active($now));
|
||||
|
||||
// In the future (not warning).
|
||||
$outage = new outage([
|
||||
'starttime' => $now + (2 * 60 * 60),
|
||||
'stoptime' => $now + (3 * 60 * 60),
|
||||
'warntime' => $now + (1 * 60 * 60),
|
||||
'title' => '',
|
||||
'description' => ''
|
||||
]);
|
||||
self::assertFalse($outage->is_active($now));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user