$profile->query('COMMIT');
- if ($email && !$user->email) {
+ if (!empty($email) && !$user->email) {
mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
}
function setUp()
{
+ $user = User::staticGet('nickname', 'userrightstestuser');
+ if ($user) {
+ // Leftover from a broken test run?
+ $profile = $user->getProfile();
+ $user->delete();
+ $profile->delete();
+ }
$this->user = User::register(array('nickname' => 'userrightstestuser'));
+ if (!$this->user) {
+ throw new Exception("Couldn't register userrightstestuser");
+ }
}
function tearDown()
{
- $profile = $this->user->getProfile();
- $this->user->delete();
- $profile->delete();
+ if ($this->user) {
+ $profile = $this->user->getProfile();
+ $this->user->delete();
+ $profile->delete();
+ }
}
function testInvalidRole()
function standardRoles()
{
- return array('admin', 'moderator');
+ return array(array('admin'),
+ array('moderator'));
}
/**
function testGrantedRole($role)
{
$this->user->grantRole($role);
- $this->assertFalse($this->user->hasRole($role));
+ $this->assertTrue($this->user->hasRole($role));
}
}
\ No newline at end of file