2013-06-07 12:40:21 +02:00
|
|
|
<?php
|
|
|
|
|
2013-07-26 15:58:16 +02:00
|
|
|
namespace Tests\Icinga;
|
2013-08-06 18:02:40 +02:00
|
|
|
|
|
|
|
require_once __DIR__ . '/../../../../library/Icinga/User.php';
|
|
|
|
require_once __DIR__ . '/../../../../library/Icinga/User/Preferences.php';
|
|
|
|
require_once __DIR__ . '/../../../../library/Icinga/User/Preferences/ChangeSet.php';
|
|
|
|
|
2013-08-07 17:19:16 +02:00
|
|
|
use \DateTimeZone;
|
2013-08-06 18:02:40 +02:00
|
|
|
use Icinga\User as IcingaUser;
|
|
|
|
use Icinga\User\Preferences as UserPreferences;
|
|
|
|
|
2013-06-07 12:40:21 +02:00
|
|
|
class UserTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
public function testListGroups()
|
|
|
|
{
|
|
|
|
$this->markTestIncomplete('testListGroups is not implemented yet');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIsMemberOf()
|
|
|
|
{
|
|
|
|
$this->markTestIncomplete('testIsMemberOf is not implemented yet');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetPermissionList()
|
|
|
|
{
|
|
|
|
$this->markTestIncomplete('testGetPermissionList is not implemented yet');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testHasPermission()
|
|
|
|
{
|
|
|
|
$this->markTestIncomplete('testHasPermission is not implemented yet');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGrantPermission()
|
|
|
|
{
|
|
|
|
$this->markTestIncomplete('testGrantPermission is not implemented yet');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testRevokePermission()
|
|
|
|
{
|
|
|
|
$this->markTestIncomplete('testRevokePermission is not implemented yet');
|
|
|
|
}
|
|
|
|
|
2013-08-06 18:02:40 +02:00
|
|
|
public function testGetDefaultTimezoneIfTimezoneNotSet()
|
|
|
|
{
|
|
|
|
$defaultTz = 'UTC';
|
|
|
|
date_default_timezone_set($defaultTz);
|
|
|
|
$user = new IcingaUser('unittest');
|
|
|
|
$prefs = new UserPreferences(array());
|
|
|
|
$user->setPreferences($prefs);
|
2013-08-07 17:19:16 +02:00
|
|
|
$this->assertEquals($user->getTimeZone(), new DateTimeZone($defaultTz),
|
2013-08-06 18:02:40 +02:00
|
|
|
'User\'s timezone does not match the default timezone'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetTimezoneIfTimezoneSet()
|
|
|
|
{
|
|
|
|
$defaultTz = 'UTC';
|
|
|
|
$explicitTz = 'Europe/Berlin';
|
|
|
|
date_default_timezone_set($defaultTz);
|
|
|
|
$user = new IcingaUser('unittest');
|
|
|
|
$prefs = new UserPreferences(array(
|
|
|
|
'timezone' => $explicitTz
|
|
|
|
));
|
|
|
|
$user->setPreferences($prefs);
|
2013-08-07 17:19:16 +02:00
|
|
|
$this->assertEquals($user->getTimeZone(), new DateTimeZone($defaultTz),
|
2013-08-06 18:02:40 +02:00
|
|
|
'User\'s timezone does not match the timezone set by himself'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-06-07 12:40:21 +02:00
|
|
|
}
|