forked from GNUsocial/gnu-social
Fix UserRightsTest unit tests
This commit is contained in:
parent
0158f4f73d
commit
a998bda4a5
@ -329,7 +329,7 @@ class User extends Memcached_DataObject
|
|||||||
|
|
||||||
$profile->query('COMMIT');
|
$profile->query('COMMIT');
|
||||||
|
|
||||||
if ($email && !$user->email) {
|
if (!empty($email) && !$user->email) {
|
||||||
mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
|
mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,14 +16,26 @@ class UserRightsTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
function setUp()
|
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'));
|
$this->user = User::register(array('nickname' => 'userrightstestuser'));
|
||||||
|
if (!$this->user) {
|
||||||
|
throw new Exception("Couldn't register userrightstestuser");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown()
|
function tearDown()
|
||||||
{
|
{
|
||||||
$profile = $this->user->getProfile();
|
if ($this->user) {
|
||||||
$this->user->delete();
|
$profile = $this->user->getProfile();
|
||||||
$profile->delete();
|
$this->user->delete();
|
||||||
|
$profile->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function testInvalidRole()
|
function testInvalidRole()
|
||||||
@ -33,7 +45,8 @@ class UserRightsTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
function standardRoles()
|
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)
|
function testGrantedRole($role)
|
||||||
{
|
{
|
||||||
$this->user->grantRole($role);
|
$this->user->grantRole($role);
|
||||||
$this->assertFalse($this->user->hasRole($role));
|
$this->assertTrue($this->user->hasRole($role));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user