mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 15:33:23 +01:00
fix function signature in order to update to phpUnit 8
This commit is contained in:
parent
55a0c2b6bc
commit
ce47208874
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)))
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ class UserCommandTest extends CommandBase {
|
||||
'account_lastname' => 'Test'
|
||||
);
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown() : void
|
||||
{
|
||||
if($this->account_id)
|
||||
{
|
||||
|
@ -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());
|
||||
|
@ -59,7 +59,7 @@ class SchemaTest extends LoggedInTest {
|
||||
/**
|
||||
* Get a database connection
|
||||
*/
|
||||
public static function setUpBeforeClass()
|
||||
public static function setUpBeforeClass() : void
|
||||
{
|
||||
parent::setUpBeforeClass();
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
|
@ -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'])
|
||||
{
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
|
@ -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))
|
||||
|
@ -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']);
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user