improve and extend paging integration test
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
30bf1c158d
commit
51e4b49ee9
|
@ -36,6 +36,9 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
|
||||||
/** @var User_LDAP */
|
/** @var User_LDAP */
|
||||||
protected $backend;
|
protected $backend;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
protected $pagingSize = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* prepares the LDAP environment and sets up a test configuration for
|
* prepares the LDAP environment and sets up a test configuration for
|
||||||
* the LDAP backend.
|
* the LDAP backend.
|
||||||
|
@ -50,7 +53,7 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
|
||||||
public function initConnection() {
|
public function initConnection() {
|
||||||
parent::initConnection();
|
parent::initConnection();
|
||||||
$this->connection->setConfiguration([
|
$this->connection->setConfiguration([
|
||||||
'ldapPagingSize' => 1
|
'ldapPagingSize' => $this->pagingSize
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,19 +64,33 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function case1() {
|
protected function case1() {
|
||||||
$offset = 0;
|
|
||||||
|
|
||||||
$filter = 'objectclass=inetorgperson';
|
$filter = 'objectclass=inetorgperson';
|
||||||
$attributes = ['cn', 'dn'];
|
$attributes = ['cn', 'dn'];
|
||||||
$users = [];
|
$users = [];
|
||||||
do {
|
|
||||||
$result = $this->access->searchUsers($filter, $attributes, null, $offset);
|
$result = $this->access->searchUsers($filter, $attributes);
|
||||||
foreach($result as $user) {
|
foreach($result as $user) {
|
||||||
$users[] = $user['cn'];
|
$users[] = $user['cn'];
|
||||||
}
|
}
|
||||||
$offset += count($users);
|
|
||||||
} while ($this->access->hasMoreResults());
|
if(count($users) === 4) {
|
||||||
if(count($users) === 2) {
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function case2() {
|
||||||
|
$filter = 'objectclass=inetorgperson';
|
||||||
|
$attributes = ['cn', 'dn'];
|
||||||
|
$users = [];
|
||||||
|
|
||||||
|
$result = $this->access->searchUsers($filter, $attributes, null, $this->pagingSize);
|
||||||
|
foreach($result as $user) {
|
||||||
|
$users[] = $user['cn'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($users) === 4 - $this->pagingSize) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ if (true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = ['alice', 'boris'];
|
$users = ['alice', 'boris', 'cynthia', 'derek'];
|
||||||
|
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
$newDN = 'uid=' . $uid . ',' . $ouDN;
|
$newDN = 'uid=' . $uid . ',' . $ouDN;
|
||||||
|
|
Loading…
Reference in New Issue