2021-12-14 18:32:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2023-01-10 22:44:09 +00:00
|
|
|
|
|
|
|
namespace Shimmie2;
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class IndexTest extends ShimmiePHPUnitTestCase
|
|
|
|
{
|
2024-01-15 14:31:51 +00:00
|
|
|
public function testIndexPage(): void
|
2019-05-28 16:59:38 +00:00
|
|
|
{
|
|
|
|
$this->get_page('post/list');
|
|
|
|
$this->assert_title("Welcome to Shimmie");
|
|
|
|
$this->assert_no_text("Prev | Index | Next");
|
|
|
|
|
|
|
|
$this->log_in_as_user();
|
|
|
|
$this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
2020-01-29 20:22:50 +00:00
|
|
|
$this->post_image("tests/bedroom_workshop.jpg", "thing computer computing bedroom workshop");
|
2019-05-28 16:59:38 +00:00
|
|
|
$this->log_out();
|
|
|
|
|
|
|
|
$this->get_page('post/list');
|
|
|
|
$this->assert_title("Shimmie");
|
|
|
|
// FIXME
|
|
|
|
//$this->assert_text("Prev | Index | Next");
|
|
|
|
|
|
|
|
$this->get_page('post/list/-1');
|
|
|
|
$this->assert_title("Shimmie");
|
|
|
|
|
|
|
|
$this->get_page('post/list/0');
|
|
|
|
$this->assert_title("Shimmie");
|
|
|
|
|
|
|
|
$this->get_page('post/list/1');
|
|
|
|
$this->assert_title("Shimmie");
|
|
|
|
|
|
|
|
$this->get_page('post/list/99999');
|
|
|
|
$this->assert_response(404);
|
2020-01-29 20:22:50 +00:00
|
|
|
|
|
|
|
# No results: 404
|
|
|
|
$this->get_page('post/list/maumaumau/1');
|
|
|
|
$this->assert_response(404);
|
|
|
|
|
|
|
|
# One result: 302
|
|
|
|
$this->get_page("post/list/pbx/1");
|
|
|
|
$this->assert_response(302);
|
|
|
|
|
|
|
|
# Multiple results: 200
|
|
|
|
$this->get_page('post/list/computer/1');
|
|
|
|
$this->assert_response(200);
|
|
|
|
}
|
|
|
|
|
2020-03-26 21:28:36 +00:00
|
|
|
// This isn't really an index thing, we just want to test this from
|
|
|
|
// SOMEWHERE because the default theme doesn't use them.
|
2024-01-15 14:31:51 +00:00
|
|
|
public function test_nav(): void
|
2020-03-26 21:28:36 +00:00
|
|
|
{
|
|
|
|
send_event(new UserLoginEvent(User::by_name(self::$user_name)));
|
|
|
|
send_event(new PageNavBuildingEvent());
|
2020-03-28 14:39:03 +00:00
|
|
|
// just a few common parents
|
2020-04-25 20:36:28 +00:00
|
|
|
foreach (["help", "posts", "system", "user"] as $parent) {
|
2020-03-28 14:39:03 +00:00
|
|
|
send_event(new PageSubNavBuildingEvent($parent));
|
|
|
|
}
|
2020-03-26 21:28:36 +00:00
|
|
|
$this->assertTrue(true);
|
|
|
|
}
|
2008-10-11 07:09:42 +00:00
|
|
|
}
|