From f24111d1ead61bbb65cbec0680e595765ef94a52 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 3 Aug 2019 14:35:39 +1200 Subject: [PATCH 1/2] NEW: Upgrade to phpunit 8 This is the first version of phpunit that will work on php 7.4 without patches. --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index e68e37011ac..9c541d59fd9 100644 --- a/composer.json +++ b/composer.json @@ -54,8 +54,7 @@ "ext-xml": "*" }, "require-dev": { - "phpunit/phpunit": "7.1.3", - "sminnee/phpunit-mock-objects": "^3.4.5", + "phpunit/phpunit": "^8", "silverstripe/versioned": "^2" }, "provide": { From baacad006d6738d5fbcb6945a7cd3b22eaf91719 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 3 Aug 2019 15:16:41 +1200 Subject: [PATCH 2/2] Add void return type to testcase methods. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that any project will need to do this to work with phpunit 8, but it’s a pretty straightforward regex to do so. The following methods need to have “: void” added: setUp(), tearDown(), setUpBeforeClass(), tearDownAfterClass() It would be useful to build upgrader config for this if possible. --- docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md | 2 +- src/Dev/FunctionalTest.php | 4 ++-- src/Dev/SapphireTest.php | 8 ++++---- tests/php/Control/ControllerTest.php | 2 +- tests/php/Control/CookieTest.php | 2 +- tests/php/Control/DirectorTest.php | 6 +++--- tests/php/Control/Email/SwiftPluginTest.php | 2 +- tests/php/Control/HTTPCacheControlIntegrationTest.php | 2 +- tests/php/Control/HTTPTest.php | 2 +- .../php/Control/Middleware/CanonicalURLMiddlewareTest.php | 2 +- .../Control/Middleware/HTTPCacheControlMiddlewareTest.php | 2 +- tests/php/Control/Middleware/RateLimitMiddlewareTest.php | 2 +- tests/php/Control/RSS/RSSFeedTest.php | 4 ++-- tests/php/Control/SessionTest.php | 4 ++-- tests/php/Control/SimpleResourceURLGeneratorTest.php | 2 +- tests/php/Core/Cache/CacheTest.php | 2 +- tests/php/Core/Cache/RateLimiterTest.php | 2 +- tests/php/Core/ClassInfoTest.php | 2 +- tests/php/Core/ConvertTest.php | 4 ++-- tests/php/Core/CoreTest.php | 4 ++-- tests/php/Core/Injector/InjectorTest.php | 4 ++-- tests/php/Core/Manifest/ClassLoaderTest.php | 2 +- tests/php/Core/Manifest/ClassManifestTest.php | 2 +- tests/php/Core/Manifest/ConfigManifestTest.php | 4 ++-- tests/php/Core/Manifest/ModuleManifestTest.php | 2 +- tests/php/Core/Manifest/ModuleResourceTest.php | 2 +- tests/php/Core/Manifest/NamespacedClassManifestTest.php | 4 ++-- tests/php/Core/Manifest/PrioritySorterTest.php | 2 +- tests/php/Core/Manifest/ThemeResourceLoaderTest.php | 4 ++-- tests/php/Core/Manifest/VersionProviderTest.php | 2 +- tests/php/Core/MemoryLimitTest.php | 4 ++-- tests/php/Core/ObjectTest.php | 2 +- tests/php/Core/PhpSyntaxTest.php | 2 +- tests/php/Dev/BulkLoaderResultTest.php | 2 +- tests/php/Dev/CLIDebugViewTest.php | 2 +- tests/php/Dev/CSVParserTest.php | 2 +- tests/php/Dev/CsvBulkLoaderTest.php | 2 +- tests/php/Dev/DebugViewTest.php | 2 +- tests/php/Dev/DeprecationTest.php | 4 ++-- tests/php/Dev/DevAdminControllerTest.php | 2 +- tests/php/Dev/SSListExporterTest.php | 2 +- tests/php/Forms/CheckboxSetFieldMultiEnumTest.php | 4 ++-- tests/php/Forms/ConfirmedPasswordFieldTest.php | 2 +- tests/php/Forms/DateFieldDisabledTest.php | 2 +- tests/php/Forms/DateFieldTest.php | 2 +- tests/php/Forms/DatetimeFieldTest.php | 4 ++-- tests/php/Forms/FormFactoryTest.php | 2 +- tests/php/Forms/FormSchemaTest.php | 2 +- tests/php/Forms/FormTest.php | 2 +- tests/php/Forms/GridField/GridFieldActionMenuTest.php | 2 +- tests/php/Forms/GridField/GridFieldDeleteActionTest.php | 2 +- tests/php/Forms/GridField/GridFieldEditButtonTest.php | 2 +- tests/php/Forms/GridField/GridFieldExportButtonTest.php | 2 +- tests/php/Forms/GridField/GridFieldFilterHeaderTest.php | 2 +- tests/php/Forms/GridField/GridFieldLazyLoaderTest.php | 2 +- tests/php/Forms/GridField/GridFieldPaginatorTest.php | 2 +- tests/php/Forms/GridField/GridFieldPrintButtonTest.php | 2 +- tests/php/Forms/HTMLEditor/HTMLEditorConfigTest.php | 2 +- tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php | 4 ++-- .../php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php | 4 ++-- tests/php/Forms/TimeFieldTest.php | 2 +- tests/php/Forms/TreeMultiselectFieldTest.php | 2 +- tests/php/Logging/DebugViewFriendlyErrorFormatterTest.php | 2 +- tests/php/Logging/HTTPOutputHandlerTest.php | 2 +- tests/php/ORM/DBDateTest.php | 4 ++-- tests/php/ORM/DBDatetimeTest.php | 2 +- tests/php/ORM/DBHTMLTextTest.php | 4 ++-- tests/php/ORM/DBTextTest.php | 4 ++-- tests/php/ORM/DBTimeTest.php | 2 +- tests/php/ORM/DataObjectSchemaGenerationTest.php | 2 +- tests/php/ORM/DecimalTest.php | 2 +- tests/php/ORM/HierarchyCachingTest.php | 4 ++-- tests/php/ORM/HierarchyTest.php | 2 +- tests/php/ORM/ListDecoratorTest.php | 2 +- tests/php/ORM/ManyManyThroughListTest.php | 4 ++-- tests/php/ORM/MarkedSetTest.php | 2 +- tests/php/ORM/SQLSelectTest.php | 4 ++-- tests/php/ORM/Search/FulltextSearchableTest.php | 4 ++-- tests/php/ORM/TransactionTest.php | 6 +++--- tests/php/Security/BasicAuthTest.php | 2 +- tests/php/Security/GroupTest.php | 2 +- tests/php/Security/InheritedPermissionsFlusherTest.php | 2 +- tests/php/Security/InheritedPermissionsTest.php | 4 ++-- .../MemberAuthenticator/ChangePasswordHandlerTest.php | 2 +- tests/php/Security/MemberAuthenticatorTest.php | 4 ++-- tests/php/Security/MemberCsvBulkLoaderTest.php | 2 +- tests/php/Security/MemberTest.php | 4 ++-- tests/php/Security/PasswordEncryptorTest.php | 2 +- tests/php/Security/PasswordValidatorTest.php | 2 +- tests/php/Security/SecurityDefaultAdminTest.php | 4 ++-- tests/php/Security/SecurityTest.php | 2 +- tests/php/View/Parsers/ShortcodeParserTest.php | 4 ++-- tests/php/View/RequirementsTest.php | 4 ++-- tests/php/View/SSViewerTest.php | 4 ++-- tests/php/i18n/i18nTest.php | 4 ++-- tests/php/i18n/i18nTextCollectorTest.php | 4 ++-- 96 files changed, 134 insertions(+), 134 deletions(-) diff --git a/docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md b/docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md index 00808f3392d..55499266215 100644 --- a/docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md +++ b/docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md @@ -110,7 +110,7 @@ use SilverStripe\Dev\SapphireTest; class PageTest extends SapphireTest { - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/src/Dev/FunctionalTest.php b/src/Dev/FunctionalTest.php index e74a7d4b77a..eeea4513cc2 100644 --- a/src/Dev/FunctionalTest.php +++ b/src/Dev/FunctionalTest.php @@ -80,7 +80,7 @@ public function session() : Session return $this->mainSession->session(); } - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -112,7 +112,7 @@ protected function setUp() SecurityToken::disable(); } - protected function tearDown() + protected function tearDown(): void { SecurityToken::enable(); unset($this->mainSession); diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index 80363b858ea..9743a8c9cfe 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -261,7 +261,7 @@ public function getRequireDefaultRecordsFrom() * * User code should call parent::setUp() before custom setup code */ - protected function setUp() + protected function setUp(): void { if (!defined('FRAMEWORK_PATH')) { trigger_error( @@ -373,7 +373,7 @@ protected function currentTestDisablesDatabase() : bool * * @throws Exception */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // Start tests static::start(); @@ -402,7 +402,7 @@ public static function setUpBeforeClass() * * User code should call parent::tearDownAfterClass() after custom tear down code */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { // Call state helpers static::$state->tearDownOnce(static::class); @@ -567,7 +567,7 @@ protected function getCurrentRelativePath() : string * * User code should call parent::tearDown() after custom tear down code */ - protected function tearDown() + protected function tearDown(): void { // Reset mocked datetime DBDatetime::clear_mock_now(); diff --git a/tests/php/Control/ControllerTest.php b/tests/php/Control/ControllerTest.php index 955aa95f445..19136141747 100644 --- a/tests/php/Control/ControllerTest.php +++ b/tests/php/Control/ControllerTest.php @@ -40,7 +40,7 @@ class ControllerTest extends FunctionalTest UnsecuredController::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); Director::config()->update('alternate_base_url', '/'); diff --git a/tests/php/Control/CookieTest.php b/tests/php/Control/CookieTest.php index 160fe875405..31c451b10a5 100644 --- a/tests/php/Control/CookieTest.php +++ b/tests/php/Control/CookieTest.php @@ -10,7 +10,7 @@ class CookieTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); Injector::inst()->registerService(new CookieJar($_COOKIE), 'SilverStripe\\Control\\Cookie_Backend'); diff --git a/tests/php/Control/DirectorTest.php b/tests/php/Control/DirectorTest.php index ac8552c7869..37ae33cb160 100644 --- a/tests/php/Control/DirectorTest.php +++ b/tests/php/Control/DirectorTest.php @@ -29,7 +29,7 @@ class DirectorTest extends SapphireTest private $originalEnvType; - protected function setUp() + protected function setUp(): void { parent::setUp(); Director::config()->set('alternate_base_url', 'http://www.mysite.com:9090/'); @@ -44,10 +44,10 @@ protected function setUp() $this->expectedRedirect = null; } - protected function tearDown(...$args) + protected function tearDown(): void { Environment::setEnv('SS_ENVIRONMENT_TYPE', $this->originalEnvType); - parent::tearDown(...$args); + parent::tearDown(); } protected function getExtraRoutes() diff --git a/tests/php/Control/Email/SwiftPluginTest.php b/tests/php/Control/Email/SwiftPluginTest.php index d4b745f6128..aa9abc966e3 100644 --- a/tests/php/Control/Email/SwiftPluginTest.php +++ b/tests/php/Control/Email/SwiftPluginTest.php @@ -9,7 +9,7 @@ class SwiftPluginTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Control/HTTPCacheControlIntegrationTest.php b/tests/php/Control/HTTPCacheControlIntegrationTest.php index 94b0f152793..40d8fffcabb 100644 --- a/tests/php/Control/HTTPCacheControlIntegrationTest.php +++ b/tests/php/Control/HTTPCacheControlIntegrationTest.php @@ -16,7 +16,7 @@ class HTTPCacheControlIntegrationTest extends FunctionalTest RuleController::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); HTTPCacheControlMiddleware::config() diff --git a/tests/php/Control/HTTPTest.php b/tests/php/Control/HTTPTest.php index 70a0e005c7b..a17042385fe 100644 --- a/tests/php/Control/HTTPTest.php +++ b/tests/php/Control/HTTPTest.php @@ -19,7 +19,7 @@ */ class HTTPTest extends FunctionalTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); // Set to disabled at null forcing level diff --git a/tests/php/Control/Middleware/CanonicalURLMiddlewareTest.php b/tests/php/Control/Middleware/CanonicalURLMiddlewareTest.php index e4e3caa56f8..4d9774e67c7 100644 --- a/tests/php/Control/Middleware/CanonicalURLMiddlewareTest.php +++ b/tests/php/Control/Middleware/CanonicalURLMiddlewareTest.php @@ -16,7 +16,7 @@ class CanonicalURLMiddlewareTest extends SapphireTest */ protected $middleware; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Control/Middleware/HTTPCacheControlMiddlewareTest.php b/tests/php/Control/Middleware/HTTPCacheControlMiddlewareTest.php index 1a8b3e4b24b..5f6cf7cd4be 100644 --- a/tests/php/Control/Middleware/HTTPCacheControlMiddlewareTest.php +++ b/tests/php/Control/Middleware/HTTPCacheControlMiddlewareTest.php @@ -8,7 +8,7 @@ class HTTPCacheControlMiddlewareTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); // Set to disabled at null forcing level diff --git a/tests/php/Control/Middleware/RateLimitMiddlewareTest.php b/tests/php/Control/Middleware/RateLimitMiddlewareTest.php index 23da5723914..23bda6331b7 100644 --- a/tests/php/Control/Middleware/RateLimitMiddlewareTest.php +++ b/tests/php/Control/Middleware/RateLimitMiddlewareTest.php @@ -17,7 +17,7 @@ class RateLimitMiddlewareTest extends FunctionalTest TestController::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); DBDatetime::set_mock_now('2017-09-27 00:00:00'); diff --git a/tests/php/Control/RSS/RSSFeedTest.php b/tests/php/Control/RSS/RSSFeedTest.php index 9e41abca07a..496b6ce7da1 100644 --- a/tests/php/Control/RSS/RSSFeedTest.php +++ b/tests/php/Control/RSS/RSSFeedTest.php @@ -99,7 +99,7 @@ public function testRenderWithTemplate() $this->assertNotContains('Test Custom Template', $content); } - protected function setUp() + protected function setUp(): void { parent::setUp(); Config::modify()->set(Director::class, 'alternate_base_url', '/'); @@ -116,7 +116,7 @@ function () { ); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $_SERVER['HTTP_HOST'] = self::$original_host; diff --git a/tests/php/Control/SessionTest.php b/tests/php/Control/SessionTest.php index 6020df9a300..f48996e4d7e 100644 --- a/tests/php/Control/SessionTest.php +++ b/tests/php/Control/SessionTest.php @@ -18,10 +18,10 @@ class SessionTest extends SapphireTest */ protected $session = null; - protected function setUp() + protected function setUp(): void { $this->session = new Session([]); - return parent::setUp(); + parent::setUp(); } /** diff --git a/tests/php/Control/SimpleResourceURLGeneratorTest.php b/tests/php/Control/SimpleResourceURLGeneratorTest.php index 97d5195490d..8e84b455de0 100644 --- a/tests/php/Control/SimpleResourceURLGeneratorTest.php +++ b/tests/php/Control/SimpleResourceURLGeneratorTest.php @@ -11,7 +11,7 @@ class SimpleResourceURLGeneratorTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); Director::config()->set( diff --git a/tests/php/Core/Cache/CacheTest.php b/tests/php/Core/Cache/CacheTest.php index d034ed977b8..1853acf881f 100644 --- a/tests/php/Core/Cache/CacheTest.php +++ b/tests/php/Core/Cache/CacheTest.php @@ -13,7 +13,7 @@ class CacheTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Core/Cache/RateLimiterTest.php b/tests/php/Core/Cache/RateLimiterTest.php index ec2a80527a9..011020067b7 100644 --- a/tests/php/Core/Cache/RateLimiterTest.php +++ b/tests/php/Core/Cache/RateLimiterTest.php @@ -11,7 +11,7 @@ class RateLimiterTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); DBDatetime::set_mock_now('2017-09-27 00:00:00'); diff --git a/tests/php/Core/ClassInfoTest.php b/tests/php/Core/ClassInfoTest.php index 1883451ad8a..619172be0a1 100644 --- a/tests/php/Core/ClassInfoTest.php +++ b/tests/php/Core/ClassInfoTest.php @@ -30,7 +30,7 @@ class ClassInfoTest extends SapphireTest WithRelation::class, ); - protected function setUp() + protected function setUp(): void { parent::setUp(); ClassInfo::reset_db_cache(); diff --git a/tests/php/Core/ConvertTest.php b/tests/php/Core/ConvertTest.php index 0f831fa6e1e..8ff86781500 100644 --- a/tests/php/Core/ConvertTest.php +++ b/tests/php/Core/ConvertTest.php @@ -19,14 +19,14 @@ class ConvertTest extends SapphireTest private $previousLocaleSetting = null; - public function setUp() + public function setUp(): void { parent::setUp(); // clear the previous locale setting $this->previousLocaleSetting = null; } - public function tearDown() + public function tearDown(): void { parent::tearDown(); // If a test sets the locale, reset it on teardown diff --git a/tests/php/Core/CoreTest.php b/tests/php/Core/CoreTest.php index a71e061dbc3..60c599a7847 100644 --- a/tests/php/Core/CoreTest.php +++ b/tests/php/Core/CoreTest.php @@ -15,7 +15,7 @@ class CoreTest extends SapphireTest protected $tempPath; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->tempPath = Director::baseFolder() . DIRECTORY_SEPARATOR . 'silverstripe-cache'; @@ -52,7 +52,7 @@ public function testGetTempPathInProject() } } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $user = TempFolder::getTempFolderUsername(); diff --git a/tests/php/Core/Injector/InjectorTest.php b/tests/php/Core/Injector/InjectorTest.php index d62c4079490..bcda2fe21ff 100644 --- a/tests/php/Core/Injector/InjectorTest.php +++ b/tests/php/Core/Injector/InjectorTest.php @@ -44,14 +44,14 @@ class InjectorTest extends SapphireTest protected $nestingLevel = 0; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->nestingLevel = 0; } - protected function tearDown() + protected function tearDown(): void { while ($this->nestingLevel > 0) { diff --git a/tests/php/Core/Manifest/ClassLoaderTest.php b/tests/php/Core/Manifest/ClassLoaderTest.php index 1525fdc3bbe..d0e3d9f8528 100644 --- a/tests/php/Core/Manifest/ClassLoaderTest.php +++ b/tests/php/Core/Manifest/ClassLoaderTest.php @@ -32,7 +32,7 @@ class ClassLoaderTest extends SapphireTest */ protected $testManifest2; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Core/Manifest/ClassManifestTest.php b/tests/php/Core/Manifest/ClassManifestTest.php index 7033fc8bacb..be82bb8ef01 100644 --- a/tests/php/Core/Manifest/ClassManifestTest.php +++ b/tests/php/Core/Manifest/ClassManifestTest.php @@ -27,7 +27,7 @@ class ClassManifestTest extends SapphireTest */ protected $manifestTests; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Core/Manifest/ConfigManifestTest.php b/tests/php/Core/Manifest/ConfigManifestTest.php index b6fda78dd38..2c4362e43ac 100644 --- a/tests/php/Core/Manifest/ConfigManifestTest.php +++ b/tests/php/Core/Manifest/ConfigManifestTest.php @@ -13,7 +13,7 @@ class ConfigManifestTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -22,7 +22,7 @@ protected function setUp() ModuleLoader::inst()->pushManifest($moduleManifest); } - protected function tearDown() + protected function tearDown(): void { ModuleLoader::inst()->popManifest(); parent::tearDown(); diff --git a/tests/php/Core/Manifest/ModuleManifestTest.php b/tests/php/Core/Manifest/ModuleManifestTest.php index 2c1c8fa1aa7..5e9c735ca9c 100644 --- a/tests/php/Core/Manifest/ModuleManifestTest.php +++ b/tests/php/Core/Manifest/ModuleManifestTest.php @@ -17,7 +17,7 @@ class ModuleManifestTest extends SapphireTest */ protected $manifest; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Core/Manifest/ModuleResourceTest.php b/tests/php/Core/Manifest/ModuleResourceTest.php index d0d629fe860..c733b636c0f 100644 --- a/tests/php/Core/Manifest/ModuleResourceTest.php +++ b/tests/php/Core/Manifest/ModuleResourceTest.php @@ -18,7 +18,7 @@ class ModuleResourceTest extends SapphireTest */ protected $manifest; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Core/Manifest/NamespacedClassManifestTest.php b/tests/php/Core/Manifest/NamespacedClassManifestTest.php index ef48eae1a3f..5d69caf06ac 100644 --- a/tests/php/Core/Manifest/NamespacedClassManifestTest.php +++ b/tests/php/Core/Manifest/NamespacedClassManifestTest.php @@ -25,7 +25,7 @@ class NamespacedClassManifestTest extends SapphireTest */ protected $manifest; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -35,7 +35,7 @@ protected function setUp() ClassLoader::inst()->pushManifest($this->manifest, false); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); ClassLoader::inst()->popManifest(); diff --git a/tests/php/Core/Manifest/PrioritySorterTest.php b/tests/php/Core/Manifest/PrioritySorterTest.php index 8c1f2c345e4..924378d1a00 100644 --- a/tests/php/Core/Manifest/PrioritySorterTest.php +++ b/tests/php/Core/Manifest/PrioritySorterTest.php @@ -12,7 +12,7 @@ class PrioritySorterTest extends SapphireTest */ protected $sorter; - public function setUp() + public function setUp(): void { parent::setUp(); $modules = [ diff --git a/tests/php/Core/Manifest/ThemeResourceLoaderTest.php b/tests/php/Core/Manifest/ThemeResourceLoaderTest.php index abe0d65b74e..7918cb045c1 100644 --- a/tests/php/Core/Manifest/ThemeResourceLoaderTest.php +++ b/tests/php/Core/Manifest/ThemeResourceLoaderTest.php @@ -33,7 +33,7 @@ class ThemeResourceLoaderTest extends SapphireTest /** * Set up manifest before each test */ - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -60,7 +60,7 @@ protected function setUp() ThemeResourceLoader::flush(); } - protected function tearDown() + protected function tearDown(): void { ModuleLoader::inst()->popManifest(); parent::tearDown(); diff --git a/tests/php/Core/Manifest/VersionProviderTest.php b/tests/php/Core/Manifest/VersionProviderTest.php index d521aca3a2f..a3504ec1532 100644 --- a/tests/php/Core/Manifest/VersionProviderTest.php +++ b/tests/php/Core/Manifest/VersionProviderTest.php @@ -13,7 +13,7 @@ class VersionProviderTest extends SapphireTest */ protected $provider; - public function setUp() + public function setUp(): void { parent::setUp(); $this->provider = new VersionProvider; diff --git a/tests/php/Core/MemoryLimitTest.php b/tests/php/Core/MemoryLimitTest.php index 842e77645f5..562e349ce16 100644 --- a/tests/php/Core/MemoryLimitTest.php +++ b/tests/php/Core/MemoryLimitTest.php @@ -12,7 +12,7 @@ class MemoryLimitTest extends SapphireTest protected $origMemLimit; protected $origTimeLimit; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -29,7 +29,7 @@ protected function setUp() } } - protected function tearDown() + protected function tearDown(): void { if (!in_array('suhosin', get_loaded_extensions())) { ini_set('memory_limit', $this->origMemLimit); diff --git a/tests/php/Core/ObjectTest.php b/tests/php/Core/ObjectTest.php index b3971e98703..23b8db319f4 100644 --- a/tests/php/Core/ObjectTest.php +++ b/tests/php/Core/ObjectTest.php @@ -31,7 +31,7 @@ class ObjectTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); Injector::inst()->unregisterObjects([ diff --git a/tests/php/Core/PhpSyntaxTest.php b/tests/php/Core/PhpSyntaxTest.php index 605365a9076..f87969ce898 100644 --- a/tests/php/Core/PhpSyntaxTest.php +++ b/tests/php/Core/PhpSyntaxTest.php @@ -9,7 +9,7 @@ */ class PhpSyntaxTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->markTestSkipped('This needs to be written to include only core php files, not test/thirdparty files'); diff --git a/tests/php/Dev/BulkLoaderResultTest.php b/tests/php/Dev/BulkLoaderResultTest.php index 9c60db0adfe..34f69610b33 100644 --- a/tests/php/Dev/BulkLoaderResultTest.php +++ b/tests/php/Dev/BulkLoaderResultTest.php @@ -13,7 +13,7 @@ class BulkLoaderResultTest extends SapphireTest Player::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); Player::create(array('Name' => 'Vincent', 'Status' => 'Available'))->write(); diff --git a/tests/php/Dev/CLIDebugViewTest.php b/tests/php/Dev/CLIDebugViewTest.php index 7d8d06661e0..20241dcafc0 100644 --- a/tests/php/Dev/CLIDebugViewTest.php +++ b/tests/php/Dev/CLIDebugViewTest.php @@ -10,7 +10,7 @@ class CLIDebugViewTest extends SapphireTest { protected $caller = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Dev/CSVParserTest.php b/tests/php/Dev/CSVParserTest.php index 2a48c27dc01..7fbbc083ee6 100644 --- a/tests/php/Dev/CSVParserTest.php +++ b/tests/php/Dev/CSVParserTest.php @@ -15,7 +15,7 @@ class CSVParserTest extends SapphireTest */ protected $csvPath = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->csvPath = __DIR__ . '/CsvBulkLoaderTest/csv/'; diff --git a/tests/php/Dev/CsvBulkLoaderTest.php b/tests/php/Dev/CsvBulkLoaderTest.php index 8885e58a98c..771a2b7b674 100644 --- a/tests/php/Dev/CsvBulkLoaderTest.php +++ b/tests/php/Dev/CsvBulkLoaderTest.php @@ -30,7 +30,7 @@ class CsvBulkLoaderTest extends SapphireTest */ protected $csvPath = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->csvPath = __DIR__ . '/CsvBulkLoaderTest/csv/'; diff --git a/tests/php/Dev/DebugViewTest.php b/tests/php/Dev/DebugViewTest.php index edafe8bffb2..b0158646a6a 100644 --- a/tests/php/Dev/DebugViewTest.php +++ b/tests/php/Dev/DebugViewTest.php @@ -10,7 +10,7 @@ class DebugViewTest extends SapphireTest { protected $caller = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Dev/DeprecationTest.php b/tests/php/Dev/DeprecationTest.php index 2df4ce50162..cccaaa7ddb3 100644 --- a/tests/php/Dev/DeprecationTest.php +++ b/tests/php/Dev/DeprecationTest.php @@ -11,7 +11,7 @@ class DeprecationTest extends SapphireTest static $originalVersionInfo; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -20,7 +20,7 @@ protected function setUp() Deprecation::set_enabled(true); } - protected function tearDown() + protected function tearDown(): void { Deprecation::restore_settings(self::$originalVersionInfo); parent::tearDown(); diff --git a/tests/php/Dev/DevAdminControllerTest.php b/tests/php/Dev/DevAdminControllerTest.php index a27a118f95f..f1e7b3e5690 100644 --- a/tests/php/Dev/DevAdminControllerTest.php +++ b/tests/php/Dev/DevAdminControllerTest.php @@ -14,7 +14,7 @@ class DevAdminControllerTest extends FunctionalTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Dev/SSListExporterTest.php b/tests/php/Dev/SSListExporterTest.php index ecc47c0b92e..11c0f269aba 100644 --- a/tests/php/Dev/SSListExporterTest.php +++ b/tests/php/Dev/SSListExporterTest.php @@ -18,7 +18,7 @@ class SSListExporterTest extends SapphireTest */ private $exporter; - public function setUp() + public function setUp(): void { parent::setUp(); $this->exporter = new SSListExporter(); diff --git a/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php b/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php index 3eadb69993d..cefea60dadb 100644 --- a/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php +++ b/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php @@ -26,7 +26,7 @@ public static function getExtraDataObjects() } } - public function setUp() + public function setUp(): void { if (!(DB::get_conn() instanceof MySQLDatabase)) { $this->markTestSkipped('DBMultiEnum only supported by MySQL'); @@ -35,7 +35,7 @@ public function setUp() parent::setUp(); } - public function tearDown() + public function tearDown(): void { if (!(DB::get_conn() instanceof MySQLDatabase)) { return; diff --git a/tests/php/Forms/ConfirmedPasswordFieldTest.php b/tests/php/Forms/ConfirmedPasswordFieldTest.php index 2f4face19c6..49bea2d0739 100644 --- a/tests/php/Forms/ConfirmedPasswordFieldTest.php +++ b/tests/php/Forms/ConfirmedPasswordFieldTest.php @@ -16,7 +16,7 @@ class ConfirmedPasswordFieldTest extends SapphireTest { protected $usesDatabase = true; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Forms/DateFieldDisabledTest.php b/tests/php/Forms/DateFieldDisabledTest.php index 6fffdcd1364..b2ce9b60afb 100644 --- a/tests/php/Forms/DateFieldDisabledTest.php +++ b/tests/php/Forms/DateFieldDisabledTest.php @@ -12,7 +12,7 @@ */ class DateFieldDisabledTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/Forms/DateFieldTest.php b/tests/php/Forms/DateFieldTest.php index 87065fc8a94..74c0a64b475 100644 --- a/tests/php/Forms/DateFieldTest.php +++ b/tests/php/Forms/DateFieldTest.php @@ -16,7 +16,7 @@ */ class DateFieldTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/Forms/DatetimeFieldTest.php b/tests/php/Forms/DatetimeFieldTest.php index 37fe628e3c4..a2c74798866 100644 --- a/tests/php/Forms/DatetimeFieldTest.php +++ b/tests/php/Forms/DatetimeFieldTest.php @@ -17,7 +17,7 @@ class DatetimeFieldTest extends SapphireTest { protected $timezone = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); i18n::set_locale('en_NZ'); @@ -26,7 +26,7 @@ protected function setUp() $this->timezone = date_default_timezone_get(); } - protected function tearDown() + protected function tearDown(): void { DBDatetime::clear_mock_now(); date_default_timezone_set($this->timezone); diff --git a/tests/php/Forms/FormFactoryTest.php b/tests/php/Forms/FormFactoryTest.php index 67242c3e9a6..17367a3d293 100644 --- a/tests/php/Forms/FormFactoryTest.php +++ b/tests/php/Forms/FormFactoryTest.php @@ -28,7 +28,7 @@ public static function getExtraDataObjects() return []; } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/php/Forms/FormSchemaTest.php b/tests/php/Forms/FormSchemaTest.php index 7af4d8d70e1..8abb38f13ce 100644 --- a/tests/php/Forms/FormSchemaTest.php +++ b/tests/php/Forms/FormSchemaTest.php @@ -20,7 +20,7 @@ */ class FormSchemaTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Forms/FormTest.php b/tests/php/Forms/FormTest.php index 2226393b895..7bcd6049e06 100644 --- a/tests/php/Forms/FormTest.php +++ b/tests/php/Forms/FormTest.php @@ -56,7 +56,7 @@ class FormTest extends FunctionalTest protected static $disable_themes = true; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Forms/GridField/GridFieldActionMenuTest.php b/tests/php/Forms/GridField/GridFieldActionMenuTest.php index d68cc8aa54b..af2fdee0973 100644 --- a/tests/php/Forms/GridField/GridFieldActionMenuTest.php +++ b/tests/php/Forms/GridField/GridFieldActionMenuTest.php @@ -55,7 +55,7 @@ class GridFieldActionMenuTest extends SapphireTest Permissions::class, ); - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php index 2b5c2844dd2..76c4bb009ed 100644 --- a/tests/php/Forms/GridField/GridFieldDeleteActionTest.php +++ b/tests/php/Forms/GridField/GridFieldDeleteActionTest.php @@ -56,7 +56,7 @@ class GridFieldDeleteActionTest extends SapphireTest Permissions::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldEditButtonTest.php b/tests/php/Forms/GridField/GridFieldEditButtonTest.php index 70c9842d3c6..ffcb9a57f9a 100644 --- a/tests/php/Forms/GridField/GridFieldEditButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldEditButtonTest.php @@ -52,7 +52,7 @@ class GridFieldEditButtonTest extends SapphireTest Permissions::class, ); - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldExportButtonTest.php b/tests/php/Forms/GridField/GridFieldExportButtonTest.php index 600bb2e061f..69fc1ab7a61 100644 --- a/tests/php/Forms/GridField/GridFieldExportButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldExportButtonTest.php @@ -35,7 +35,7 @@ class GridFieldExportButtonTest extends SapphireTest NoView::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php b/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php index 0c221ba36d8..007ee4da273 100644 --- a/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php +++ b/tests/php/Forms/GridField/GridFieldFilterHeaderTest.php @@ -50,7 +50,7 @@ class GridFieldFilterHeaderTest extends SapphireTest Mom::class, ); - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php b/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php index 553f6ae0364..3b627acbb5f 100644 --- a/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php +++ b/tests/php/Forms/GridField/GridFieldLazyLoaderTest.php @@ -44,7 +44,7 @@ class GridFieldLazyLoaderTest extends SapphireTest Team::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->list = DataList::create(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldPaginatorTest.php b/tests/php/Forms/GridField/GridFieldPaginatorTest.php index 3b56ff0db97..1addc5a515f 100644 --- a/tests/php/Forms/GridField/GridFieldPaginatorTest.php +++ b/tests/php/Forms/GridField/GridFieldPaginatorTest.php @@ -49,7 +49,7 @@ class GridFieldPaginatorTest extends FunctionalTest Cheerleader::class, ); - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->list = new DataList(Team::class); diff --git a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php index 25c64a9b5d6..83743f8e45b 100644 --- a/tests/php/Forms/GridField/GridFieldPrintButtonTest.php +++ b/tests/php/Forms/GridField/GridFieldPrintButtonTest.php @@ -19,7 +19,7 @@ class GridFieldPrintButtonTest extends SapphireTest TestObject::class, ); - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Forms/HTMLEditor/HTMLEditorConfigTest.php b/tests/php/Forms/HTMLEditor/HTMLEditorConfigTest.php index 7c6cb8fa618..184558ea457 100644 --- a/tests/php/Forms/HTMLEditor/HTMLEditorConfigTest.php +++ b/tests/php/Forms/HTMLEditor/HTMLEditorConfigTest.php @@ -18,7 +18,7 @@ class HTMLEditorConfigTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php b/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php index e38af2f49f5..3b77d687ea7 100644 --- a/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php +++ b/tests/php/Forms/HTMLEditor/HTMLEditorFieldTest.php @@ -25,7 +25,7 @@ class HTMLEditorFieldTest extends FunctionalTest TestObject::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -55,7 +55,7 @@ protected function setUp() } } - protected function tearDown() + protected function tearDown(): void { TestAssetStore::reset(); parent::tearDown(); diff --git a/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php b/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php index ebc5c7e8a7c..0dcdd321d27 100644 --- a/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php +++ b/tests/php/Forms/HTMLEditor/TinyMCECombinedGeneratorTest.php @@ -13,7 +13,7 @@ class TinyMCECombinedGeneratorTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -27,7 +27,7 @@ protected function setUp() ->set('editor_css', [ 'mycode/editor.css' ]); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); // Flush test configs diff --git a/tests/php/Forms/TimeFieldTest.php b/tests/php/Forms/TimeFieldTest.php index 65e40fb22f6..1092014125b 100644 --- a/tests/php/Forms/TimeFieldTest.php +++ b/tests/php/Forms/TimeFieldTest.php @@ -11,7 +11,7 @@ class TimeFieldTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/Forms/TreeMultiselectFieldTest.php b/tests/php/Forms/TreeMultiselectFieldTest.php index a53b269a5c1..5e3b25d3542 100644 --- a/tests/php/Forms/TreeMultiselectFieldTest.php +++ b/tests/php/Forms/TreeMultiselectFieldTest.php @@ -56,7 +56,7 @@ class TreeMultiselectFieldTest extends SapphireTest */ protected $fieldValue; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Logging/DebugViewFriendlyErrorFormatterTest.php b/tests/php/Logging/DebugViewFriendlyErrorFormatterTest.php index 0b40bcf3853..e1951396075 100644 --- a/tests/php/Logging/DebugViewFriendlyErrorFormatterTest.php +++ b/tests/php/Logging/DebugViewFriendlyErrorFormatterTest.php @@ -11,7 +11,7 @@ class DebugViewFriendlyErrorFormatterTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); Email::config()->set('admin_email', 'testy@mctest.face'); diff --git a/tests/php/Logging/HTTPOutputHandlerTest.php b/tests/php/Logging/HTTPOutputHandlerTest.php index 198361bf5ab..4dfa8009db7 100644 --- a/tests/php/Logging/HTTPOutputHandlerTest.php +++ b/tests/php/Logging/HTTPOutputHandlerTest.php @@ -12,7 +12,7 @@ class HTTPOutputHandlerTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/ORM/DBDateTest.php b/tests/php/ORM/DBDateTest.php index d727a01431d..9aae448a2d6 100644 --- a/tests/php/ORM/DBDateTest.php +++ b/tests/php/ORM/DBDateTest.php @@ -15,7 +15,7 @@ class DBDateTest extends SapphireTest { protected $oldError = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->oldError = error_reporting(); @@ -24,7 +24,7 @@ protected function setUp() i18n::set_locale('en_NZ'); } - protected function tearDown() + protected function tearDown(): void { $this->restoreNotices(); parent::tearDown(); diff --git a/tests/php/ORM/DBDatetimeTest.php b/tests/php/ORM/DBDatetimeTest.php index defb31f9d02..b2317b4350d 100644 --- a/tests/php/ORM/DBDatetimeTest.php +++ b/tests/php/ORM/DBDatetimeTest.php @@ -11,7 +11,7 @@ */ class DBDatetimeTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/ORM/DBHTMLTextTest.php b/tests/php/ORM/DBHTMLTextTest.php index 7281e615667..6f5908449a0 100644 --- a/tests/php/ORM/DBHTMLTextTest.php +++ b/tests/php/ORM/DBHTMLTextTest.php @@ -17,7 +17,7 @@ class DBHTMLTextTest extends SapphireTest private $previousLocaleSetting = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -30,7 +30,7 @@ protected function setUp() ShortcodeParser::set_active('htmltest'); } - protected function tearDown() + protected function tearDown(): void { // If a test sets the locale, reset it on teardown diff --git a/tests/php/ORM/DBTextTest.php b/tests/php/ORM/DBTextTest.php index bde17d05fe7..f00431cd406 100644 --- a/tests/php/ORM/DBTextTest.php +++ b/tests/php/ORM/DBTextTest.php @@ -14,14 +14,14 @@ class DBTextTest extends SapphireTest private $previousLocaleSetting = null; - public function setUp() + public function setUp(): void { parent::setUp(); // clear the previous locale setting $this->previousLocaleSetting = null; } - public function tearDown() + public function tearDown(): void { parent::tearDown(); // If a test sets the locale, reset it on teardown diff --git a/tests/php/ORM/DBTimeTest.php b/tests/php/ORM/DBTimeTest.php index 80c2f802924..5b0fe706ccf 100644 --- a/tests/php/ORM/DBTimeTest.php +++ b/tests/php/ORM/DBTimeTest.php @@ -10,7 +10,7 @@ class DBTimeTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); i18n::set_locale('en_NZ'); diff --git a/tests/php/ORM/DataObjectSchemaGenerationTest.php b/tests/php/ORM/DataObjectSchemaGenerationTest.php index 0d36bb53d6e..01c4c4a0abb 100644 --- a/tests/php/ORM/DataObjectSchemaGenerationTest.php +++ b/tests/php/ORM/DataObjectSchemaGenerationTest.php @@ -20,7 +20,7 @@ class DataObjectSchemaGenerationTest extends SapphireTest SortedObject::class, ); - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { // Start tests static::start(); diff --git a/tests/php/ORM/DecimalTest.php b/tests/php/ORM/DecimalTest.php index aa6d99b9ca8..70129904919 100644 --- a/tests/php/ORM/DecimalTest.php +++ b/tests/php/ORM/DecimalTest.php @@ -19,7 +19,7 @@ class DecimalTest extends SapphireTest DecimalTest\TestObject::class ); - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->testDataObject = $this->objFromFixture(DecimalTest\TestObject::class, 'test-dataobject'); diff --git a/tests/php/ORM/HierarchyCachingTest.php b/tests/php/ORM/HierarchyCachingTest.php index 311e38897f5..60fed940bb3 100644 --- a/tests/php/ORM/HierarchyCachingTest.php +++ b/tests/php/ORM/HierarchyCachingTest.php @@ -24,13 +24,13 @@ class HierachyCacheTest extends SapphireTest HideTestSubObject::class, ); - public function setUp() + public function setUp(): void { parent::setUp(); TestObject::singleton()->flushCache(); } - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); HideTestObject::config()->update( diff --git a/tests/php/ORM/HierarchyTest.php b/tests/php/ORM/HierarchyTest.php index 51780bfba5a..69202bb971d 100644 --- a/tests/php/ORM/HierarchyTest.php +++ b/tests/php/ORM/HierarchyTest.php @@ -25,7 +25,7 @@ public static function getExtraDataObjects() return []; } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/php/ORM/ListDecoratorTest.php b/tests/php/ORM/ListDecoratorTest.php index 6fe45fdd217..4e3ca3f18fb 100644 --- a/tests/php/ORM/ListDecoratorTest.php +++ b/tests/php/ORM/ListDecoratorTest.php @@ -23,7 +23,7 @@ class ListDecoratorTest extends SapphireTest */ protected $decorator; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/ORM/ManyManyThroughListTest.php b/tests/php/ORM/ManyManyThroughListTest.php index 90fa0141c5b..15d13c6b3cb 100644 --- a/tests/php/ORM/ManyManyThroughListTest.php +++ b/tests/php/ORM/ManyManyThroughListTest.php @@ -27,13 +27,13 @@ class ManyManyThroughListTest extends SapphireTest ManyManyThroughListTest\FallbackLocale::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); DataObject::reset(); } - protected function tearDown() + protected function tearDown(): void { DataObject::reset(); parent::tearDown(); diff --git a/tests/php/ORM/MarkedSetTest.php b/tests/php/ORM/MarkedSetTest.php index 1b43367af1c..08163d2e5da 100644 --- a/tests/php/ORM/MarkedSetTest.php +++ b/tests/php/ORM/MarkedSetTest.php @@ -31,7 +31,7 @@ public static function getExtraDataObjects() return []; } - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/php/ORM/SQLSelectTest.php b/tests/php/ORM/SQLSelectTest.php index 7139021fad5..48d7773b04b 100755 --- a/tests/php/ORM/SQLSelectTest.php +++ b/tests/php/ORM/SQLSelectTest.php @@ -23,13 +23,13 @@ class SQLSelectTest extends SapphireTest protected $oldDeprecation = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->oldDeprecation = Deprecation::dump_settings(); } - protected function tearDown() + protected function tearDown(): void { Deprecation::restore_settings($this->oldDeprecation); parent::tearDown(); diff --git a/tests/php/ORM/Search/FulltextSearchableTest.php b/tests/php/ORM/Search/FulltextSearchableTest.php index 038deca73e3..b36417023fb 100644 --- a/tests/php/ORM/Search/FulltextSearchableTest.php +++ b/tests/php/ORM/Search/FulltextSearchableTest.php @@ -12,7 +12,7 @@ class FulltextSearchableTest extends SapphireTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -24,7 +24,7 @@ protected function setUp() * properly at the end of the test. This becomes apparent when a later test tries to * ALTER TABLE File and add fulltext indexes with the InnoDB table type. */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); diff --git a/tests/php/ORM/TransactionTest.php b/tests/php/ORM/TransactionTest.php index c6e892f28d8..99d40caf2d4 100644 --- a/tests/php/ORM/TransactionTest.php +++ b/tests/php/ORM/TransactionTest.php @@ -20,19 +20,19 @@ class TransactionTest extends SapphireTest private static $originalVersionInfo; - protected function setUp() + protected function setUp(): void { parent::setUp(); self::$originalVersionInfo = Deprecation::dump_settings(); } - protected function tearDown() + protected function tearDown(): void { Deprecation::restore_settings(self::$originalVersionInfo); parent::tearDown(); } - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); if (!DB::get_conn()->supportsTransactions()) { diff --git a/tests/php/Security/BasicAuthTest.php b/tests/php/Security/BasicAuthTest.php index ffb95f0bf61..94d8b7af1bc 100644 --- a/tests/php/Security/BasicAuthTest.php +++ b/tests/php/Security/BasicAuthTest.php @@ -26,7 +26,7 @@ class BasicAuthTest extends FunctionalTest ControllerNotSecured::class, ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Security/GroupTest.php b/tests/php/Security/GroupTest.php index 076e04584b2..6b202b17cb6 100644 --- a/tests/php/Security/GroupTest.php +++ b/tests/php/Security/GroupTest.php @@ -20,7 +20,7 @@ class GroupTest extends FunctionalTest TestMember::class ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); } diff --git a/tests/php/Security/InheritedPermissionsFlusherTest.php b/tests/php/Security/InheritedPermissionsFlusherTest.php index 8cadcd0cced..4aea948b1fd 100644 --- a/tests/php/Security/InheritedPermissionsFlusherTest.php +++ b/tests/php/Security/InheritedPermissionsFlusherTest.php @@ -15,7 +15,7 @@ class InheritedPermissionsFlusherTest extends SapphireTest { protected static $fixture_file = 'InheritedPermissionsFlusherTest.yml'; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Security/InheritedPermissionsTest.php b/tests/php/Security/InheritedPermissionsTest.php index f5a0804d207..3c542858cb1 100644 --- a/tests/php/Security/InheritedPermissionsTest.php +++ b/tests/php/Security/InheritedPermissionsTest.php @@ -29,7 +29,7 @@ class InheritedPermissionsTest extends SapphireTest */ protected $rootPermissions = null; - protected function setUp() + protected function setUp(): void { $this->rootPermissions = new TestDefaultPermissionChecker(); @@ -57,7 +57,7 @@ protected function setUp() $permission2->clearCache(); } - protected function tearDown() + protected function tearDown(): void { Injector::inst()->unregisterNamedObject(PermissionChecker::class . '.testpermissions'); Injector::inst()->unregisterNamedObject(PermissionChecker::class . '.unstagedpermissions'); diff --git a/tests/php/Security/MemberAuthenticator/ChangePasswordHandlerTest.php b/tests/php/Security/MemberAuthenticator/ChangePasswordHandlerTest.php index 16fbcad2de6..59f995bfc95 100644 --- a/tests/php/Security/MemberAuthenticator/ChangePasswordHandlerTest.php +++ b/tests/php/Security/MemberAuthenticator/ChangePasswordHandlerTest.php @@ -15,7 +15,7 @@ class ChangePasswordHandlerTest extends SapphireTest { protected static $fixture_file = 'ChangePasswordHandlerTest.yml'; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Security/MemberAuthenticatorTest.php b/tests/php/Security/MemberAuthenticatorTest.php index 0af8d110195..cfa25cfcd5e 100644 --- a/tests/php/Security/MemberAuthenticatorTest.php +++ b/tests/php/Security/MemberAuthenticatorTest.php @@ -31,7 +31,7 @@ class MemberAuthenticatorTest extends SapphireTest protected $defaultUsername = null; protected $defaultPassword = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -50,7 +50,7 @@ protected function setUp() ->setTestNames([]); } - protected function tearDown() + protected function tearDown(): void { DefaultAdminService::clearDefaultAdmin(); if ($this->defaultUsername) { diff --git a/tests/php/Security/MemberCsvBulkLoaderTest.php b/tests/php/Security/MemberCsvBulkLoaderTest.php index 75f62c7328c..3fa6d175901 100644 --- a/tests/php/Security/MemberCsvBulkLoaderTest.php +++ b/tests/php/Security/MemberCsvBulkLoaderTest.php @@ -14,7 +14,7 @@ class MemberCsvBulkLoaderTest extends SapphireTest { protected static $fixture_file = 'MemberCsvBulkLoaderTest.yml'; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Security/MemberTest.php b/tests/php/Security/MemberTest.php index bb1ec6fb969..edc4e3f06ea 100644 --- a/tests/php/Security/MemberTest.php +++ b/tests/php/Security/MemberTest.php @@ -38,7 +38,7 @@ class MemberTest extends FunctionalTest Member::class => '*', ]; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); @@ -62,7 +62,7 @@ public static function setUpBeforeClass() /** * @skipUpgrade */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Security/PasswordEncryptorTest.php b/tests/php/Security/PasswordEncryptorTest.php index 7f8fa81f1a2..0f2165b1501 100644 --- a/tests/php/Security/PasswordEncryptorTest.php +++ b/tests/php/Security/PasswordEncryptorTest.php @@ -12,7 +12,7 @@ class PasswordEncryptorTest extends SapphireTest { - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); PasswordEncryptor_Blowfish::set_cost(10); diff --git a/tests/php/Security/PasswordValidatorTest.php b/tests/php/Security/PasswordValidatorTest.php index 071e5076059..560a8f25567 100644 --- a/tests/php/Security/PasswordValidatorTest.php +++ b/tests/php/Security/PasswordValidatorTest.php @@ -14,7 +14,7 @@ class PasswordValidatorTest extends SapphireTest */ protected $usesDatabase = true; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/php/Security/SecurityDefaultAdminTest.php b/tests/php/Security/SecurityDefaultAdminTest.php index 9b40dd9fbdf..9571bf03ac3 100644 --- a/tests/php/Security/SecurityDefaultAdminTest.php +++ b/tests/php/Security/SecurityDefaultAdminTest.php @@ -16,7 +16,7 @@ class SecurityDefaultAdminTest extends SapphireTest protected $defaultPassword = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -39,7 +39,7 @@ protected function setUp() Permission::reset(); } - protected function tearDown() + protected function tearDown(): void { DefaultAdminService::clearDefaultAdmin(); if ($this->defaultUsername) { diff --git a/tests/php/Security/SecurityTest.php b/tests/php/Security/SecurityTest.php index be92836b488..4756e3d957e 100644 --- a/tests/php/Security/SecurityTest.php +++ b/tests/php/Security/SecurityTest.php @@ -42,7 +42,7 @@ class SecurityTest extends FunctionalTest SecurityTest\SecuredController::class, ]; - protected function setUp() + protected function setUp(): void { // Set to an empty array of authenticators to enable the default Config::modify() diff --git a/tests/php/View/Parsers/ShortcodeParserTest.php b/tests/php/View/Parsers/ShortcodeParserTest.php index d9bf7434ca7..fa63ce8e2ee 100644 --- a/tests/php/View/Parsers/ShortcodeParserTest.php +++ b/tests/php/View/Parsers/ShortcodeParserTest.php @@ -11,7 +11,7 @@ class ShortcodeParserTest extends SapphireTest protected $arguments, $contents, $tagName, $parser; protected $extra = array(); - protected function setUp() + protected function setUp(): void { ShortcodeParser::get('test')->register('test_shortcode', array($this, 'shortcodeSaver')); $this->parser = ShortcodeParser::get('test'); @@ -19,7 +19,7 @@ protected function setUp() parent::setUp(); } - protected function tearDown() + protected function tearDown(): void { ShortcodeParser::get('test')->unregister('test_shortcode'); diff --git a/tests/php/View/RequirementsTest.php b/tests/php/View/RequirementsTest.php index 6a07475e457..71bcb673bf3 100644 --- a/tests/php/View/RequirementsTest.php +++ b/tests/php/View/RequirementsTest.php @@ -31,7 +31,7 @@ class RequirementsTest extends SapphireTest static $html_template = ''; - protected function setUp() + protected function setUp(): void { parent::setUp(); Director::config()->set('alternate_base_folder', __DIR__ . '/SSViewerTest'); @@ -43,7 +43,7 @@ protected function setUp() $this->oldThemeResourceLoader = ThemeResourceLoader::inst(); } - protected function tearDown() + protected function tearDown(): void { ThemeResourceLoader::set_instance($this->oldThemeResourceLoader); TestAssetStore::reset(); diff --git a/tests/php/View/SSViewerTest.php b/tests/php/View/SSViewerTest.php index 271961b451d..3e9ca8d5603 100644 --- a/tests/php/View/SSViewerTest.php +++ b/tests/php/View/SSViewerTest.php @@ -50,7 +50,7 @@ class SSViewerTest extends SapphireTest SSViewerTest\TestObject::class, ); - protected function setUp() + protected function setUp(): void { parent::setUp(); SSViewer::config()->update('source_file_comments', false); @@ -59,7 +59,7 @@ protected function setUp() $this->oldServer = $_SERVER; } - protected function tearDown() + protected function tearDown(): void { $_SERVER = $this->oldServer; TestAssetStore::reset(); diff --git a/tests/php/i18n/i18nTest.php b/tests/php/i18n/i18nTest.php index 183fc128153..a775fc9ae90 100644 --- a/tests/php/i18n/i18nTest.php +++ b/tests/php/i18n/i18nTest.php @@ -17,13 +17,13 @@ class i18nTest extends SapphireTest { use i18nTestManifest; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->setupManifest(); } - protected function tearDown() + protected function tearDown(): void { $this->tearDownManifest(); parent::tearDown(); diff --git a/tests/php/i18n/i18nTextCollectorTest.php b/tests/php/i18n/i18nTextCollectorTest.php index 4ae8456b696..01dc3740de4 100644 --- a/tests/php/i18n/i18nTextCollectorTest.php +++ b/tests/php/i18n/i18nTextCollectorTest.php @@ -20,7 +20,7 @@ class i18nTextCollectorTest extends SapphireTest */ protected $alternateBaseSavePath = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->setupManifest(); @@ -29,7 +29,7 @@ protected function setUp() Filesystem::makeFolder($this->alternateBaseSavePath); } - protected function tearDown() + protected function tearDown(): void { if (is_dir($this->alternateBaseSavePath)) { Filesystem::removeFolder($this->alternateBaseSavePath);