From 37a620df9519abb5057fd726457ffd3a2314e4ea Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 10 Oct 2020 12:22:20 +0200 Subject: [PATCH] return type void is required as of PHPunit 7, breaking test compatibility with PHP < 7.1 --- tst/ConfigurationTest.php | 4 ++-- tst/ConfigurationTestGenerator.php | 4 ++-- tst/ControllerTest.php | 4 ++-- tst/ControllerWithDbTest.php | 2 +- tst/Data/DatabaseTest.php | 4 ++-- tst/Data/FilesystemTest.php | 4 ++-- tst/I18nTest.php | 4 ++-- tst/JsonApiTest.php | 4 ++-- tst/ModelTest.php | 4 ++-- tst/Persistence/PurgeLimiterTest.php | 4 ++-- tst/Persistence/ServerSaltTest.php | 4 ++-- tst/Persistence/TrafficLimiterTest.php | 4 ++-- tst/RequestTest.php | 10 ---------- tst/ViewTest.php | 7 +------ tst/Vizhash16x16Test.php | 4 ++-- 15 files changed, 26 insertions(+), 41 deletions(-) diff --git a/tst/ConfigurationTest.php b/tst/ConfigurationTest.php index d52027a3..9afa829b 100644 --- a/tst/ConfigurationTest.php +++ b/tst/ConfigurationTest.php @@ -11,7 +11,7 @@ class ConfigurationTest extends TestCase private $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ Helper::confBackup(); @@ -26,7 +26,7 @@ class ConfigurationTest extends TestCase } } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ Helper::rmDir($this->_path); diff --git a/tst/ConfigurationTestGenerator.php b/tst/ConfigurationTestGenerator.php index 098fae7f..b5551c0a 100755 --- a/tst/ConfigurationTestGenerator.php +++ b/tst/ConfigurationTestGenerator.php @@ -423,7 +423,7 @@ class ConfigurationCombinationsTest extends TestCase private $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ Helper::confBackup(); @@ -434,7 +434,7 @@ class ConfigurationCombinationsTest extends TestCase $this->reset(); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ unlink(CONF); diff --git a/tst/ControllerTest.php b/tst/ControllerTest.php index 43556448..8610dd9b 100644 --- a/tst/ControllerTest.php +++ b/tst/ControllerTest.php @@ -13,7 +13,7 @@ class ControllerTest extends TestCase protected $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; @@ -21,7 +21,7 @@ class ControllerTest extends TestCase $this->reset(); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ unlink(CONF); diff --git a/tst/ControllerWithDbTest.php b/tst/ControllerWithDbTest.php index cfa08172..a8ecaf10 100644 --- a/tst/ControllerWithDbTest.php +++ b/tst/ControllerWithDbTest.php @@ -16,7 +16,7 @@ class ControllerWithDbTest extends ControllerTest ), ); - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; diff --git a/tst/Data/DatabaseTest.php b/tst/Data/DatabaseTest.php index 24bbfa7b..8820b341 100644 --- a/tst/Data/DatabaseTest.php +++ b/tst/Data/DatabaseTest.php @@ -17,14 +17,14 @@ class DatabaseTest extends TestCase 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION), ); - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_model = Database::getInstance($this->_options); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ if (is_dir($this->_path)) { diff --git a/tst/Data/FilesystemTest.php b/tst/Data/FilesystemTest.php index 1961a813..64b83962 100644 --- a/tst/Data/FilesystemTest.php +++ b/tst/Data/FilesystemTest.php @@ -11,7 +11,7 @@ class FilesystemTest extends TestCase private $_invalidPath; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; @@ -25,7 +25,7 @@ class FilesystemTest extends TestCase } } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ chmod($this->_invalidPath, 0700); diff --git a/tst/I18nTest.php b/tst/I18nTest.php index c527ac57..d5732420 100644 --- a/tst/I18nTest.php +++ b/tst/I18nTest.php @@ -7,7 +7,7 @@ class I18nTest extends TestCase { private $_translations = array(); - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_translations = json_decode( @@ -16,7 +16,7 @@ class I18nTest extends TestCase ); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ } diff --git a/tst/JsonApiTest.php b/tst/JsonApiTest.php index 4173b384..c51badef 100644 --- a/tst/JsonApiTest.php +++ b/tst/JsonApiTest.php @@ -12,7 +12,7 @@ class JsonApiTest extends TestCase protected $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; @@ -33,7 +33,7 @@ class JsonApiTest extends TestCase Helper::createIniFile(CONF, $options); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ unlink(CONF); diff --git a/tst/ModelTest.php b/tst/ModelTest.php index 4fbbb5b9..cbfd9cea 100644 --- a/tst/ModelTest.php +++ b/tst/ModelTest.php @@ -19,7 +19,7 @@ class ModelTest extends TestCase protected $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; @@ -45,7 +45,7 @@ class ModelTest extends TestCase $_SERVER['REMOTE_ADDR'] = '::1'; } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ unlink(CONF); diff --git a/tst/Persistence/PurgeLimiterTest.php b/tst/Persistence/PurgeLimiterTest.php index 68bac020..25f854a6 100644 --- a/tst/Persistence/PurgeLimiterTest.php +++ b/tst/Persistence/PurgeLimiterTest.php @@ -7,7 +7,7 @@ class PurgeLimiterTest extends TestCase { private $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; @@ -17,7 +17,7 @@ class PurgeLimiterTest extends TestCase PurgeLimiter::setPath($this->_path); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ Helper::rmDir($this->_path); diff --git a/tst/Persistence/ServerSaltTest.php b/tst/Persistence/ServerSaltTest.php index 34199d68..216e6c62 100644 --- a/tst/Persistence/ServerSaltTest.php +++ b/tst/Persistence/ServerSaltTest.php @@ -13,7 +13,7 @@ class ServerSaltTest extends TestCase private $_invalidFile; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; @@ -31,7 +31,7 @@ class ServerSaltTest extends TestCase $this->_invalidFile = $this->_invalidPath . DIRECTORY_SEPARATOR . 'salt.php'; } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ chmod($this->_invalidPath, 0700); diff --git a/tst/Persistence/TrafficLimiterTest.php b/tst/Persistence/TrafficLimiterTest.php index b2f5746a..027dbb25 100644 --- a/tst/Persistence/TrafficLimiterTest.php +++ b/tst/Persistence/TrafficLimiterTest.php @@ -7,14 +7,14 @@ class TrafficLimiterTest extends TestCase { private $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'trafficlimit'; TrafficLimiter::setPath($this->_path); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ Helper::rmDir($this->_path . DIRECTORY_SEPARATOR); diff --git a/tst/RequestTest.php b/tst/RequestTest.php index f323d8f1..bf7edfb3 100644 --- a/tst/RequestTest.php +++ b/tst/RequestTest.php @@ -5,16 +5,6 @@ use PrivateBin\Request; class RequestTest extends TestCase { - public function setUp() - { - /* Setup Routine */ - } - - public function tearDown() - { - /* Tear Down Routine */ - } - public function reset() { $_SERVER = array(); diff --git a/tst/ViewTest.php b/tst/ViewTest.php index d46f63bd..4094c03d 100644 --- a/tst/ViewTest.php +++ b/tst/ViewTest.php @@ -30,7 +30,7 @@ class ViewTest extends TestCase private $_content = array(); - public function setUp() + public function setUp(): void { /* Setup Routine */ $page = new View; @@ -92,11 +92,6 @@ class ViewTest extends TestCase } } - public function tearDown() - { - /* Tear Down Routine */ - } - public function testTemplateRendersCorrectly() { foreach ($this->_content as $template => $content) { diff --git a/tst/Vizhash16x16Test.php b/tst/Vizhash16x16Test.php index 95a29681..cc7da086 100644 --- a/tst/Vizhash16x16Test.php +++ b/tst/Vizhash16x16Test.php @@ -10,7 +10,7 @@ class Vizhash16x16Test extends TestCase private $_path; - public function setUp() + public function setUp(): void { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; @@ -21,7 +21,7 @@ class Vizhash16x16Test extends TestCase ServerSalt::setPath($this->_path); } - public function tearDown() + public function tearDown(): void { /* Tear Down Routine */ chmod($this->_path, 0700);