diff --git a/core/tests/BasePageTest.php b/core/tests/BasePageTest.php index fdec72c1..922bc6a5 100644 --- a/core/tests/BasePageTest.php +++ b/core/tests/BasePageTest.php @@ -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); diff --git a/core/tests/BlockTest.php b/core/tests/BlockTest.php index 1051e773..b8ae0b78 100644 --- a/core/tests/BlockTest.php +++ b/core/tests/BlockTest.php @@ -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( diff --git a/core/tests/InitTest.php b/core/tests/InitTest.php index 3fc48857..8cb5965e 100644 --- a/core/tests/InitTest.php +++ b/core/tests/InitTest.php @@ -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); diff --git a/core/tests/PolyfillsTest.php b/core/tests/PolyfillsTest.php index fc73a30b..2ca5328f 100644 --- a/core/tests/PolyfillsTest.php +++ b/core/tests/PolyfillsTest.php @@ -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( "", @@ -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"; diff --git a/core/tests/SearchTest.php b/core/tests/SearchTest.php index c95197d7..633610c0 100644 --- a/core/tests/SearchTest.php +++ b/core/tests/SearchTest.php @@ -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(); diff --git a/core/tests/TagTest.php b/core/tests/TagTest.php index de928898..a678e406 100644 --- a/core/tests/TagTest.php +++ b/core/tests/TagTest.php @@ -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"])); diff --git a/core/tests/UrlsTest.php b/core/tests/UrlsTest.php index 2d8c8e10..918d4dbc 100644 --- a/core/tests/UrlsTest.php +++ b/core/tests/UrlsTest.php @@ -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( diff --git a/core/tests/UtilTest.php b/core/tests/UtilTest.php index e4312307..d622cc2d 100644 --- a/core/tests/UtilTest.php +++ b/core/tests/UtilTest.php @@ -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( [], diff --git a/core/util.php b/core/util.php index e52acf4c..0e6c81c4 100644 --- a/core/util.php +++ b/core/util.php @@ -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]; diff --git a/ext/admin/test.php b/ext/admin/test.php index 3b59bf82..6975d1e8 100644 --- a/ext/admin/test.php +++ b/ext/admin/test.php @@ -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'); diff --git a/ext/alias_editor/test.php b/ext/alias_editor/test.php index 78437026..55522cde 100644 --- a/ext/alias_editor/test.php +++ b/ext/alias_editor/test.php @@ -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(); diff --git a/ext/artists/test.php b/ext/artists/test.php index 47f312bd..36bdaed8 100644 --- a/ext/artists/test.php +++ b/ext/artists/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class ArtistsTest extends ShimmiePHPUnitTestCase { - public function testSearch() + public function testSearch(): void { global $user; $this->log_in_as_user(); diff --git a/ext/auto_tagger/test.php b/ext/auto_tagger/test.php index e8ed6293..49ca03fe 100644 --- a/ext/auto_tagger/test.php +++ b/ext/auto_tagger/test.php @@ -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(); diff --git a/ext/autocomplete/test.php b/ext/autocomplete/test.php index ff82aa63..6f92370a 100644 --- a/ext/autocomplete/test.php +++ b/ext/autocomplete/test.php @@ -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"]); diff --git a/ext/ban_words/test.php b/ext/ban_words/test.php index a70f6a06..543d1e3b 100644 --- a/ext/ban_words/test.php +++ b/ext/ban_words/test.php @@ -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\//"); diff --git a/ext/bbcode/test.php b/ext/bbcode/test.php index 20b42b6a..3eb2c761 100644 --- a/ext/bbcode/test.php +++ b/ext/bbcode/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class BBCodeTest extends ShimmiePHPUnitTestCase { - public function testBasics() + public function testBasics(): void { $this->assertEquals( "bolditalic", @@ -14,7 +14,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase ); } - public function testStacking() + public function testStacking(): void { $this->assertEquals( "BIB", @@ -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( "
[b]bold[/b]
", @@ -42,7 +42,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase ); } - public function testNestedList() + public function testNestedList(): void { $this->assertEquals( "", @@ -54,7 +54,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase ); } - public function testSpoiler() + public function testSpoiler(): void { $this->assertEquals( "ShishNet", @@ -69,7 +69,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase # "[spoiler]ShishNet"); } - public function testURL() + public function testURL(): void { $this->assertEquals( "https://shishnet.org", @@ -85,7 +85,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase ); } - public function testEmailURL() + public function testEmailURL(): void { $this->assertEquals( "spam@shishnet.org", @@ -93,7 +93,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase ); } - public function testAnchor() + public function testAnchor(): void { $this->assertEquals( 'Rules ΒΆ ', @@ -113,7 +113,7 @@ class BBCodeTest extends ShimmiePHPUnitTestCase return $bb->strip($in); } - public function testSiteLinks() + public function testSiteLinks(): void { $this->assertEquals( '>>123', diff --git a/ext/biography/test.php b/ext/biography/test.php index 700febc6..746d092f 100644 --- a/ext/biography/test.php +++ b/ext/biography/test.php @@ -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"]); diff --git a/ext/blocks/test.php b/ext/blocks/test.php index 15677c4f..03d3ff1f 100644 --- a/ext/blocks/test.php +++ b/ext/blocks/test.php @@ -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"); diff --git a/ext/blotter/test.php b/ext/blotter/test.php index 4bd3cfdb..26797a2a 100644 --- a/ext/blotter/test.php +++ b/ext/blotter/test.php @@ -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(); diff --git a/ext/browser_search/test.php b/ext/browser_search/test.php index 3ccd045f..c50f0d81 100644 --- a/ext/browser_search/test.php +++ b/ext/browser_search/test.php @@ -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); diff --git a/ext/bulk_add/test.php b/ext/bulk_add/test.php index da53d4e9..81425c03 100644 --- a/ext/bulk_add/test.php +++ b/ext/bulk_add/test.php @@ -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')); diff --git a/ext/comment/test.php b/ext/comment/test.php index 4bafa098..9d7e9fdb 100644 --- a/ext/comment/test.php +++ b/ext/comment/test.php @@ -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; diff --git a/ext/danbooru_api/test.php b/ext/danbooru_api/test.php index 4b98e095..bf72e247 100644 --- a/ext/danbooru_api/test.php +++ b/ext/danbooru_api/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class DanbooruApiTest extends ShimmiePHPUnitTestCase { - public function testSearch() + public function testSearch(): void { $this->log_in_as_admin(); diff --git a/ext/download/test.php b/ext/download/test.php index b0ac2949..8b638502 100644 --- a/ext/download/test.php +++ b/ext/download/test.php @@ -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"); diff --git a/ext/downtime/test.php b/ext/downtime/test.php index 460567e7..77dfa261 100644 --- a/ext/downtime/test.php +++ b/ext/downtime/test.php @@ -13,7 +13,7 @@ class DowntimeTest extends ShimmiePHPUnitTestCase parent::tearDown(); } - public function testDowntime() + public function testDowntime(): void { global $config; diff --git a/ext/emoticons/test.php b/ext/emoticons/test.php index 0bcd20ee..9606d9e2 100644 --- a/ext/emoticons/test.php +++ b/ext/emoticons/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class EmoticonsTest extends ShimmiePHPUnitTestCase { - public function testEmoticons() + public function testEmoticons(): void { global $user; diff --git a/ext/eokm/test.php b/ext/eokm/test.php index 6c3d1ff7..dd44fba8 100644 --- a/ext/eokm/test.php +++ b/ext/eokm/test.php @@ -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(); diff --git a/ext/et/test.php b/ext/et/test.php index 8e94f525..d5ce1a75 100644 --- a/ext/et/test.php +++ b/ext/et/test.php @@ -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"); diff --git a/ext/et_server/test.php b/ext/et_server/test.php index 9b80e637..6d643d56 100644 --- a/ext/et_server/test.php +++ b/ext/et_server/test.php @@ -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"]); diff --git a/ext/ext_manager/test.php b/ext/ext_manager/test.php index acb56b77..e1da9dc5 100644 --- a/ext/ext_manager/test.php +++ b/ext/ext_manager/test.php @@ -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"); diff --git a/ext/favorites/test.php b/ext/favorites/test.php index ed1247bc..aa24efcc 100644 --- a/ext/favorites/test.php +++ b/ext/favorites/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class FavoritesTest extends ShimmiePHPUnitTestCase { - public function testFavorites() + public function testFavorites(): void { global $user; $this->log_in_as_user(); diff --git a/ext/featured/test.php b/ext/featured/test.php index ef0c4119..c0c82eb3 100644 --- a/ext/featured/test.php +++ b/ext/featured/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class FeaturedTest extends ShimmiePHPUnitTestCase { - public function testFeatured() + public function testFeatured(): void { global $config; diff --git a/ext/four_oh_four/test.php b/ext/four_oh_four/test.php index 5c71a839..2e0c0efe 100644 --- a/ext/four_oh_four/test.php +++ b/ext/four_oh_four/test.php @@ -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 diff --git a/ext/graphql/test.php b/ext/graphql/test.php index db30ca7f..98146745 100644 --- a/ext/graphql/test.php +++ b/ext/graphql/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class GraphQLTest extends ShimmiePHPUnitTestCase { - public function testSchema() + public function testSchema(): void { $schema = GraphQL::get_schema(); $schema->assertValid(); diff --git a/ext/handle_archive/test.php b/ext/handle_archive/test.php index bea2c0e0..a4582ffa 100644 --- a/ext/handle_archive/test.php +++ b/ext/handle_archive/test.php @@ -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"); diff --git a/ext/handle_ico/test.php b/ext/handle_ico/test.php index 9e108112..2a1db252 100644 --- a/ext/handle_ico/test.php +++ b/ext/handle_ico/test.php @@ -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"); diff --git a/ext/handle_pixel/test.php b/ext/handle_pixel/test.php index 0b12a459..c83f06d6 100644 --- a/ext/handle_pixel/test.php +++ b/ext/handle_pixel/test.php @@ -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"); diff --git a/ext/handle_svg/test.php b/ext/handle_svg/test.php index 60652ffe..958f4cf1 100644 --- a/ext/handle_svg/test.php +++ b/ext/handle_svg/test.php @@ -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"); diff --git a/ext/help_pages/test.php b/ext/help_pages/test.php index 80a5de59..151f7455 100644 --- a/ext/help_pages/test.php +++ b/ext/help_pages/test.php @@ -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); diff --git a/ext/home/test.php b/ext/home/test.php index 3dece097..b4813cda 100644 --- a/ext/home/test.php +++ b/ext/home/test.php @@ -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); diff --git a/ext/image/test.php b/ext/image/test.php index 3b5821ab..d2eef83c 100644 --- a/ext/image/test.php +++ b/ext/image/test.php @@ -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"); diff --git a/ext/image_hash_ban/test.php b/ext/image_hash_ban/test.php index a5d6ff22..9ad35fde 100644 --- a/ext/image_hash_ban/test.php +++ b/ext/image_hash_ban/test.php @@ -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(); diff --git a/ext/image_view_counter/test.php b/ext/image_view_counter/test.php index fc6e1c84..61cf0100 100644 --- a/ext/image_view_counter/test.php +++ b/ext/image_view_counter/test.php @@ -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"); diff --git a/ext/index/test.php b/ext/index/test.php index ab6d16f9..f5542a2a 100644 --- a/ext/index/test.php +++ b/ext/index/test.php @@ -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()); diff --git a/ext/ipban/test.php b/ext/ipban/test.php index 6beb6ede..4be3e31d 100644 --- a/ext/ipban/test.php +++ b/ext/ipban/test.php @@ -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(); diff --git a/ext/link_image/test.php b/ext/link_image/test.php index 5681bf12..cf4df5ae 100644 --- a/ext/link_image/test.php +++ b/ext/link_image/test.php @@ -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"); diff --git a/ext/log_db/test.php b/ext/log_db/test.php index 9dac1ed0..2aa05ff7 100644 --- a/ext/log_db/test.php +++ b/ext/log_db/test.php @@ -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"); diff --git a/ext/mime/test.php b/ext/mime/test.php index 1c374a32..788e55f5 100644 --- a/ext/mime/test.php +++ b/ext/mime/test.php @@ -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); diff --git a/ext/not_a_tag/test.php b/ext/not_a_tag/test.php index 98202af7..87e40560 100644 --- a/ext/not_a_tag/test.php +++ b/ext/not_a_tag/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class NotATagTest extends ShimmiePHPUnitTestCase { - public function testUntags() + public function testUntags(): void { global $database; $database->execute("DELETE FROM untags"); diff --git a/ext/numeric_score/test.php b/ext/numeric_score/test.php index 44662acc..ab8819ed 100644 --- a/ext/numeric_score/test.php +++ b/ext/numeric_score/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class NumericScoreTest extends ShimmiePHPUnitTestCase { - public function testNumericScore() + public function testNumericScore(): void { global $user; diff --git a/ext/pm/test.php b/ext/pm/test.php index 7ad5595d..a0a7069b 100644 --- a/ext/pm/test.php +++ b/ext/pm/test.php @@ -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(); diff --git a/ext/pools/test.php b/ext/pools/test.php index a10f4cab..b368a6ac 100644 --- a/ext/pools/test.php +++ b/ext/pools/test.php @@ -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"); diff --git a/ext/random_image/test.php b/ext/random_image/test.php index d39391e6..44a00077 100644 --- a/ext/random_image/test.php +++ b/ext/random_image/test.php @@ -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; diff --git a/ext/rating/test.php b/ext/rating/test.php index 9f5ff724..7d4f744d 100644 --- a/ext/rating/test.php +++ b/ext/rating/test.php @@ -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; diff --git a/ext/regen_thumb/test.php b/ext/regen_thumb/test.php index 0e84b818..2eef060c 100644 --- a/ext/regen_thumb/test.php +++ b/ext/regen_thumb/test.php @@ -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"); diff --git a/ext/relationships/test.php b/ext/relationships/test.php index 61bd8336..6e310817 100644 --- a/ext/relationships/test.php +++ b/ext/relationships/test.php @@ -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)); diff --git a/ext/replace_file/test.php b/ext/replace_file/test.php index 2b537dce..adadbabf 100644 --- a/ext/replace_file/test.php +++ b/ext/replace_file/test.php @@ -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(); diff --git a/ext/report_image/test.php b/ext/report_image/test.php index 57996eaf..4d3f7d03 100644 --- a/ext/report_image/test.php +++ b/ext/report_image/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class ReportImageTest extends ShimmiePHPUnitTestCase { - public function testReportImage() + public function testReportImage(): void { global $config, $database, $user; diff --git a/ext/res_limit/test.php b/ext/res_limit/test.php index d8a51de4..618a15ff 100644 --- a/ext/res_limit/test.php +++ b/ext/res_limit/test.php @@ -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); diff --git a/ext/rss_comments/test.php b/ext/rss_comments/test.php index c3ce163e..868f143c 100644 --- a/ext/rss_comments/test.php +++ b/ext/rss_comments/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class RSSCommentsTest extends ShimmiePHPUnitTestCase { - public function testImageFeed() + public function testImageFeed(): void { global $user; $this->log_in_as_user(); diff --git a/ext/rss_images/test.php b/ext/rss_images/test.php index 89dc8acc..e23c40a4 100644 --- a/ext/rss_images/test.php +++ b/ext/rss_images/test.php @@ -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"); diff --git a/ext/setup/test.php b/ext/setup/test.php index e7eb169d..f732efb7 100644 --- a/ext/setup/test.php +++ b/ext/setup/test.php @@ -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'); diff --git a/ext/site_description/test.php b/ext/site_description/test.php index 8d07917f..b2af0dbf 100644 --- a/ext/site_description/test.php +++ b/ext/site_description/test.php @@ -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"); diff --git a/ext/sitemap/test.php b/ext/sitemap/test.php index b36e5a9c..ad5c0e03 100644 --- a/ext/sitemap/test.php +++ b/ext/sitemap/test.php @@ -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); diff --git a/ext/static_files/test.php b/ext/static_files/test.php index e26288b9..2255b0e0 100644 --- a/ext/static_files/test.php +++ b/ext/static_files/test.php @@ -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); diff --git a/ext/system/test.php b/ext/system/test.php index 170d3b08..3b259679 100644 --- a/ext/system/test.php +++ b/ext/system/test.php @@ -6,7 +6,7 @@ namespace Shimmie2; class SystemTest extends ShimmiePHPUnitTestCase { - public function testView() + public function testView(): void { global $page; $this->get_page("system"); diff --git a/ext/tag_edit/test.php b/ext/tag_edit/test.php index cd0f97a3..8a1034dd 100644 --- a/ext/tag_edit/test.php +++ b/ext/tag_edit/test.php @@ -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"); diff --git a/ext/tag_history/test.php b/ext/tag_history/test.php index e94f2900..4c3fc084 100644 --- a/ext/tag_history/test.php +++ b/ext/tag_history/test.php @@ -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"); diff --git a/ext/tag_list/test.php b/ext/tag_list/test.php index 1f04f98a..8d27af0a 100644 --- a/ext/tag_list/test.php +++ b/ext/tag_list/test.php @@ -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]); diff --git a/ext/tag_tools/test.php b/ext/tag_tools/test.php index 8d7cc505..41e88715 100644 --- a/ext/tag_tools/test.php +++ b/ext/tag_tools/test.php @@ -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; diff --git a/ext/tips/test.php b/ext/tips/test.php index 4a3d22dc..737da52f 100644 --- a/ext/tips/test.php +++ b/ext/tips/test.php @@ -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(); diff --git a/ext/upload/test.php b/ext/upload/test.php index 85ab424c..bdfb650b 100644 --- a/ext/upload/test.php +++ b/ext/upload/test.php @@ -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)); diff --git a/ext/user/test.php b/ext/user/test.php index 0761ecc8..2aa53d8e 100644 --- a/ext/user/test.php +++ b/ext/user/test.php @@ -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; diff --git a/ext/user_config/test.php b/ext/user_config/test.php index 5e12abbc..29d984e3 100644 --- a/ext/user_config/test.php +++ b/ext/user_config/test.php @@ -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"); diff --git a/ext/view/test.php b/ext/view/test.php index 37bdd2dc..cbb1e3c0 100644 --- a/ext/view/test.php +++ b/ext/view/test.php @@ -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"); diff --git a/ext/wiki/test.php b/ext/wiki/test.php index 52da9b00..86ef0f61 100644 --- a/ext/wiki/test.php +++ b/ext/wiki/test.php @@ -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(); diff --git a/ext/word_filter/test.php b/ext/word_filter/test.php index a5ba62c2..6786b192 100644 --- a/ext/word_filter/test.php +++ b/ext/word_filter/test.php @@ -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",