Issue #52 - Fixed static page.

This commit is contained in:
Daniel Thee Roperto
2016-09-26 10:27:49 +10:00
parent 7b6e25915e
commit 76d656072b
11 changed files with 9 additions and 33 deletions

View File

@@ -1,31 +0,0 @@
<?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

@@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die();
* @author Daniel Thee Roperto <daniel.roperto@catalyst-au.net>
* @copyright 2016 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \auth_outage\infopage_controller
* @covers \auth_outage\local\controllers\infopage
*/
class infopagecontroller_test extends advanced_testcase {
public function setUp() {
@@ -63,10 +63,17 @@ class infopagecontroller_test extends advanced_testcase {
]);
$info = new infopage(['static' => true, 'outage' => $outage]);
$html = $info->get_output();
// Must find...
self::assertContains('<!DOCTYPE html>', $html);
self::assertContains('<meta http-equiv="refresh" ', $html);
self::assertContains('</html>', $html);
self::assertContains($outage->get_title(), $html);
self::assertContains($outage->get_description(), $html);
// Must not find...
self::assertNotContains('<link ', $html);
self::assertNotContains('<a ', $html);
self::assertNotContains('<script ', $html);
// Ensure it has the id encoded in it...
self::assertSame($outage->id, infopage::find_outageid_from_infopage($html));
}

View File

@@ -48,7 +48,7 @@ global $SITE;
<?php
// Static page is rendered as if outage started. It is never rendered as admin or preview mode.
echo renderer::get()->render_warningbar($viewbag['outage'], $viewbag['outage']->starttime, false, false);
echo renderer::get()->render_warningbar($viewbag['outage'], $viewbag['outage']->starttime, true, false);
?>
<header>