2021-12-14 18:32:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2020-03-13 09:23:54 +00:00
|
|
|
|
2023-01-10 22:44:09 +00:00
|
|
|
namespace Shimmie2;
|
|
|
|
|
2020-03-13 09:23:54 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
2020-02-01 23:23:23 +00:00
|
|
|
require_once "core/basepage.php";
|
|
|
|
|
2020-03-13 09:23:54 +00:00
|
|
|
class BasePageTest extends TestCase
|
2020-02-01 23:23:23 +00:00
|
|
|
{
|
2024-01-15 14:31:51 +00:00
|
|
|
public function test_page(): void
|
2020-02-01 23:23:23 +00:00
|
|
|
{
|
|
|
|
$page = new BasePage();
|
|
|
|
$page->set_mode(PageMode::PAGE);
|
|
|
|
ob_start();
|
|
|
|
$page->display();
|
|
|
|
ob_end_clean();
|
|
|
|
$this->assertTrue(true); // doesn't crash
|
|
|
|
}
|
|
|
|
|
2024-01-15 14:31:51 +00:00
|
|
|
public function test_file(): void
|
2020-02-01 23:23:23 +00:00
|
|
|
{
|
|
|
|
$page = new BasePage();
|
|
|
|
$page->set_mode(PageMode::FILE);
|
|
|
|
$page->set_file("tests/pbx_screenshot.jpg");
|
|
|
|
ob_start();
|
|
|
|
$page->display();
|
|
|
|
ob_end_clean();
|
|
|
|
$this->assertTrue(true); // doesn't crash
|
|
|
|
}
|
|
|
|
|
2024-01-15 14:31:51 +00:00
|
|
|
public function test_data(): void
|
2020-02-01 23:23:23 +00:00
|
|
|
{
|
|
|
|
$page = new BasePage();
|
|
|
|
$page->set_mode(PageMode::DATA);
|
|
|
|
$page->set_data("hello world");
|
|
|
|
ob_start();
|
|
|
|
$page->display();
|
|
|
|
ob_end_clean();
|
|
|
|
$this->assertTrue(true); // doesn't crash
|
|
|
|
}
|
|
|
|
|
2024-01-15 14:31:51 +00:00
|
|
|
public function test_redirect(): void
|
2020-02-01 23:23:23 +00:00
|
|
|
{
|
|
|
|
$page = new BasePage();
|
|
|
|
$page->set_mode(PageMode::REDIRECT);
|
|
|
|
$page->set_redirect("/new/page");
|
|
|
|
ob_start();
|
|
|
|
$page->display();
|
|
|
|
ob_end_clean();
|
|
|
|
$this->assertTrue(true); // doesn't crash
|
|
|
|
}
|
2024-02-11 14:51:55 +00:00
|
|
|
|
|
|
|
public function test_subNav(): void
|
|
|
|
{
|
|
|
|
// the default theme doesn't send this, so let's have
|
|
|
|
// a random test manually
|
|
|
|
send_event(new PageSubNavBuildingEvent("system"));
|
|
|
|
$this->assertTrue(true); // doesn't crash
|
|
|
|
}
|
2020-02-01 23:23:23 +00:00
|
|
|
}
|