Issue #30 - Fixed stage values and broken tests.

This commit is contained in:
Daniel Thee Roperto
2016-09-19 13:13:03 +10:00
parent 2cfda63922
commit f0ae7b8410
4 changed files with 41 additions and 10 deletions

View File

@@ -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).

View File

@@ -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));

31
tests/phpunit.xml Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/phpunit/phpunit.xsd"
bootstrap="../../../lib/phpunit/bootstrap.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
backupGlobals="false"
backupStaticAttributes="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
printerClass="Hint_ResultPrinter"
testSuiteLoaderClass="phpunit_autoloader"
>
<testsuites>
<testsuite name="auth_outage_testsuite">
<directory suffix="_test.php">./</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">../classes</directory>
</whitelist>
</filter>
</phpunit>

View File

@@ -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;
}