diff --git a/tests/console/thumbnail_test.php b/tests/console/thumbnail_test.php index aa5e72bb82..68d4651757 100644 --- a/tests/console/thumbnail_test.php +++ b/tests/console/thumbnail_test.php @@ -97,11 +97,21 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case { parent::tearDown(); - unlink($this->phpbb_root_path . 'files/test_png_1'); - unlink($this->phpbb_root_path . 'files/test_png_2'); - unlink($this->phpbb_root_path . 'files/test_txt'); - unlink($this->phpbb_root_path . 'files/thumb_test_png_1'); - unlink($this->phpbb_root_path . 'files/thumb_test_png_2'); + $delete_files = [ + $this->phpbb_root_path . 'files/test_png_1', + $this->phpbb_root_path . 'files/test_png_2', + $this->phpbb_root_path . 'files/test_txt', + $this->phpbb_root_path . 'files/thumb_test_png_1', + $this->phpbb_root_path . 'files/thumb_test_png_2' + ]; + + foreach ($delete_files as $file) + { + if (file_exists($file)) + { + unlink($file); + } + } } public function test_thumbnails() diff --git a/tests/lint_test.php b/tests/lint_test.php index 55fc394170..e7904f9c83 100644 --- a/tests/lint_test.php +++ b/tests/lint_test.php @@ -52,12 +52,12 @@ class lint_test extends phpbb_test_case $this->assertEquals(0, $status, "PHP lint failed for $path:\n$output"); } - public function lint_data() + public static function lint_data(): array { - return $this->check(__DIR__ . '/..'); + return self::check(__DIR__ . '/..'); } - protected function check($root) + protected static function check($root): array { $files = array(); $dh = opendir($root); @@ -92,7 +92,7 @@ class lint_test extends phpbb_test_case __DIR__ . '/../node_modules', ))) { - $files = array_merge($files, $this->check($path)); + $files = array_merge($files, self::check($path)); } else if (substr($filename, strlen($filename)-4) == '.php') {