diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-11 15:36:44 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-09-14 13:20:51 +0200 |
commit | 0b625069e83e9d4e653ba5a3332ee694de22e0cf (patch) | |
tree | f26f93e79f7374058ea16e238bc8a38029490ac5 /apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php | |
parent | 5e74affea499607f5ff4724a0748579d15db7a39 (diff) | |
download | nextcloud-server-0b625069e83e9d4e653ba5a3332ee694de22e0cf.tar.gz nextcloud-server-0b625069e83e9d4e653ba5a3332ee694de22e0cf.zip |
adapted integration tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php')
-rw-r--r-- | apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php b/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php index f6d6175c93b..35d8524fd88 100644 --- a/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php +++ b/apps/user_ldap/tests/Integration/Lib/IntegrationTestPaging.php @@ -59,38 +59,60 @@ class IntegrationTestPaging extends AbstractIntegrationTest { /** * 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 */ protected function case1() { $filter = 'objectclass=inetorgperson'; $attributes = ['cn', 'dn']; - $users = []; $result = $this->access->searchUsers($filter, $attributes); - foreach($result as $user) { - $users[] = $user['cn']; - } - - if(count($users) === 4) { + if(count($result) === 7) { return true; } return false; } + /** + * fetch first three, afterwards all users + * + * @return bool + */ 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']; + $result = $this->access->searchUsers($filter, $attributes, 4); + // beware, under circumstances, the result set can be larger then + // 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; + } + + $result = $this->access->searchUsers($filter, $attributes); + if(count($result) !== 7) { + return false; } - if(count($users) === 4 - $this->pagingSize) { + 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; } |