From 6c069312e2911d3b2fe54d051354f579fde7bb63 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 15 Sep 2009 15:28:11 -0400 Subject: user rights --- tests/UserRightsTest.php | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tests/UserRightsTest.php (limited to 'tests/UserRightsTest.php') diff --git a/tests/UserRightsTest.php b/tests/UserRightsTest.php new file mode 100644 index 000000000..6544ee53d --- /dev/null +++ b/tests/UserRightsTest.php @@ -0,0 +1,59 @@ +user = User::register(array('nickname' => 'userrightstestuser')); + } + + function tearDown() + { + $profile = $this->user->getProfile(); + $this->user->delete(); + $profile->delete(); + } + + function testInvalidRole() + { + $this->assertFalse($this->user->hasRole('invalidrole')); + } + + function standardRoles() + { + return array('admin', 'moderator'); + } + + /** + * @dataProvider standardRoles + * + */ + + function testUngrantedRole($role) + { + $this->assertFalse($this->user->hasRole($role)); + } + + /** + * @dataProvider standardRoles + * + */ + + function testGrantedRole($role) + { + $this->user->grantRole($role); + $this->assertFalse($this->user->hasRole($role)); + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf