3 if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
4 print "This script must be run from the command line\n";
8 define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
9 define('STATUSNET', true);
11 require_once INSTALLDIR . '/lib/common.php';
13 class UserRightsTest extends PHPUnit_Framework_TestCase
15 protected $user = null;
19 $this->user = User::register(array('nickname' => 'userrightstestuser'));
24 $profile = $this->user->getProfile();
25 $this->user->delete();
29 function testInvalidRole()
31 $this->assertFalse($this->user->hasRole('invalidrole'));
34 function standardRoles()
36 return array('admin', 'moderator');
40 * @dataProvider standardRoles
44 function testUngrantedRole($role)
46 $this->assertFalse($this->user->hasRole($role));
50 * @dataProvider standardRoles
54 function testGrantedRole($role)
56 $this->user->grantRole($role);
57 $this->assertFalse($this->user->hasRole($role));