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

41 lines
1.1 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
class FeaturedTest extends ShimmiePHPUnitTestCase
{
2024-01-15 14:31:51 +00:00
public function testFeatured(): void
{
global $config;
// Set up
$this->log_in_as_user();
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
# FIXME: test that regular users can't feature things
2009-07-20 06:31:41 +00:00
// Admin can feature things
2024-04-07 09:25:58 +00:00
$this->log_in_as_admin();
$page = $this->post_page("featured_image/set/$image_id");
$this->assertEquals(302, $page->code);
$this->get_page("post/list");
2020-10-26 13:46:00 +00:00
$this->assert_text("Featured Post");
2012-03-10 17:39:38 +00:00
# FIXME: test changing from one feature to another
2012-03-10 17:39:38 +00:00
$page = $this->get_page("featured_image/download");
$this->assertEquals(200, $page->code);
2012-03-10 17:39:38 +00:00
$page = $this->get_page("featured_image/view");
$this->assertEquals(200, $page->code);
2012-03-10 17:39:38 +00:00
// after deletion, there should be no feature
$this->delete_image($image_id);
$this->get_page("post/list");
2020-10-26 13:46:00 +00:00
$this->assert_no_text("Featured Post");
}
}