2009-07-20 06:51:36 +01:00
|
|
|
<?php
|
2015-08-23 16:09:52 +01:00
|
|
|
class DowntimeTest extends ShimmiePHPUnitTestCase {
|
2015-09-26 11:17:13 +01:00
|
|
|
public function tearDown() {
|
2015-08-23 16:09:52 +01:00
|
|
|
global $config;
|
|
|
|
$config->set_bool("downtime", false);
|
|
|
|
}
|
|
|
|
|
2015-09-26 11:17:13 +01:00
|
|
|
public function testDowntime() {
|
2015-08-23 16:09:52 +01:00
|
|
|
global $config;
|
|
|
|
|
|
|
|
$config->set_string("downtime_message", "brb, unit testing");
|
|
|
|
|
|
|
|
// downtime on
|
|
|
|
$config->set_bool("downtime", true);
|
|
|
|
|
2009-07-20 06:51:36 +01:00
|
|
|
$this->log_in_as_admin();
|
2015-08-23 16:09:52 +01:00
|
|
|
$this->get_page("post/list");
|
2009-08-19 01:28:48 +01:00
|
|
|
$this->assert_text("DOWNTIME MODE IS ON!");
|
2015-08-23 16:09:52 +01:00
|
|
|
$this->assert_response(200);
|
2009-07-20 06:51:36 +01:00
|
|
|
|
2015-08-23 16:09:52 +01:00
|
|
|
$this->log_in_as_user();
|
2009-09-19 23:03:47 +01:00
|
|
|
$this->get_page("post/list");
|
2015-08-23 16:09:52 +01:00
|
|
|
$this->assert_content("brb, unit testing");
|
|
|
|
$this->assert_response(503);
|
|
|
|
|
|
|
|
// downtime off
|
|
|
|
$config->set_bool("downtime", false);
|
2009-07-20 06:51:36 +01:00
|
|
|
|
|
|
|
$this->log_in_as_admin();
|
2015-08-23 16:09:52 +01:00
|
|
|
$this->get_page("post/list");
|
2009-08-19 01:28:48 +01:00
|
|
|
$this->assert_no_text("DOWNTIME MODE IS ON!");
|
2015-08-23 16:09:52 +01:00
|
|
|
$this->assert_response(200);
|
|
|
|
|
|
|
|
$this->log_in_as_user();
|
|
|
|
$this->get_page("post/list");
|
|
|
|
$this->assert_no_content("brb, unit testing");
|
|
|
|
$this->assert_response(200);
|
2009-07-20 06:51:36 +01:00
|
|
|
}
|
|
|
|
}
|