Пример #1
0
 /**
  * tests that a user listing is complete, if all it's members have the group
  * as their primary.
  */
 public function testUsersInGroupPrimaryMembersOnly()
 {
     $access = $this->getAccessMock();
     $this->enableGroups($access);
     $access->connection->expects($this->any())->method('getFromCache')->will($this->returnValue(null));
     $access->expects($this->any())->method('readAttribute')->will($this->returnCallback(function ($dn, $attr) {
         if ($attr === 'primaryGroupToken') {
             return array(1337);
         }
         return array();
     }));
     $access->expects($this->any())->method('groupname2dn')->will($this->returnValue('cn=foobar,dc=foo,dc=bar'));
     $access->expects($this->once())->method('ownCloudUserNames')->will($this->returnValue(array('lisa', 'bart', 'kira', 'brad')));
     $groupBackend = new GroupLDAP($access);
     $users = $groupBackend->usersInGroup('foobar');
     $this->assertSame(4, count($users));
 }