This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/downtime/test.php

49 lines
1.2 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
class DowntimeTest extends ShimmiePHPUnitTestCase
{
2019-11-14 18:24:09 +00:00
public function tearDown(): void
{
global $config;
$config->set_bool("downtime", false);
2024-01-10 08:51:56 +00:00
parent::tearDown();
}
2024-01-15 14:31:51 +00:00
public function testDowntime(): void
{
global $config;
$config->set_string("downtime_message", "brb, unit testing");
// downtime on
$config->set_bool("downtime", true);
$this->log_in_as_admin();
$this->get_page("post/list");
$this->assert_text("DOWNTIME MODE IS ON!");
$this->assert_response(200);
$this->log_in_as_user();
$this->get_page("post/list");
$this->assert_content("brb, unit testing");
$this->assert_response(503);
// downtime off
$config->set_bool("downtime", false);
$this->log_in_as_admin();
$this->get_page("post/list");
$this->assert_no_text("DOWNTIME MODE IS ON!");
$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
}