[tests] more voiding of tests
This commit is contained in:
parent
a1f22ef67c
commit
434455b836
77 changed files with 215 additions and 215 deletions
|
@ -10,7 +10,7 @@ require_once "core/basepage.php";
|
|||
|
||||
class BasePageTest extends TestCase
|
||||
{
|
||||
public function test_page()
|
||||
public function test_page(): void
|
||||
{
|
||||
$page = new BasePage();
|
||||
$page->set_mode(PageMode::PAGE);
|
||||
|
@ -20,7 +20,7 @@ class BasePageTest extends TestCase
|
|||
$this->assertTrue(true); // doesn't crash
|
||||
}
|
||||
|
||||
public function test_file()
|
||||
public function test_file(): void
|
||||
{
|
||||
$page = new BasePage();
|
||||
$page->set_mode(PageMode::FILE);
|
||||
|
@ -31,7 +31,7 @@ class BasePageTest extends TestCase
|
|||
$this->assertTrue(true); // doesn't crash
|
||||
}
|
||||
|
||||
public function test_data()
|
||||
public function test_data(): void
|
||||
{
|
||||
$page = new BasePage();
|
||||
$page->set_mode(PageMode::DATA);
|
||||
|
@ -42,7 +42,7 @@ class BasePageTest extends TestCase
|
|||
$this->assertTrue(true); // doesn't crash
|
||||
}
|
||||
|
||||
public function test_redirect()
|
||||
public function test_redirect(): void
|
||||
{
|
||||
$page = new BasePage();
|
||||
$page->set_mode(PageMode::REDIRECT);
|
||||
|
|
|
@ -10,7 +10,7 @@ require_once "core/block.php";
|
|||
|
||||
class BlockTest extends TestCase
|
||||
{
|
||||
public function test_basic()
|
||||
public function test_basic(): void
|
||||
{
|
||||
$b = new Block("head", "body");
|
||||
$this->assertEquals(
|
||||
|
|
|
@ -8,13 +8,13 @@ use PHPUnit\Framework\TestCase;
|
|||
|
||||
class InitTest extends TestCase
|
||||
{
|
||||
public function testInitExt()
|
||||
public function testInitExt(): void
|
||||
{
|
||||
send_event(new InitExtEvent());
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testDatabaseUpgrade()
|
||||
public function testDatabaseUpgrade(): void
|
||||
{
|
||||
send_event(new DatabaseUpgradeEvent());
|
||||
$this->assertTrue(true);
|
||||
|
|
|
@ -10,7 +10,7 @@ require_once "core/polyfills.php";
|
|||
|
||||
class PolyfillsTest extends TestCase
|
||||
{
|
||||
public function test_html_escape()
|
||||
public function test_html_escape(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"Foo & <main>",
|
||||
|
@ -26,7 +26,7 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertEquals(html_escape(html_unescape($x)), $x);
|
||||
}
|
||||
|
||||
public function test_int_escape()
|
||||
public function test_int_escape(): void
|
||||
{
|
||||
$this->assertEquals(0, int_escape(""));
|
||||
$this->assertEquals(1, int_escape("1"));
|
||||
|
@ -35,13 +35,13 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertEquals(0, int_escape(null));
|
||||
}
|
||||
|
||||
public function test_url_escape()
|
||||
public function test_url_escape(): void
|
||||
{
|
||||
$this->assertEquals("%5E%5Co%2F%5E", url_escape("^\o/^"));
|
||||
$this->assertEquals("", url_escape(null));
|
||||
}
|
||||
|
||||
public function test_bool_escape()
|
||||
public function test_bool_escape(): void
|
||||
{
|
||||
$this->assertTrue(bool_escape(true));
|
||||
$this->assertFalse(bool_escape(false));
|
||||
|
@ -71,7 +71,7 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertFalse(bool_escape("0"));
|
||||
}
|
||||
|
||||
public function test_clamp()
|
||||
public function test_clamp(): void
|
||||
{
|
||||
$this->assertEquals(5, clamp(0, 5, 10)); // too small
|
||||
$this->assertEquals(5, clamp(5, 5, 10)); // lower limit
|
||||
|
@ -83,7 +83,7 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertEquals(42, clamp(42, null, null)); // no limit
|
||||
}
|
||||
|
||||
public function test_truncate()
|
||||
public function test_truncate(): void
|
||||
{
|
||||
$this->assertEquals("test words", truncate("test words", 10));
|
||||
$this->assertEquals("test...", truncate("test...", 9));
|
||||
|
@ -91,7 +91,7 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertEquals("te...", truncate("te...", 2));
|
||||
}
|
||||
|
||||
public function test_to_shorthand_int()
|
||||
public function test_to_shorthand_int(): void
|
||||
{
|
||||
// 0-9 should have 1 decimal place, 10+ should have none
|
||||
$this->assertEquals("1.1GB", to_shorthand_int(1231231231));
|
||||
|
@ -100,7 +100,7 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertEquals("2", to_shorthand_int(2));
|
||||
}
|
||||
|
||||
public function test_parse_shorthand_int()
|
||||
public function test_parse_shorthand_int(): void
|
||||
{
|
||||
$this->assertEquals(-1, parse_shorthand_int("foo"));
|
||||
$this->assertEquals(33554432, parse_shorthand_int("32M"));
|
||||
|
@ -108,21 +108,21 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertEquals(1231231231, parse_shorthand_int("1231231231"));
|
||||
}
|
||||
|
||||
public function test_format_milliseconds()
|
||||
public function test_format_milliseconds(): void
|
||||
{
|
||||
$this->assertEquals("", format_milliseconds(5));
|
||||
$this->assertEquals("5s", format_milliseconds(5000));
|
||||
$this->assertEquals("1y 213d 16h 53m 20s", format_milliseconds(50000000000));
|
||||
}
|
||||
|
||||
public function test_parse_to_milliseconds()
|
||||
public function test_parse_to_milliseconds(): void
|
||||
{
|
||||
$this->assertEquals(10, parse_to_milliseconds("10"));
|
||||
$this->assertEquals(5000, parse_to_milliseconds("5s"));
|
||||
$this->assertEquals(50000000000, parse_to_milliseconds("1y 213d 16h 53m 20s"));
|
||||
}
|
||||
|
||||
public function test_autodate()
|
||||
public function test_autodate(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<time datetime='2012-06-23T16:14:22+00:00'>June 23, 2012; 16:14</time>",
|
||||
|
@ -130,7 +130,7 @@ class PolyfillsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_validate_input()
|
||||
public function test_validate_input(): void
|
||||
{
|
||||
$_POST = [
|
||||
"foo" => " bar ",
|
||||
|
@ -151,7 +151,7 @@ class PolyfillsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_sanitize_path()
|
||||
public function test_sanitize_path(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"one",
|
||||
|
@ -194,7 +194,7 @@ class PolyfillsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_join_path()
|
||||
public function test_join_path(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"one",
|
||||
|
@ -222,7 +222,7 @@ class PolyfillsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_stringer()
|
||||
public function test_stringer(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
'["foo"=>"bar", "baz"=>[1, 2, 3], "qux"=>["a"=>"b"]]',
|
||||
|
@ -230,7 +230,7 @@ class PolyfillsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_ip_in_range()
|
||||
public function test_ip_in_range(): void
|
||||
{
|
||||
$this->assertTrue(ip_in_range("1.2.3.4", "1.2.0.0/16"));
|
||||
$this->assertFalse(ip_in_range("4.3.2.1", "1.2.0.0/16"));
|
||||
|
@ -239,7 +239,7 @@ class PolyfillsTest extends TestCase
|
|||
$this->assertTrue(ip_in_range("1.2.3.4", "1.2.3.4"));
|
||||
}
|
||||
|
||||
public function test_deltree()
|
||||
public function test_deltree(): void
|
||||
{
|
||||
$tmp = sys_get_temp_dir();
|
||||
$dir = "$tmp/test_deltree";
|
||||
|
|
|
@ -11,7 +11,7 @@ require_once "core/imageboard/search.php";
|
|||
|
||||
class SearchTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testWeirdTags()
|
||||
public function testWeirdTags(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "question? colon:thing exclamation!");
|
||||
|
@ -67,7 +67,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testTTC_Empty()
|
||||
public function testTTC_Empty(): void
|
||||
{
|
||||
$this->assert_TTC(
|
||||
"",
|
||||
|
@ -84,7 +84,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testTTC_Hash()
|
||||
public function testTTC_Hash(): void
|
||||
{
|
||||
$this->assert_TTC(
|
||||
"hash=1234567890",
|
||||
|
@ -102,7 +102,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testTTC_Ratio()
|
||||
public function testTTC_Ratio(): void
|
||||
{
|
||||
$this->assert_TTC(
|
||||
"ratio=42:12345",
|
||||
|
@ -121,7 +121,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testTTC_Order()
|
||||
public function testTTC_Order(): void
|
||||
{
|
||||
$this->assert_TTC(
|
||||
"order=score",
|
||||
|
@ -192,7 +192,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* No-tag search *
|
||||
* * * * * * * * * * */
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_NoTags($image_ids)
|
||||
public function testBSQ_NoTags($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -206,7 +206,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* Fast-path search *
|
||||
* * * * * * * * * * */
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_FastPath_NoResults($image_ids)
|
||||
public function testBSQ_FastPath_NoResults($image_ids): void
|
||||
{
|
||||
$this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -217,7 +217,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_FastPath_OneResult($image_ids)
|
||||
public function testBSQ_FastPath_OneResult($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -228,7 +228,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_FastPath_ManyResults($image_ids)
|
||||
public function testBSQ_FastPath_ManyResults($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -239,7 +239,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_FastPath_WildNoResults($image_ids)
|
||||
public function testBSQ_FastPath_WildNoResults($image_ids): void
|
||||
{
|
||||
$this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -258,7 +258,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* https://github.com/shish/shimmie2/issues/547
|
||||
*/
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_FastPath_WildOneResult($image_ids)
|
||||
public function testBSQ_FastPath_WildOneResult($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -273,7 +273,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* when a wildcard matches one image multiple times.
|
||||
*/
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_FastPath_WildManyResults($image_ids)
|
||||
public function testBSQ_FastPath_WildManyResults($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
// two images match comp* - one matches it once, one matches it twice
|
||||
|
@ -288,7 +288,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* General search *
|
||||
* * * * * * * * * * */
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_NoResults($image_ids)
|
||||
public function testBSQ_GeneralPath_NoResults($image_ids): void
|
||||
{
|
||||
$this->testUpload();
|
||||
# multiple tags, one of which doesn't exist
|
||||
|
@ -301,7 +301,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_OneResult($image_ids)
|
||||
public function testBSQ_GeneralPath_OneResult($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -320,7 +320,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* https://github.com/shish/shimmie2/issues/547
|
||||
*/
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_WildOneResult($image_ids)
|
||||
public function testBSQ_GeneralPath_WildOneResult($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -331,7 +331,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_ManyResults($image_ids)
|
||||
public function testBSQ_GeneralPath_ManyResults($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -342,7 +342,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_WildManyResults($image_ids)
|
||||
public function testBSQ_GeneralPath_WildManyResults($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -353,7 +353,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_SubtractValidFromResults($image_ids)
|
||||
public function testBSQ_GeneralPath_SubtractValidFromResults($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -364,7 +364,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_SubtractNotValidFromResults($image_ids)
|
||||
public function testBSQ_GeneralPath_SubtractNotValidFromResults($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -375,7 +375,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_SubtractValidFromDefault($image_ids)
|
||||
public function testBSQ_GeneralPath_SubtractValidFromDefault($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
// negative tag alone, should remove the image with that tag
|
||||
|
@ -387,7 +387,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_SubtractNotValidFromDefault($image_ids)
|
||||
public function testBSQ_GeneralPath_SubtractNotValidFromDefault($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
// negative that doesn't exist, should return all results
|
||||
|
@ -399,7 +399,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_GeneralPath_SubtractMultipleNotValidFromDefault($image_ids)
|
||||
public function testBSQ_GeneralPath_SubtractMultipleNotValidFromDefault($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
// multiple negative tags that don't exist, should return all results
|
||||
|
@ -414,7 +414,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* Meta Search *
|
||||
* * * * * * * * * * */
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_ImgCond_NoResults($image_ids)
|
||||
public function testBSQ_ImgCond_NoResults($image_ids): void
|
||||
{
|
||||
$this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -430,7 +430,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_ImgCond_OneResult($image_ids)
|
||||
public function testBSQ_ImgCond_OneResult($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
$this->assert_BSQ(
|
||||
|
@ -451,7 +451,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_ImgCond_ManyResults($image_ids)
|
||||
public function testBSQ_ImgCond_ManyResults($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
|
||||
|
@ -476,7 +476,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* Mixed *
|
||||
* * * * * * * * * * */
|
||||
#[Depends('testUpload')]
|
||||
public function testBSQ_TagCondWithImgCond($image_ids)
|
||||
public function testBSQ_TagCondWithImgCond($image_ids): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
// multiple tags, many results
|
||||
|
@ -492,7 +492,7 @@ class SearchTest extends ShimmiePHPUnitTestCase
|
|||
* get_images
|
||||
*/
|
||||
#[Depends('testUpload')]
|
||||
public function test_get_images()
|
||||
public function test_get_images(): void
|
||||
{
|
||||
$image_ids = $this->testUpload();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ require_once "core/imageboard/tag.php";
|
|||
|
||||
class TagTest extends TestCase
|
||||
{
|
||||
public function test_compare()
|
||||
public function test_compare(): void
|
||||
{
|
||||
$this->assertFalse(Tag::compare(["foo"], ["bar"]));
|
||||
$this->assertFalse(Tag::compare(["foo"], ["foo", "bar"]));
|
||||
|
|
|
@ -10,7 +10,7 @@ require_once "core/urls.php";
|
|||
|
||||
class UrlsTest extends TestCase
|
||||
{
|
||||
public function test_search_link()
|
||||
public function test_search_link(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"/test/post/list/bar%20foo/1",
|
||||
|
@ -22,7 +22,7 @@ class UrlsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_make_link()
|
||||
public function test_make_link(): void
|
||||
{
|
||||
// basic
|
||||
$this->assertEquals(
|
||||
|
@ -55,7 +55,7 @@ class UrlsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_make_http()
|
||||
public function test_make_http(): void
|
||||
{
|
||||
// relative to shimmie install
|
||||
$this->assertEquals(
|
||||
|
@ -76,7 +76,7 @@ class UrlsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_modify_url()
|
||||
public function test_modify_url(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"/foo/bar?a=3&b=2",
|
||||
|
@ -94,7 +94,7 @@ class UrlsTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_referer_or()
|
||||
public function test_referer_or(): void
|
||||
{
|
||||
unset($_SERVER['HTTP_REFERER']);
|
||||
$this->assertEquals(
|
||||
|
|
|
@ -10,42 +10,42 @@ require_once "core/util.php";
|
|||
|
||||
class UtilTest extends TestCase
|
||||
{
|
||||
public function test_get_theme()
|
||||
public function test_get_theme(): void
|
||||
{
|
||||
$this->assertEquals("default", get_theme());
|
||||
}
|
||||
|
||||
public function test_get_memory_limit()
|
||||
public function test_get_memory_limit(): void
|
||||
{
|
||||
get_memory_limit();
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function test_check_gd_version()
|
||||
public function test_check_gd_version(): void
|
||||
{
|
||||
check_gd_version();
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function test_check_im_version()
|
||||
public function test_check_im_version(): void
|
||||
{
|
||||
check_im_version();
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function test_human_filesize()
|
||||
public function test_human_filesize(): void
|
||||
{
|
||||
$this->assertEquals("123.00B", human_filesize(123));
|
||||
$this->assertEquals("123B", human_filesize(123, 0));
|
||||
$this->assertEquals("120.56KB", human_filesize(123456));
|
||||
}
|
||||
|
||||
public function test_generate_key()
|
||||
public function test_generate_key(): void
|
||||
{
|
||||
$this->assertEquals(20, strlen(generate_key()));
|
||||
}
|
||||
|
||||
public function test_warehouse_path()
|
||||
public function test_warehouse_path(): void
|
||||
{
|
||||
$hash = "7ac19c10d6859415";
|
||||
|
||||
|
@ -105,7 +105,7 @@ class UtilTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_load_balance_url()
|
||||
public function test_load_balance_url(): void
|
||||
{
|
||||
$hash = "7ac19c10d6859415";
|
||||
$ext = "jpg";
|
||||
|
@ -123,7 +123,7 @@ class UtilTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_path_to_tags()
|
||||
public function test_path_to_tags(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
[],
|
||||
|
|
|
@ -163,7 +163,7 @@ function is_trusted_proxy(): bool
|
|||
/**
|
||||
* Get real IP if behind a reverse proxy
|
||||
*/
|
||||
function get_real_ip()
|
||||
function get_real_ip(): string
|
||||
{
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
|
@ -572,7 +572,7 @@ function require_all(array $files): void
|
|||
}
|
||||
}
|
||||
|
||||
function _load_core_files()
|
||||
function _load_core_files(): void
|
||||
{
|
||||
require_all(array_merge(
|
||||
zglob("core/*.php"),
|
||||
|
@ -581,14 +581,14 @@ function _load_core_files()
|
|||
));
|
||||
}
|
||||
|
||||
function _load_extension_files()
|
||||
function _load_extension_files(): void
|
||||
{
|
||||
ExtensionInfo::load_all_extension_info();
|
||||
Extension::determine_enabled_extensions();
|
||||
require_all(zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/main.php"));
|
||||
}
|
||||
|
||||
function _load_theme_files()
|
||||
function _load_theme_files(): void
|
||||
{
|
||||
$theme = get_theme();
|
||||
require_once('themes/'.$theme.'/page.class.php');
|
||||
|
@ -770,7 +770,7 @@ function make_form(string $target, string $method = "POST", bool $multipart = fa
|
|||
}
|
||||
|
||||
const BYTE_DENOMINATIONS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
function human_filesize(int $bytes, $decimals = 2): string
|
||||
function human_filesize(int $bytes, int $decimals = 2): string
|
||||
{
|
||||
$factor = floor((strlen(strval($bytes)) - 1) / 3);
|
||||
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @BYTE_DENOMINATIONS[$factor];
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class AdminPageTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testAuth()
|
||||
public function testAuth(): void
|
||||
{
|
||||
send_event(new UserLoginEvent(User::by_name(self::$anon_name)));
|
||||
$page = $this->get_page('admin');
|
||||
|
|
|
@ -6,14 +6,14 @@ namespace Shimmie2;
|
|||
|
||||
class AliasEditorTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testAliasList()
|
||||
public function testAliasList(): void
|
||||
{
|
||||
$this->get_page('alias/list');
|
||||
$this->assert_response(200);
|
||||
$this->assert_title("Alias List");
|
||||
}
|
||||
|
||||
public function testAliasListReadOnly()
|
||||
public function testAliasListReadOnly(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$this->get_page('alias/list');
|
||||
|
@ -26,7 +26,7 @@ class AliasEditorTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text("Add");
|
||||
}
|
||||
|
||||
public function testAliasOneToOne()
|
||||
public function testAliasOneToOne(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
|
||||
|
@ -54,7 +54,7 @@ class AliasEditorTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text("test1");
|
||||
}
|
||||
|
||||
public function testAliasOneToMany()
|
||||
public function testAliasOneToMany(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ArtistsTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testSearch()
|
||||
public function testSearch(): void
|
||||
{
|
||||
global $user;
|
||||
$this->log_in_as_user();
|
||||
|
|
|
@ -6,14 +6,14 @@ namespace Shimmie2;
|
|||
|
||||
class AutoTaggerTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testAutoTaggerList()
|
||||
public function testAutoTaggerList(): void
|
||||
{
|
||||
$this->get_page('auto_tag/list');
|
||||
$this->assert_response(200);
|
||||
$this->assert_title("Auto-Tag");
|
||||
}
|
||||
|
||||
public function testAutoTaggerListReadOnly()
|
||||
public function testAutoTaggerListReadOnly(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$this->get_page('auto_tag/list');
|
||||
|
@ -26,7 +26,7 @@ class AutoTaggerTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text("value=\"Add\"");
|
||||
}
|
||||
|
||||
public function testAutoTagger()
|
||||
public function testAutoTagger(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class AutoCompleteTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testAuth()
|
||||
public function testAuth(): void
|
||||
{
|
||||
send_event(new UserLoginEvent(User::by_name(self::$anon_name)));
|
||||
$page = $this->get_page('api/internal/autocomplete', ["s" => "not-a-tag"]);
|
||||
|
|
|
@ -17,7 +17,7 @@ class BanWordsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testWordBan()
|
||||
public function testWordBan(): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_string("banned_words", "viagra\nporn\n\n/http:.*\.cn\//");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class BBCodeTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testBasics()
|
||||
public function testBasics(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<b>bold</b><i>italic</i>",
|
||||
|
@ -14,7 +14,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testStacking()
|
||||
public function testStacking(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<b>B</b><i>I</i><b>B</b>",
|
||||
|
@ -26,7 +26,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testFailure()
|
||||
public function testFailure(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"[b]bold[i]italic",
|
||||
|
@ -34,7 +34,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testCode()
|
||||
public function testCode(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<pre class='code'>[b]bold[/b]</pre>",
|
||||
|
@ -42,7 +42,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testNestedList()
|
||||
public function testNestedList(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<ul><li>a<ul><li>a<li>b</ul><li>b</ul>",
|
||||
|
@ -54,7 +54,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testSpoiler()
|
||||
public function testSpoiler(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<span style=\"background-color:#000; color:#000;\">ShishNet</span>",
|
||||
|
@ -69,7 +69,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
# "[spoiler]ShishNet");
|
||||
}
|
||||
|
||||
public function testURL()
|
||||
public function testURL(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<a href=\"https://shishnet.org\">https://shishnet.org</a>",
|
||||
|
@ -85,7 +85,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testEmailURL()
|
||||
public function testEmailURL(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
"<a href=\"mailto:spam@shishnet.org\">spam@shishnet.org</a>",
|
||||
|
@ -93,7 +93,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testAnchor()
|
||||
public function testAnchor(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
'<span class="anchor">Rules <a class="alink" href="#bb-rules" name="bb-rules" title="link to this anchor"> ¶ </a></span>',
|
||||
|
@ -113,7 +113,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase
|
|||
return $bb->strip($in);
|
||||
}
|
||||
|
||||
public function testSiteLinks()
|
||||
public function testSiteLinks(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
'<a class="shm-clink" data-clink-sel="" href="/test/post/view/123">>>123</a>',
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class BiographyTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testBio()
|
||||
public function testBio(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$this->post_page("biography", ["biography" => "My bio goes here"]);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class BlocksTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testBlocks()
|
||||
public function testBlocks(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$this->get_page("blocks/list");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class BlotterTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testDenial()
|
||||
public function testDenial(): void
|
||||
{
|
||||
$this->get_page("blotter/editor");
|
||||
$this->assert_response(403);
|
||||
|
@ -16,7 +16,7 @@ class BlotterTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_response(403);
|
||||
}
|
||||
|
||||
public function testAddViewRemove()
|
||||
public function testAddViewRemove(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class BrowserSearchTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testBasic()
|
||||
public function testBasic(): void
|
||||
{
|
||||
$page = $this->get_page("browser_search.xml");
|
||||
$this->assertEquals(200, $page->code);
|
||||
|
|
|
@ -6,14 +6,14 @@ namespace Shimmie2;
|
|||
|
||||
class BulkAddTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testInvalidDir()
|
||||
public function testInvalidDir(): void
|
||||
{
|
||||
send_event(new UserLoginEvent(User::by_name(self::$admin_name)));
|
||||
$bae = send_event(new BulkAddEvent('asdf'));
|
||||
$this->assertTrue(is_a($bae->results[0], UploadError::class));
|
||||
}
|
||||
|
||||
public function testValidDir()
|
||||
public function testValidDir(): void
|
||||
{
|
||||
send_event(new UserLoginEvent(User::by_name(self::$admin_name)));
|
||||
send_event(new BulkAddEvent('tests'));
|
||||
|
|
|
@ -21,7 +21,7 @@ class CommentListTest extends ShimmiePHPUnitTestCase
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testCommentsPage()
|
||||
public function testCommentsPage(): void
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
@ -90,7 +90,7 @@ class CommentListTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text('ASDFASDF');
|
||||
}
|
||||
|
||||
public function testSingleDel()
|
||||
public function testSingleDel(): void
|
||||
{
|
||||
global $database, $user;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class DanbooruApiTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testSearch()
|
||||
public function testSearch(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class DownloadTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testView()
|
||||
public function testView(): void
|
||||
{
|
||||
global $page;
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
|
|
|
@ -13,7 +13,7 @@ class DowntimeTest extends ShimmiePHPUnitTestCase
|
|||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testDowntime()
|
||||
public function testDowntime(): void
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class EmoticonsTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testEmoticons()
|
||||
public function testEmoticons(): void
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class EokmTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testPass()
|
||||
public function testPass(): void
|
||||
{
|
||||
// no EOKM login details set, so be a no-op
|
||||
$this->log_in_as_user();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ETTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testET()
|
||||
public function testET(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$this->get_page("system_info");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ETServerTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testView()
|
||||
public function testView(): void
|
||||
{
|
||||
$this->post_page("register.php", ["data" => "test entry"]);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ExtManagerTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testAuth()
|
||||
public function testAuth(): void
|
||||
{
|
||||
$this->get_page('ext_manager');
|
||||
$this->assert_title("Extensions");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class FavoritesTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testFavorites()
|
||||
public function testFavorites(): void
|
||||
{
|
||||
global $user;
|
||||
$this->log_in_as_user();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class FeaturedTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testFeatured()
|
||||
public function testFeatured(): void
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class FourOhFourTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function test404Handler()
|
||||
public function test404Handler(): void
|
||||
{
|
||||
$this->get_page('not/a/page');
|
||||
// most descriptive error first
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class GraphQLTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testSchema()
|
||||
public function testSchema(): void
|
||||
{
|
||||
$schema = GraphQL::get_schema();
|
||||
$schema->assertValid();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ArchiveFileHandlerTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testArchiveHander()
|
||||
public function testArchiveHander(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
system("zip -q tests/test.zip tests/pbx_screenshot.jpg tests/favicon.png");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class IcoFileHandlerTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testIcoHander()
|
||||
public function testIcoHander(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("ext/static_files/static/favicon.ico", "shimmie favicon");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class PixelFileHandlerTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testPixelHander()
|
||||
public function testPixelHander(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class SVGFileHandlerTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testSVGHander()
|
||||
public function testSVGHander(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/test.svg", "something");
|
||||
|
@ -18,7 +18,7 @@ class SVGFileHandlerTest extends ShimmiePHPUnitTestCase
|
|||
# FIXME: test that it gets displayed properly
|
||||
}
|
||||
|
||||
public function testAbusiveSVG()
|
||||
public function testAbusiveSVG(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/alert.svg", "something");
|
||||
|
|
|
@ -6,13 +6,13 @@ namespace Shimmie2;
|
|||
|
||||
class HelpPagesTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function test_list()
|
||||
public function test_list(): void
|
||||
{
|
||||
send_event(new HelpPageListBuildingEvent());
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function test_page()
|
||||
public function test_page(): void
|
||||
{
|
||||
send_event(new HelpPageBuildingEvent("test"));
|
||||
$this->assertTrue(true);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class HomeTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testHomePage()
|
||||
public function testHomePage(): void
|
||||
{
|
||||
$page = $this->get_page('home');
|
||||
$this->assertStringContainsString("Posts", $page->data);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ImageIOTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testUserStats()
|
||||
public function testUserStats(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||
|
@ -26,7 +26,7 @@ class ImageIOTest extends ShimmiePHPUnitTestCase
|
|||
$this->assertEquals(200, $page->code);
|
||||
}
|
||||
|
||||
public function testDeleteRequest()
|
||||
public function testDeleteRequest(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||
|
|
|
@ -8,14 +8,14 @@ class ImageBanTest extends ShimmiePHPUnitTestCase
|
|||
{
|
||||
private string $hash = "feb01bab5698a11dd87416724c7a89e3";
|
||||
|
||||
public function testPages()
|
||||
public function testPages(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$page = $this->get_page("image_hash_ban/list");
|
||||
$this->assertEquals(200, $page->code);
|
||||
}
|
||||
|
||||
public function testBan()
|
||||
public function testBan(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ImageViewCounterTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testPostView()
|
||||
public function testPostView(): void
|
||||
{
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
$this->log_in_as_admin();
|
||||
|
@ -14,7 +14,7 @@ class ImageViewCounterTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_text("Views");
|
||||
}
|
||||
|
||||
public function testPopular()
|
||||
public function testPopular(): void
|
||||
{
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
$this->get_page("post/view/$image_id");
|
||||
|
|
|
@ -8,7 +8,7 @@ use PHPUnit\Framework\Attributes\Depends;
|
|||
|
||||
class IndexTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testIndexPage()
|
||||
public function testIndexPage(): void
|
||||
{
|
||||
$this->get_page('post/list');
|
||||
$this->assert_title("Welcome to Shimmie");
|
||||
|
@ -51,7 +51,7 @@ class IndexTest extends ShimmiePHPUnitTestCase
|
|||
|
||||
// This isn't really an index thing, we just want to test this from
|
||||
// SOMEWHERE because the default theme doesn't use them.
|
||||
public function test_nav()
|
||||
public function test_nav(): void
|
||||
{
|
||||
send_event(new UserLoginEvent(User::by_name(self::$user_name)));
|
||||
send_event(new PageNavBuildingEvent());
|
||||
|
|
|
@ -8,14 +8,14 @@ class IPBanTest extends ShimmiePHPUnitTestCase
|
|||
{
|
||||
# FIXME: test that the IP is actually banned
|
||||
|
||||
public function testAccess()
|
||||
public function testAccess(): void
|
||||
{
|
||||
$page = $this->get_page('ip_ban/list');
|
||||
$this->assertEquals(403, $page->code);
|
||||
$this->assertEquals("Permission Denied", $page->title);
|
||||
}
|
||||
|
||||
public function testIPBan()
|
||||
public function testIPBan(): void
|
||||
{
|
||||
global $database;
|
||||
|
||||
|
@ -52,7 +52,7 @@ class IPBanTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function test_all()
|
||||
public function test_all(): void
|
||||
{
|
||||
// just test it doesn't crash for now
|
||||
$this->log_in_as_admin();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class LinkImageTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testLinkImage()
|
||||
public function testLinkImage(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pie");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class LogDatabaseTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testLog()
|
||||
public function testLog(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$this->get_page("log/view");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class MimeSystemTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testJPEG()
|
||||
public function testJPEG(): void
|
||||
{
|
||||
$result = MimeType::get_for_file("tests/bedroom_workshop.jpg");
|
||||
$this->assertEquals(MimeType::JPEG, $result);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class NotATagTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testUntags()
|
||||
public function testUntags(): void
|
||||
{
|
||||
global $database;
|
||||
$database->execute("DELETE FROM untags");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class NumericScoreTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testNumericScore()
|
||||
public function testNumericScore(): void
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class PrivMsgTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testUserReadOwnMessage()
|
||||
public function testUserReadOwnMessage(): void
|
||||
{
|
||||
// Send from admin to user
|
||||
$this->log_in_as_admin();
|
||||
|
@ -37,7 +37,7 @@ class PrivMsgTest extends ShimmiePHPUnitTestCase
|
|||
// $this->assert_text("No such PM");
|
||||
}
|
||||
|
||||
public function testAdminReadOtherMessage()
|
||||
public function testAdminReadOtherMessage(): void
|
||||
{
|
||||
// Send from admin to user
|
||||
$this->log_in_as_admin();
|
||||
|
|
|
@ -20,7 +20,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testAnon()
|
||||
public function testAnon(): void
|
||||
{
|
||||
$this->log_out();
|
||||
|
||||
|
@ -53,7 +53,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testCreate')]
|
||||
public function testOnViewImage($args)
|
||||
public function testOnViewImage($args): void
|
||||
{
|
||||
[$pool_id, $image_ids] = $this->testCreate();
|
||||
|
||||
|
@ -67,7 +67,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testCreate')]
|
||||
public function testSearch($args)
|
||||
public function testSearch($args): void
|
||||
{
|
||||
[$pool_id, $image_ids] = $this->testCreate();
|
||||
|
||||
|
@ -79,7 +79,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testCreate')]
|
||||
public function testList($args)
|
||||
public function testList($args): void
|
||||
{
|
||||
$this->testCreate();
|
||||
$this->get_page("pool/list");
|
||||
|
@ -87,7 +87,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testCreate')]
|
||||
public function testView($args)
|
||||
public function testView($args): void
|
||||
{
|
||||
[$pool_id, $image_ids] = $this->testCreate();
|
||||
|
||||
|
@ -96,7 +96,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testCreate')]
|
||||
public function testHistory($args)
|
||||
public function testHistory($args): void
|
||||
{
|
||||
[$pool_id, $image_ids] = $this->testCreate();
|
||||
|
||||
|
@ -105,7 +105,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testCreate')]
|
||||
public function testImport($args)
|
||||
public function testImport($args): void
|
||||
{
|
||||
[$pool_id, $image_ids] = $this->testCreate();
|
||||
|
||||
|
@ -131,7 +131,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testRemovePosts')]
|
||||
public function testAddPosts($args)
|
||||
public function testAddPosts($args): void
|
||||
{
|
||||
[$pool_id, $image_ids] = $this->testRemovePosts(null);
|
||||
|
||||
|
@ -156,7 +156,7 @@ class PoolsTest extends ShimmiePHPUnitTestCase
|
|||
return [$pool_id, $image_ids];
|
||||
}
|
||||
|
||||
public function testNuke()
|
||||
public function testNuke(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class RandomImageTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testRandom()
|
||||
public function testRandom(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||
|
@ -23,7 +23,7 @@ class RandomImageTest extends ShimmiePHPUnitTestCase
|
|||
# FIXME: assert($raw == file(blah.jpg))
|
||||
}
|
||||
|
||||
public function testPostListBlock()
|
||||
public function testPostListBlock(): void
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class RatingsTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testRatingSafe()
|
||||
public function testRatingSafe(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
||||
|
@ -25,7 +25,7 @@ class RatingsTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_search_results(["rating=q"], []);
|
||||
}
|
||||
|
||||
public function testRatingExplicit()
|
||||
public function testRatingExplicit(): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_array("ext_rating_anonymous_privs", ["s", "q"]);
|
||||
|
@ -39,7 +39,7 @@ class RatingsTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_search_results(["pbx"], []);
|
||||
}
|
||||
|
||||
public function testUserConfig()
|
||||
public function testUserConfig(): void
|
||||
{
|
||||
global $config, $user_config;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class RegenThumbTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testRegenThumb()
|
||||
public function testRegenThumb(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
|
|
|
@ -78,7 +78,7 @@ class RelationshipsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testSetParent')]
|
||||
public function testSearch($imgs)
|
||||
public function testSearch($imgs): void
|
||||
{
|
||||
[$image_1, $image_2, $image_3] = $this->testSetParent(null);
|
||||
|
||||
|
@ -91,7 +91,7 @@ class RelationshipsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testChangeParent')]
|
||||
public function testRemoveParent($imgs)
|
||||
public function testRemoveParent($imgs): void
|
||||
{
|
||||
[$image_1, $image_2, $image_3] = $this->testChangeParent(null);
|
||||
|
||||
|
@ -187,7 +187,7 @@ class RelationshipsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
#[Depends('testSetChildByTag')]
|
||||
public function testRemoveParentByTag($imgs)
|
||||
public function testRemoveParentByTag($imgs): void
|
||||
{
|
||||
[$image_1, $image_2, $image_3] = $this->testSetChildByTag(null);
|
||||
assert(!is_null($image_3));
|
||||
|
|
|
@ -6,14 +6,14 @@ namespace Shimmie2;
|
|||
|
||||
class ReplaceFileTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testReplacePage()
|
||||
public function testReplacePage(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
$this->get_page("replace/$image_id");
|
||||
$this->assert_title("Replace File");
|
||||
}
|
||||
public function testReplace()
|
||||
public function testReplace(): void
|
||||
{
|
||||
global $database;
|
||||
$this->log_in_as_admin();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ReportImageTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testReportImage()
|
||||
public function testReportImage(): void
|
||||
{
|
||||
global $config, $database, $user;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class ResolutionLimitTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testResLimitOK()
|
||||
public function testResLimitOK(): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_int("upload_min_height", 0);
|
||||
|
@ -23,7 +23,7 @@ class ResolutionLimitTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text("ratio");
|
||||
}
|
||||
|
||||
public function testResLimitSmall()
|
||||
public function testResLimitSmall(): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_int("upload_min_height", 900);
|
||||
|
@ -39,7 +39,7 @@ class ResolutionLimitTest extends ShimmiePHPUnitTestCase
|
|||
$this->assertEquals("Post too small", $e->getMessage());
|
||||
}
|
||||
|
||||
public function testResLimitLarge()
|
||||
public function testResLimitLarge(): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_int("upload_min_height", 0);
|
||||
|
@ -54,7 +54,7 @@ class ResolutionLimitTest extends ShimmiePHPUnitTestCase
|
|||
$this->assertEquals("Post too large", $e->getMessage());
|
||||
}
|
||||
|
||||
public function testResLimitRatio()
|
||||
public function testResLimitRatio(): void
|
||||
{
|
||||
global $config;
|
||||
$config->set_int("upload_min_height", -1);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class RSSCommentsTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testImageFeed()
|
||||
public function testImageFeed(): void
|
||||
{
|
||||
global $user;
|
||||
$this->log_in_as_user();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class RSSImagesTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testImageFeed()
|
||||
public function testImageFeed(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class SetupTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testNiceUrlsTest()
|
||||
public function testNiceUrlsTest(): void
|
||||
{
|
||||
# XXX: this only checks that the text is "ok", to check
|
||||
# for a bug where it was coming out as "\nok"; it doesn't
|
||||
|
@ -16,14 +16,14 @@ class SetupTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_content("\n");
|
||||
}
|
||||
|
||||
public function testAuthAnon()
|
||||
public function testAuthAnon(): void
|
||||
{
|
||||
$this->get_page('setup');
|
||||
$this->assert_response(403);
|
||||
$this->assert_title("Permission Denied");
|
||||
}
|
||||
|
||||
public function testAuthUser()
|
||||
public function testAuthUser(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$this->get_page('setup');
|
||||
|
@ -31,7 +31,7 @@ class SetupTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_title("Permission Denied");
|
||||
}
|
||||
|
||||
public function testAuthAdmin()
|
||||
public function testAuthAdmin(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$this->get_page('setup');
|
||||
|
@ -39,7 +39,7 @@ class SetupTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_text("General");
|
||||
}
|
||||
|
||||
public function testAdvanced()
|
||||
public function testAdvanced(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$this->get_page('setup/advanced');
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class SiteDescriptionTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testSiteDescription()
|
||||
public function testSiteDescription(): void
|
||||
{
|
||||
global $config, $page;
|
||||
$config->set_string("site_description", "A Shimmie testbed");
|
||||
|
@ -17,7 +17,7 @@ class SiteDescriptionTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testSiteKeywords()
|
||||
public function testSiteKeywords(): void
|
||||
{
|
||||
global $config, $page;
|
||||
$config->set_string("site_keywords", "foo,bar,baz");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class XMLSitemapTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testBasic()
|
||||
public function testBasic(): void
|
||||
{
|
||||
$page = $this->get_page('sitemap.xml');
|
||||
$this->assertEquals(200, $page->code);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class StaticFilesTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testStaticHandler()
|
||||
public function testStaticHandler(): void
|
||||
{
|
||||
$this->get_page('favicon.ico');
|
||||
$this->assert_response(200);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class SystemTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testView()
|
||||
public function testView(): void
|
||||
{
|
||||
global $page;
|
||||
$this->get_page("system");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class TagEditTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testValidChange()
|
||||
public function testValidChange(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
||||
|
@ -22,7 +22,7 @@ class TagEditTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_title("Post $image_id: new");
|
||||
}
|
||||
|
||||
public function testInvalidChange()
|
||||
public function testInvalidChange(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
||||
|
@ -39,7 +39,7 @@ class TagEditTest extends ShimmiePHPUnitTestCase
|
|||
$this->assertEquals("Can't set a tag which contains a wildcard (*)", $e->getMessage());
|
||||
}
|
||||
|
||||
public function testTagEdit_tooLong()
|
||||
public function testTagEdit_tooLong(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", str_repeat("a", 500));
|
||||
|
@ -47,7 +47,7 @@ class TagEditTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_title("Post $image_id: tagme");
|
||||
}
|
||||
|
||||
public function testSourceEdit()
|
||||
public function testSourceEdit(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class TagHistoryTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testTagHistory()
|
||||
public function testTagHistory(): void
|
||||
{
|
||||
$this->log_in_as_admin();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "old_tag");
|
||||
|
|
|
@ -8,7 +8,7 @@ class TagListTest extends ShimmiePHPUnitTestCase
|
|||
{
|
||||
private array $pages = ["map", "alphabetic", "popularity", "categories"];
|
||||
|
||||
public function testTagList()
|
||||
public function testTagList(): void
|
||||
{
|
||||
$this->get_page('tags/map');
|
||||
$this->assert_title('Tag List');
|
||||
|
@ -25,7 +25,7 @@ class TagListTest extends ShimmiePHPUnitTestCase
|
|||
# FIXME: test that these show the right stuff
|
||||
}
|
||||
|
||||
public function testMinCount()
|
||||
public function testMinCount(): void
|
||||
{
|
||||
foreach ($this->pages as $page) {
|
||||
$this->get_page("tags/$page", ["mincount" => 999999]);
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class TagToolsTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testLowercaseAndSetCase()
|
||||
public function testLowercaseAndSetCase(): void
|
||||
{
|
||||
// Create a problem
|
||||
$ts = time(); // we need a tag that hasn't been used before
|
||||
|
@ -34,7 +34,7 @@ class TagToolsTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
# FIXME: make sure the admin tools actually work
|
||||
public function testRecount()
|
||||
public function testRecount(): void
|
||||
{
|
||||
global $database;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class TipsTest extends ShimmiePHPUnitTestCase
|
|||
$database->execute("DELETE FROM tips");
|
||||
}
|
||||
|
||||
public function testImageless()
|
||||
public function testImageless(): void
|
||||
{
|
||||
global $database;
|
||||
$this->log_in_as_admin();
|
||||
|
@ -32,7 +32,7 @@ class TipsTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text("a postless tip");
|
||||
}
|
||||
|
||||
public function testImaged()
|
||||
public function testImaged(): void
|
||||
{
|
||||
global $database;
|
||||
$this->log_in_as_admin();
|
||||
|
@ -50,7 +50,7 @@ class TipsTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text("a postless tip");
|
||||
}
|
||||
|
||||
public function testDisabled()
|
||||
public function testDisabled(): void
|
||||
{
|
||||
global $database;
|
||||
$this->log_in_as_admin();
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class UploadTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testUploadPage()
|
||||
public function testUploadPage(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
|
||||
|
@ -15,7 +15,7 @@ class UploadTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
|
||||
// Because $this->post_image() sends the event directly
|
||||
public function testRawUpload()
|
||||
public function testRawUpload(): void
|
||||
{
|
||||
global $database;
|
||||
|
||||
|
@ -50,7 +50,7 @@ class UploadTest extends ShimmiePHPUnitTestCase
|
|||
$this->assertEquals(4, $database->get_one("SELECT COUNT(*) FROM images"));
|
||||
}
|
||||
|
||||
public function testUpload()
|
||||
public function testUpload(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
|
@ -60,7 +60,7 @@ class UploadTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_title("Post $image_id: computer pbx screenshot");
|
||||
}
|
||||
|
||||
public function testRejectDupe()
|
||||
public function testRejectDupe(): void
|
||||
{
|
||||
$this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
|
||||
|
@ -70,13 +70,13 @@ class UploadTest extends ShimmiePHPUnitTestCase
|
|||
$this->assertStringContainsString("already has hash", $e->getMessage());
|
||||
}
|
||||
|
||||
public function testRejectUnknownFiletype()
|
||||
public function testRejectUnknownFiletype(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->post_image("index.php", "test");
|
||||
}
|
||||
|
||||
public function testRejectHuge()
|
||||
public function testRejectHuge(): void
|
||||
{
|
||||
// FIXME: huge.dat is rejected for other reasons; manual testing shows that this works
|
||||
file_put_contents("data/huge.jpg", file_get_contents("tests/pbx_screenshot.jpg") . str_repeat("U", 1024 * 1024 * 3));
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Shimmie2;
|
|||
|
||||
class UserPageTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testUserPage()
|
||||
public function testUserPage(): void
|
||||
{
|
||||
$this->get_page('user');
|
||||
$this->assert_title("Not Logged In");
|
||||
|
@ -42,19 +42,19 @@ class UserPageTest extends ShimmiePHPUnitTestCase
|
|||
# FIXME: test user creation
|
||||
# FIXME: test adminifying
|
||||
# FIXME: test password reset
|
||||
public function testUserList()
|
||||
public function testUserList(): void
|
||||
{
|
||||
$this->get_page('user_admin/list');
|
||||
$this->assert_text("demo");
|
||||
}
|
||||
|
||||
public function testUserClasses()
|
||||
public function testUserClasses(): void
|
||||
{
|
||||
$this->get_page('user_admin/classes');
|
||||
$this->assert_text("admin");
|
||||
}
|
||||
|
||||
public function testCreateOther()
|
||||
public function testCreateOther(): void
|
||||
{
|
||||
global $page;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class UserConfigTest extends ShimmiePHPUnitTestCase
|
|||
{
|
||||
private const OPTIONS_BLOCK_TITLE = "User Options";
|
||||
|
||||
public function testUserConfigPage()
|
||||
public function testUserConfigPage(): void
|
||||
{
|
||||
$this->get_page('user_config');
|
||||
$this->assert_title("Permission Denied");
|
||||
|
|
|
@ -12,7 +12,7 @@ class ViewPostTest extends ShimmiePHPUnitTestCase
|
|||
// FIXME: upload images
|
||||
}
|
||||
|
||||
public function testViewPage()
|
||||
public function testViewPage(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||
|
@ -21,7 +21,7 @@ class ViewPostTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_title("Post $image_id_1: test");
|
||||
}
|
||||
|
||||
public function testViewInfo()
|
||||
public function testViewInfo(): void
|
||||
{
|
||||
global $config;
|
||||
|
||||
|
@ -33,7 +33,7 @@ class ViewPostTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_text("640x480 // 19KB // jpg");
|
||||
}
|
||||
|
||||
public function testPrevNext()
|
||||
public function testPrevNext(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||
|
@ -66,7 +66,7 @@ class ViewPostTest extends ShimmiePHPUnitTestCase
|
|||
$this->assertEquals(404, $page->code);
|
||||
}
|
||||
|
||||
public function testPrevNextDisabledWhenOrdered()
|
||||
public function testPrevNextDisabledWhenOrdered(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
||||
|
@ -84,7 +84,7 @@ class ViewPostTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_no_text("Prev");
|
||||
}
|
||||
|
||||
public function testView404()
|
||||
public function testView404(): void
|
||||
{
|
||||
$this->log_in_as_user();
|
||||
$image_id_1 = $this->post_image("tests/favicon.png", "test");
|
||||
|
|
|
@ -6,14 +6,14 @@ namespace Shimmie2;
|
|||
|
||||
class WikiTest extends ShimmiePHPUnitTestCase
|
||||
{
|
||||
public function testIndex()
|
||||
public function testIndex(): void
|
||||
{
|
||||
$this->get_page("wiki");
|
||||
$this->assert_title("Index");
|
||||
$this->assert_text("This is a default page");
|
||||
}
|
||||
|
||||
public function testAccess()
|
||||
public function testAccess(): void
|
||||
{
|
||||
global $config;
|
||||
foreach (["anon", "user", "admin"] as $user) {
|
||||
|
@ -53,7 +53,7 @@ class WikiTest extends ShimmiePHPUnitTestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testDefault()
|
||||
public function testDefault(): void
|
||||
{
|
||||
global $user;
|
||||
$this->log_in_as_admin();
|
||||
|
@ -82,7 +82,7 @@ class WikiTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_text("This is a default page");
|
||||
}
|
||||
|
||||
public function testRevisions()
|
||||
public function testRevisions(): void
|
||||
{
|
||||
global $user;
|
||||
$this->log_in_as_admin();
|
||||
|
|
|
@ -23,7 +23,7 @@ class WordFilterTest extends ShimmiePHPUnitTestCase
|
|||
$this->assert_text($out);
|
||||
}
|
||||
|
||||
public function testRegular()
|
||||
public function testRegular(): void
|
||||
{
|
||||
$this->_doThings(
|
||||
"posted by a whore",
|
||||
|
@ -31,7 +31,7 @@ class WordFilterTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testReplaceAll()
|
||||
public function testReplaceAll(): void
|
||||
{
|
||||
$this->_doThings(
|
||||
"a whore is a whore is a whore",
|
||||
|
@ -39,7 +39,7 @@ class WordFilterTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testMixedCase()
|
||||
public function testMixedCase(): void
|
||||
{
|
||||
$this->_doThings(
|
||||
"monkey WhorE",
|
||||
|
@ -47,7 +47,7 @@ class WordFilterTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testOnlyWholeWords()
|
||||
public function testOnlyWholeWords(): void
|
||||
{
|
||||
$this->_doThings(
|
||||
"my name is whoretta",
|
||||
|
@ -55,7 +55,7 @@ class WordFilterTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testMultipleWords()
|
||||
public function testMultipleWords(): void
|
||||
{
|
||||
$this->_doThings(
|
||||
"I would like a duck",
|
||||
|
@ -63,7 +63,7 @@ class WordFilterTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testWhitespace()
|
||||
public function testWhitespace(): void
|
||||
{
|
||||
$this->_doThings(
|
||||
"A colour is white",
|
||||
|
@ -71,7 +71,7 @@ class WordFilterTest extends ShimmiePHPUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testIgnoreInvalid()
|
||||
public function testIgnoreInvalid(): void
|
||||
{
|
||||
$this->_doThings(
|
||||
"The word was invalid",
|
||||
|
|
Reference in a new issue