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

42 lines
1 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
class AdminPageTest extends ShimmiePHPUnitTestCase
{
2024-01-15 14:31:51 +00:00
public function testAuth(): void
{
2024-02-11 14:51:55 +00:00
$this->log_out();
2024-02-11 15:47:40 +00:00
$this->assertException(PermissionDenied::class, function () {
$this->get_page('admin');
});
2024-02-11 14:51:55 +00:00
$this->log_in_as_user();
2024-02-11 15:47:40 +00:00
$this->assertException(PermissionDenied::class, function () {
$this->get_page('admin');
});
2024-02-11 14:51:55 +00:00
$this->log_in_as_admin();
$page = $this->get_page('admin');
$this->assertEquals(200, $page->code);
$this->assertEquals("Admin Tools", $page->title);
}
2024-02-11 14:51:55 +00:00
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"?
}
}