From f0ae7b841000ddc30d1aad3b9c27a55f2e87e645 Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Mon, 19 Sep 2016 13:13:03 +1000 Subject: [PATCH] Issue #30 - Fixed stage values and broken tests. --- classes/models/outage.php | 10 +++++----- tests/outage_test.php | 4 ++-- tests/phpunit.xml | 31 +++++++++++++++++++++++++++++++ views/warningbar.css | 6 +++--- 4 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 tests/phpunit.xml diff --git a/classes/models/outage.php b/classes/models/outage.php index 9ebd2ba..6f51efa 100644 --- a/classes/models/outage.php +++ b/classes/models/outage.php @@ -30,27 +30,27 @@ class outage { /** * Outage is before warning period. */ - const STAGE_WAITING = 1; + const STAGE_WAITING = 'waiting'; /** * Outage not started but in warning period. */ - const STAGE_WARNING = 2; + const STAGE_WARNING = 'warning'; /** * Outage ongoing, it has passed the warning period. */ - const STAGE_ONGOING = 3; + const STAGE_ONGOING = 'ongoing'; /** * Outage finished, it is after the marked finished time. */ - const STAGE_FINISHED = 4; + const STAGE_FINISHED = 'finished'; /** * Outage stopped, it is after the stop time and not marked as finished. */ - const STAGE_STOPPED = 4; + const STAGE_STOPPED = 'stopped'; /** * @var int Outage ID (auto generated by the DB). diff --git a/tests/outage_test.php b/tests/outage_test.php index bc0de2c..d0c88d5 100644 --- a/tests/outage_test.php +++ b/tests/outage_test.php @@ -161,7 +161,7 @@ class outage_test extends basic_testcase { $outage = new outage([ 'warntime' => $now - 50, 'starttime' => $now - 40, - 'finishtime' => $now - 30, + 'finished' => $now - 30, 'stoptime' => $now - 20, 'title' => 'Outage Finished before Stop', ]); @@ -173,7 +173,7 @@ class outage_test extends basic_testcase { 'warntime' => $now - 50, 'starttime' => $now - 40, 'stoptime' => $now - 30, - 'finishtime' => $now - 20, + 'finished' => $now - 20, 'title' => 'Outage Finished after Stop', ]); self::assertSame(outage::STAGE_FINISHED, $outage->get_stage($now)); diff --git a/tests/phpunit.xml b/tests/phpunit.xml new file mode 100644 index 0000000..7466503 --- /dev/null +++ b/tests/phpunit.xml @@ -0,0 +1,31 @@ + + + + + + ./ + + + + + + ../classes + + + diff --git a/views/warningbar.css b/views/warningbar.css index acb7c53..23fa95e 100644 --- a/views/warningbar.css +++ b/views/warningbar.css @@ -34,11 +34,11 @@ If you need to make changes here, remember to update your settings inside Moodle margin: 10px 0; } -A.auth_outage_warningbar_box_title { +a.auth_outage_warningbar_box_title { color: white; } -A.auth_outage_warningbar_box_finish { +a.auth_outage_warningbar_box_finish { background-color: white; border: 1px solid black; border-radius: 5px; @@ -51,7 +51,7 @@ A.auth_outage_warningbar_box_finish { transition: background-color 200ms linear; } -A.auth_outage_warningbar_box_finish:hover { +a.auth_outage_warningbar_box_finish:hover { background-color: black; }