From ce472088747b4d218a78543b28cd83c63a496cff Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 4 Mar 2020 18:47:48 +0100 Subject: [PATCH] fix function signature in order to update to phpUnit 8 --- admin/tests/AclCommandTest.php | 4 ++-- admin/tests/ConfigCommandTest.php | 2 +- admin/tests/DeleteAccountCommandTest.php | 4 ++-- admin/tests/GroupCommandTest.php | 4 ++-- admin/tests/PreferencesCommandTest.php | 4 ++-- admin/tests/UserCommandTest.php | 2 +- api/tests/DateTimeTest.php | 4 ++-- api/tests/Db/SchemaTest.php | 2 +- api/tests/Etemplate/Widget/ContactEntryTest.php | 4 ++-- api/tests/Etemplate/Widget/DateTest.php | 4 ++-- api/tests/Etemplate/WidgetBaseTest.php | 6 +++--- api/tests/LoggedInTest.php | 6 +++--- api/tests/Storage/BaseTest.php | 6 +++--- api/tests/Storage/CustomfieldsTest.php | 2 +- api/tests/Vfs/SharingBase.php | 6 +++--- api/tests/loader/SecurityTest.php | 4 ++-- calendar/tests/ImportParticipantsTest.php | 8 ++++---- calendar/tests/ResetParticipantStatusTest.php | 8 ++++---- calendar/tests/TimezoneTest.php | 8 ++++---- infolog/tests/ContactTest.php | 4 ++-- infolog/tests/SetProjectManagerTest.php | 4 ++-- infolog/tests/StatusTest.php | 8 ++++---- mail/tests/SaveToVfsTest.php | 8 ++++---- 23 files changed, 56 insertions(+), 56 deletions(-) diff --git a/admin/tests/AclCommandTest.php b/admin/tests/AclCommandTest.php index c1fe8feefd..020d656b0c 100644 --- a/admin/tests/AclCommandTest.php +++ b/admin/tests/AclCommandTest.php @@ -28,7 +28,7 @@ class AclCommandTest extends CommandBase { /** * Create accounts for testing */ - public function setUp() + protected function setUp() : void { parent::setUp(); @@ -74,7 +74,7 @@ class AclCommandTest extends CommandBase { $this->assertNotEmpty($this->account_id, 'Did not create test user account'); } - public function tearDown() + protected function tearDown() : void { // Delete the accounts we created if($this->group_id) diff --git a/admin/tests/ConfigCommandTest.php b/admin/tests/ConfigCommandTest.php index 556fab937f..c062dc9fcd 100644 --- a/admin/tests/ConfigCommandTest.php +++ b/admin/tests/ConfigCommandTest.php @@ -23,7 +23,7 @@ class ConfigCommandTest extends CommandBase // If we add a config, make sure we can delete it for clean up protected $config_name = 'test_config'; - public function tearDown() + protected function tearDown() : void { if($this->config_name) { diff --git a/admin/tests/DeleteAccountCommandTest.php b/admin/tests/DeleteAccountCommandTest.php index 86b7e245d7..552c0fb7dd 100644 --- a/admin/tests/DeleteAccountCommandTest.php +++ b/admin/tests/DeleteAccountCommandTest.php @@ -29,7 +29,7 @@ class DeleteAccountCommandTest extends CommandBase { 'account_lastname' => 'Test' ); - public function setUp() + protected function setUp() : void { if(($account_id = $GLOBALS['egw']->accounts->name2id($this->account['account_lid']))) { @@ -44,7 +44,7 @@ class DeleteAccountCommandTest extends CommandBase { $this->assertNotEmpty($this->account_id, 'Did not create test user account'); } - public function tearDown() + protected function tearDown() : void { if($this->account_id && ($GLOBALS['egw']->accounts->id2name($this->account_id))) { diff --git a/admin/tests/GroupCommandTest.php b/admin/tests/GroupCommandTest.php index f0f64f0992..fc71be1de8 100644 --- a/admin/tests/GroupCommandTest.php +++ b/admin/tests/GroupCommandTest.php @@ -28,7 +28,7 @@ class GroupCommandTest extends CommandBase { 'account_members' => array() ); - public function setUp() + protected function setUp() : void { // Can't set this until now - value is not available $this->group['account_members'] = array($GLOBALS['egw_info']['user']['account_id']); @@ -39,7 +39,7 @@ class GroupCommandTest extends CommandBase { $GLOBALS['egw']->accounts->delete($account_id); } } - public function tearDown() + protected function tearDown() : void { // Delete the accounts we created if($this->group_id) diff --git a/admin/tests/PreferencesCommandTest.php b/admin/tests/PreferencesCommandTest.php index bc7bb8ad9d..59828b9f61 100644 --- a/admin/tests/PreferencesCommandTest.php +++ b/admin/tests/PreferencesCommandTest.php @@ -23,13 +23,13 @@ class PreferencesCommandTest extends CommandBase // If we add a preference, make sure we can delete it for clean up protected $preference_name = 'test_preference'; - public function setUp() + protected function setUp() : void { Api\Cache::unsetInstance(Api\Preferences::class, 'forced'); Api\Cache::unsetInstance(Api\Preferences::class, 'default'); Api\Cache::unsetInstance(Api\Preferences::class, $GLOBALS['egw_info']['user']['account_id']); } - public function tearDown() + protected function tearDown() : void { if($this->preference_name) { diff --git a/admin/tests/UserCommandTest.php b/admin/tests/UserCommandTest.php index b261fe4f1a..00a4018a88 100644 --- a/admin/tests/UserCommandTest.php +++ b/admin/tests/UserCommandTest.php @@ -29,7 +29,7 @@ class UserCommandTest extends CommandBase { 'account_lastname' => 'Test' ); - public function tearDown() + protected function tearDown() : void { if($this->account_id) { diff --git a/api/tests/DateTimeTest.php b/api/tests/DateTimeTest.php index 77b6fb50a3..4f099caf49 100644 --- a/api/tests/DateTimeTest.php +++ b/api/tests/DateTimeTest.php @@ -25,7 +25,7 @@ class DateTimeTest extends TestCase { /** * Work in server time, so tests match expectations */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); @@ -41,7 +41,7 @@ class DateTimeTest extends TestCase { // Set user time to server time for consistency DateTime::setUserPrefs(date_default_timezone_get()); } - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { // Reset DateTime::setUserPrefs(static::$usertime->getName()); diff --git a/api/tests/Db/SchemaTest.php b/api/tests/Db/SchemaTest.php index e8131ade51..b3319afe55 100644 --- a/api/tests/Db/SchemaTest.php +++ b/api/tests/Db/SchemaTest.php @@ -59,7 +59,7 @@ class SchemaTest extends LoggedInTest { /** * Get a database connection */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); diff --git a/api/tests/Etemplate/Widget/ContactEntryTest.php b/api/tests/Etemplate/Widget/ContactEntryTest.php index b130baf026..4b598904c0 100644 --- a/api/tests/Etemplate/Widget/ContactEntryTest.php +++ b/api/tests/Etemplate/Widget/ContactEntryTest.php @@ -26,11 +26,11 @@ class EntryTest extends \EGroupware\Api\Etemplate\WidgetBaseTest { const TEST_TEMPLATE = 'api.entry_test_contact'; - public static function setUpBeforeClass() { + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); } - public function tearDown() + protected function tearDown() : void { // Delete all elements foreach($this->elements as $id) diff --git a/api/tests/Etemplate/Widget/DateTest.php b/api/tests/Etemplate/Widget/DateTest.php index 3528385e34..2a45f9cba5 100644 --- a/api/tests/Etemplate/Widget/DateTest.php +++ b/api/tests/Etemplate/Widget/DateTest.php @@ -29,7 +29,7 @@ class DateTest extends \EGroupware\Api\Etemplate\WidgetBaseTest /** * Work in server time, so tests match expectations */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); @@ -41,7 +41,7 @@ class DateTest extends \EGroupware\Api\Etemplate\WidgetBaseTest date_default_timezone_set('UTC'); DateTime::$server_timezone = new \DateTimeZone('UTC'); } - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { // Reset DateTime::setUserPrefs(static::$usertime->getName()); diff --git a/api/tests/Etemplate/WidgetBaseTest.php b/api/tests/Etemplate/WidgetBaseTest.php index 4866824f0b..2868b39e06 100644 --- a/api/tests/Etemplate/WidgetBaseTest.php +++ b/api/tests/Etemplate/WidgetBaseTest.php @@ -39,7 +39,7 @@ abstract class WidgetBaseTest extends \EGroupware\Api\LoggedInTest { protected $ajax_response = null; - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); @@ -49,12 +49,12 @@ abstract class WidgetBaseTest extends \EGroupware\Api\LoggedInTest { new \EGroupware\Api\Etemplate(); } - public function setUp() + protected function setUp() : void { // Mock AJAX response $this->ajax_response = $this->mock_ajax_response(); } - public function tearDown() + protected function tearDown() : void { // Clean up AJAX response $this->ajax_response->initResponseArray(); diff --git a/api/tests/LoggedInTest.php b/api/tests/LoggedInTest.php index c125712148..abc672de8c 100644 --- a/api/tests/LoggedInTest.php +++ b/api/tests/LoggedInTest.php @@ -35,7 +35,7 @@ abstract class LoggedInTest extends TestCase /** * Start session once before each test case */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { try { @@ -63,7 +63,7 @@ abstract class LoggedInTest extends TestCase } } - public function assertPreConditions() + protected function assertPreConditions() : void { // Do some checks to make sure things we expect are there $this->assertTrue(static::sanity_check(), 'Unable to connect to Egroupware - failed sanity check'); @@ -72,7 +72,7 @@ abstract class LoggedInTest extends TestCase /** * End session when done - every test class gets its own session */ - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { if($GLOBALS['egw']) { diff --git a/api/tests/Storage/BaseTest.php b/api/tests/Storage/BaseTest.php index 2cd646422d..be4e28781d 100644 --- a/api/tests/Storage/BaseTest.php +++ b/api/tests/Storage/BaseTest.php @@ -27,7 +27,7 @@ class BaseTest extends TestCase */ private $storage; - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { if (ini_get('session.save_handler') == 'files' && !is_writable(ini_get('session.save_path')) && is_dir('/tmp') && is_writable('/tmp')) { @@ -49,12 +49,12 @@ class BaseTest extends TestCase self::$db->connect(); } - protected function setUp() + protected function setUp() : void { $this->storage = new Api\Storage\Base('test', 'egw_test', self::$db); } - protected function assertPreConditions() + protected function assertPreConditions() : void { $tables = self::$db->table_names(true); $this->assertContains('egw_test', $tables, 'Could not find DB table "egw_test", make sure test app is installed'); diff --git a/api/tests/Storage/CustomfieldsTest.php b/api/tests/Storage/CustomfieldsTest.php index 9389574c8c..c4983b1b33 100644 --- a/api/tests/Storage/CustomfieldsTest.php +++ b/api/tests/Storage/CustomfieldsTest.php @@ -35,7 +35,7 @@ class CustomfieldsTest extends LoggedInTest 'private' => array() ); - public function assertPreConditions() + protected function assertPreConditions() : void { parent::assertPreConditions(); $tables = $GLOBALS['egw']->db->table_names(true); diff --git a/api/tests/Vfs/SharingBase.php b/api/tests/Vfs/SharingBase.php index c3913bbceb..2109250690 100644 --- a/api/tests/Vfs/SharingBase.php +++ b/api/tests/Vfs/SharingBase.php @@ -61,7 +61,7 @@ class SharingBase extends LoggedInTest 'maxdepth' => 5 ); - public function setUp() + protected function setUp() : void { // Check we have basic access if(!is_readable($GLOBALS['egw_info']['server']['files_dir'])) @@ -75,7 +75,7 @@ class SharingBase extends LoggedInTest } - public function tearDown() + protected function tearDown() : void { LoggedInTest::tearDownAfterClass(); LoggedInTest::setupBeforeClass(); @@ -239,7 +239,7 @@ class SharingBase extends LoggedInTest break; case Sharing::WRITABLE: // Root is not writable - if($file == '/') continue; + if($file == '/') break; $this->assertTrue(Vfs::is_writable($file), $file . ' was not writable'); if(!Vfs::is_dir($file)) diff --git a/api/tests/loader/SecurityTest.php b/api/tests/loader/SecurityTest.php index 628496f9fc..1d98c225a4 100644 --- a/api/tests/loader/SecurityTest.php +++ b/api/tests/loader/SecurityTest.php @@ -21,7 +21,7 @@ use PHPUnit\Framework\TestCase as TestCase; class SecurityTest extends TestCase { - public function setUp() + protected function setUp() : void { // _check_script_tag uses HtmLawed, which calls GLOBALS['egw']->link() $GLOBALS['egw'] = $this->getMockBuilder('Egw') @@ -30,7 +30,7 @@ class SecurityTest extends TestCase { ->getMock(); } - public function tearDown() + protected function tearDown() : void { unset($GLOBALS['egw_inset_vars']); diff --git a/calendar/tests/ImportParticipantsTest.php b/calendar/tests/ImportParticipantsTest.php index cc35cb3d61..d0bc0595a3 100644 --- a/calendar/tests/ImportParticipantsTest.php +++ b/calendar/tests/ImportParticipantsTest.php @@ -25,17 +25,17 @@ class ImportParticipantsTest extends \EGroupware\Api\AppTest // Method under test with modified access private $parse_method = null; - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { parent::tearDownAfterClass(); } - public function setUp() + protected function setUp() : void { $this->bo = new \calendar_bo(); @@ -50,7 +50,7 @@ class ImportParticipantsTest extends \EGroupware\Api\AppTest $this->parse_method->setAccessible(true); } - public function tearDown() + protected function tearDown() : void { } diff --git a/calendar/tests/ResetParticipantStatusTest.php b/calendar/tests/ResetParticipantStatusTest.php index c67b4674d5..95aa424108 100644 --- a/calendar/tests/ResetParticipantStatusTest.php +++ b/calendar/tests/ResetParticipantStatusTest.php @@ -24,17 +24,17 @@ class ResetParticipantStatusTest extends \EGroupware\Api\AppTest // Method under test with modified access private $check_method = null; - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { parent::tearDownAfterClass(); } - public function setUp() + protected function setUp() : void { $this->bo = new \calendar_boupdate(); @@ -47,7 +47,7 @@ class ResetParticipantStatusTest extends \EGroupware\Api\AppTest $this->check_method->setAccessible(true); } - public function tearDown() + protected function tearDown() : void { // Clean up user diff --git a/calendar/tests/TimezoneTest.php b/calendar/tests/TimezoneTest.php index 8e02c69394..c84bbcadb1 100644 --- a/calendar/tests/TimezoneTest.php +++ b/calendar/tests/TimezoneTest.php @@ -28,20 +28,20 @@ class TimezoneTest extends \EGroupware\Api\AppTest { protected $recur_end; protected $cal_id; - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); static::$server_tz = date_default_timezone_get(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { date_default_timezone_set(static::$server_tz); parent::tearDownAfterClass(); } - public function setUp() + protected function setUp() : void { $this->bo = new \calendar_boupdate(); @@ -50,7 +50,7 @@ class TimezoneTest extends \EGroupware\Api\AppTest { $this->recur_end = new Api\DateTime(mktime(0,0,0,date('m'), date('d') + static::RECUR_DAYS, date('Y'))); } - public function tearDown() + protected function tearDown() : void { $this->bo->delete($this->cal_id); // Delete again to remove from delete history diff --git a/infolog/tests/ContactTest.php b/infolog/tests/ContactTest.php index e5e7526074..b024d56182 100644 --- a/infolog/tests/ContactTest.php +++ b/infolog/tests/ContactTest.php @@ -28,7 +28,7 @@ class ContactTest extends \EGroupware\Api\AppTest // Infolog under test protected $info_id = null; - public function setUp() + protected function setUp() : void { $this->ui = new \infolog_ui(); @@ -39,7 +39,7 @@ class ContactTest extends \EGroupware\Api\AppTest $this->mockTracking($this->bo, 'infolog_tracking'); } - public function tearDown() + protected function tearDown() : void { // Double delete to make sure it's gone, not preserved due to history setting if($this->info_id) diff --git a/infolog/tests/SetProjectManagerTest.php b/infolog/tests/SetProjectManagerTest.php index bc876daed6..d8c68a8534 100644 --- a/infolog/tests/SetProjectManagerTest.php +++ b/infolog/tests/SetProjectManagerTest.php @@ -34,7 +34,7 @@ class SetProjectManagerTest extends \EGroupware\Api\AppTest protected $pm_id = null; - public function setUp() + protected function setUp() : void { $this->ui = new \infolog_ui(); @@ -63,7 +63,7 @@ class SetProjectManagerTest extends \EGroupware\Api\AppTest $this->makeProject(); } - public function tearDown() + protected function tearDown() : void { // Remove infolog under test if($this->info_id) diff --git a/infolog/tests/StatusTest.php b/infolog/tests/StatusTest.php index 0e9a812a47..157e1114cd 100644 --- a/infolog/tests/StatusTest.php +++ b/infolog/tests/StatusTest.php @@ -37,7 +37,7 @@ class StatusTest extends \EGroupware\Api\AppTest /** * Create a custom status we can use to test */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); @@ -47,7 +47,7 @@ class StatusTest extends \EGroupware\Api\AppTest Api\Config::save_value('status',$bo->status,'infolog'); } - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { // Remove custom status $bo = new \infolog_bo(); @@ -58,14 +58,14 @@ class StatusTest extends \EGroupware\Api\AppTest parent::tearDownAfterClass(); } - public function setUp() + protected function setUp() : void { $this->bo = new \infolog_bo(); $this->mockTracking($this->bo, 'infolog_tracking'); } - public function tearDown() + protected function tearDown() : void { $this->bo = null; } diff --git a/mail/tests/SaveToVfsTest.php b/mail/tests/SaveToVfsTest.php index 236e6ef090..0e17376249 100644 --- a/mail/tests/SaveToVfsTest.php +++ b/mail/tests/SaveToVfsTest.php @@ -18,23 +18,23 @@ class SaveToVfsTest extends \PHPUnit\Framework\TestCase /** * Create a custom status we can use to test */ - public static function setUpBeforeClass() + public static function setUpBeforeClass() : void { parent::setUpBeforeClass(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass() : void { // Have to remove custom status first, before the DB is gone parent::tearDownAfterClass(); } - public function setUp() + protected function setUp() : void { } - public function tearDown() + protected function tearDown() : void { }