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/admin/test.php
2024-02-11 16:03:23 +00:00

41 lines
1 KiB
PHP

<?php
declare(strict_types=1);
namespace Shimmie2;
class AdminPageTest extends ShimmiePHPUnitTestCase
{
public function testAuth(): void
{
$this->log_out();
$this->assertException(PermissionDenied::class, function () {
$this->get_page('admin');
});
$this->log_in_as_user();
$this->assertException(PermissionDenied::class, function () {
$this->get_page('admin');
});
$this->log_in_as_admin();
$page = $this->get_page('admin');
$this->assertEquals(200, $page->code);
$this->assertEquals("Admin Tools", $page->title);
}
public function testAct(): void
{
$this->log_in_as_admin();
$page = $this->post_page('admin/test');
$this->assertEquals("test", $page->data);
}
// does this belong here??
public function testCliGen(): void
{
$app = new CliApp();
send_event(new CliGenEvent($app));
$this->assertTrue(true); // TODO: check for more than "no crash"?
}
}