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/index/test.php

63 lines
1.8 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
class IndexTest extends ShimmiePHPUnitTestCase
{
2024-01-15 14:31:51 +00:00
public function testIndexPage(): void
{
$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");
$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);
}
}