X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2FUserRightsTest.php;h=d24a172f6f58adad60c030b1d0181b73eefac068;hb=9109fe3c631ebef14f2de061fc6fc565ee0f7174;hp=6544ee53d75bac92dedb1df223314ea79b2529e3;hpb=a68663588ee95915153ad1f927cf510e3d41a299;p=quix0rs-gnu-social.git diff --git a/tests/UserRightsTest.php b/tests/UserRightsTest.php index 6544ee53d7..d24a172f6f 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