adapted integration tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
e9a853aa2a
commit
90fda8c23c
|
@ -59,38 +59,60 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tests that paging works properly against a simple example (reading all
|
* tests that paging works properly against a simple example (reading all
|
||||||
* of few users in smallest steps)
|
* of few users in small steps)
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function case1() {
|
protected function case1() {
|
||||||
$filter = 'objectclass=inetorgperson';
|
$filter = 'objectclass=inetorgperson';
|
||||||
$attributes = ['cn', 'dn'];
|
$attributes = ['cn', 'dn'];
|
||||||
$users = [];
|
|
||||||
|
|
||||||
$result = $this->access->searchUsers($filter, $attributes);
|
$result = $this->access->searchUsers($filter, $attributes);
|
||||||
foreach($result as $user) {
|
if(count($result) === 7) {
|
||||||
$users[] = $user['cn'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(count($users) === 4) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetch first three, afterwards all users
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
protected function case2() {
|
protected function case2() {
|
||||||
$filter = 'objectclass=inetorgperson';
|
$filter = 'objectclass=inetorgperson';
|
||||||
$attributes = ['cn', 'dn'];
|
$attributes = ['cn', 'dn'];
|
||||||
$users = [];
|
|
||||||
|
|
||||||
$result = $this->access->searchUsers($filter, $attributes, null, $this->pagingSize);
|
$result = $this->access->searchUsers($filter, $attributes, 4);
|
||||||
foreach($result as $user) {
|
// beware, under circumstances, the result set can be larger then
|
||||||
$users[] = $user['cn'];
|
// the specified limit! In this case, if we specify a limit of 3,
|
||||||
|
// the result will be 4, because the highest possible paging size
|
||||||
|
// is 2 (as configured).
|
||||||
|
// But also with more than one search base, the limit can be outpaced.
|
||||||
|
if(count($result) !== 4) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($users) === 4 - $this->pagingSize) {
|
$result = $this->access->searchUsers($filter, $attributes);
|
||||||
|
if(count($result) !== 7) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reads all remaining users starting first page
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function case3() {
|
||||||
|
$filter = 'objectclass=inetorgperson';
|
||||||
|
$attributes = ['cn', 'dn'];
|
||||||
|
|
||||||
|
$result = $this->access->searchUsers($filter, $attributes, null, $this->pagingSize);
|
||||||
|
if(count($result) === (7 - $this->pagingSize)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ if (true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = ['alice', 'boris', 'cynthia', 'derek'];
|
$users = ['alice', 'boris', 'cynthia', 'derek', 'evelina', 'fatima', 'gregor'];
|
||||||
|
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
$newDN = 'uid=' . $uid . ',' . $ouDN;
|
$newDN = 'uid=' . $uid . ',' . $ouDN;
|
||||||
|
|
Loading…
Reference in New Issue