diff options
author | Brion Vibber <brion@pobox.com> | 2009-12-15 14:49:53 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2009-12-16 09:27:48 -0500 |
commit | a998bda4a57014d0a319fd0bc31552705f0887ed (patch) | |
tree | 3ac7f6669c56e4a579eed8d26fa39338d1989a17 /tests | |
parent | 0158f4f73db1c6090c09da8cc3cdcfb97af3883b (diff) |
Fix UserRightsTest unit tests
Diffstat (limited to 'tests')
-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 |