public function testRoleDelete() { $role = Role::create("test_role"); $role->addPermission($this->rm->permissionFetchById(1)); $this->assertTrue($this->rm->roleSave($role)); $count_pre = $this->getConnection()->getRowCount("auth_role"); $this->assertTrue($this->rm->roleDelete($role)); $this->assertEquals($count_pre - 1, $this->getConnection()->getRowCount("auth_role")); $this->assertFalse($this->rm->roleFetchByName("admin_read")); }
function it_should_delete_roles_and_permissions(PDOStatement $sth, Permission $permission, RoleManager $role_manager) { $sth->fetchAll(PDO::FETCH_CLASS, '\\RBAC\\Permission')->willReturn(array($permission)); $role_manager->permissionDelete(Argument::any())->willReturn(true); $role_manager->roleDelete(Argument::any())->willReturn(true); $this->delete_permission('Permission Name')->shouldReturn(true); $this->delete_permissions(array('Permission Name'))->shouldReturn(true); $this->delete_roles_permissions(array('members' => array('Permission Name')))->shouldReturn(true); }