Bladeren bron

return type void is required as of PHPunit 7, breaking test compatibility with PHP < 7.1

El RIDO 5 jaren geleden
bovenliggende
commit
37a620df95

+ 2 - 2
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);

+ 2 - 2
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);

+ 2 - 2
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);

+ 1 - 1
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';

+ 2 - 2
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)) {

+ 2 - 2
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);

+ 2 - 2
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 */
     }

+ 2 - 2
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);

+ 2 - 2
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);

+ 2 - 2
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);

+ 2 - 2
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);

+ 2 - 2
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);

+ 0 - 10
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();

+ 1 - 6
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) {

+ 2 - 2
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);