We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit a998bda4 authored by Brion Vibber's avatar Brion Vibber

Fix UserRightsTest unit tests

parent 0158f4f7
......@@ -329,7 +329,7 @@ class User extends Memcached_DataObject
$profile->query('COMMIT');
if ($email && !$user->email) {
if (!empty($email) && !$user->email) {
mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
}
......
......@@ -16,14 +16,26 @@ class UserRightsTest extends PHPUnit_Framework_TestCase
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()
......@@ -33,7 +45,8 @@ class UserRightsTest extends PHPUnit_Framework_TestCase
function standardRoles()
{
return array('admin', 'moderator');
return array(array('admin'),
array('moderator'));
}
/**
......@@ -54,6 +67,6 @@ class UserRightsTest extends PHPUnit_Framework_TestCase
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment