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