public function testSearchUsers() { $group = $this->getGroupName(); $this->backend->createGroup($group); $name1 = 'foobarbaz'; $name2 = 'bazbarfoo'; $name3 = 'notme'; $this->backend->addToGroup($name1, $group); $this->backend->addToGroup($name2, $group); $this->backend->addToGroup($name3, $group); $result = $this->backend->usersInGroup($group, 'bar'); $this->assertSame(2, count($result)); $result = $this->backend->countUsersInGroup($group, 'bar'); $this->assertSame(2, $result); }
public function testAddDouble() { $group = $this->getGroupName(); $this->backend->createGroup($group); $this->backend->createGroup($group); }
public function testUser() { $group1 = $this->getGroupName(); $group2 = $this->getGroupName(); $this->backend->createGroup($group1); $this->backend->createGroup($group2); $user1 = $this->getUserName(); $user2 = $this->getUserName(); $this->assertFalse($this->backend->inGroup($user1, $group1)); $this->assertFalse($this->backend->inGroup($user2, $group1)); $this->assertFalse($this->backend->inGroup($user1, $group2)); $this->assertFalse($this->backend->inGroup($user2, $group2)); $this->assertTrue($this->backend->addToGroup($user1, $group1)); $this->assertTrue($this->backend->inGroup($user1, $group1)); $this->assertFalse($this->backend->inGroup($user2, $group1)); $this->assertFalse($this->backend->inGroup($user1, $group2)); $this->assertFalse($this->backend->inGroup($user2, $group2)); $this->assertFalse($this->backend->addToGroup($user1, $group1)); $this->assertEqual(array($user1), $this->backend->usersInGroup($group1)); $this->assertEqual(array(), $this->backend->usersInGroup($group2)); $this->assertEqual(array($group1), $this->backend->getUserGroups($user1)); $this->assertEqual(array(), $this->backend->getUserGroups($user2)); $this->backend->deleteGroup($group1); $this->assertEqual(array(), $this->backend->getUserGroups($user1)); $this->assertEqual(array(), $this->backend->usersInGroup($group1)); $this->assertFalse($this->backend->inGroup($user1, $group1)); }