diff options
author | Sarven Capadisli <csarven@status.net> | 2009-12-17 15:29:44 -0500 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-12-17 15:29:44 -0500 |
commit | 31f2079490b69d7e6485b893efa78e769a156b3a (patch) | |
tree | 3ceeecc0b503bed0308835c2b41d101850b9739f /tests/UserRightsTest.php | |
parent | bf123d146185ffa686396713a3d3067629047ee5 (diff) | |
parent | 7ee875b10ffbf9fae0934426d6abda2be48d01c7 (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'tests/UserRightsTest.php')
-rw-r--r-- | tests/UserRightsTest.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/UserRightsTest.php b/tests/UserRightsTest.php index 6544ee53d..d24a172f6 100644 --- a/tests/UserRightsTest.php +++ b/tests/UserRightsTest.php @@ -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 |