Created
September 30, 2014 15:06
-
-
Save blizzz/1b4998422823f7a2d3af to your computer and use it in GitHub Desktop.
OC Paged Result Cancellation test script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$RUNTIME_NOAPPS = true; | |
require_once 'lib/base.php'; | |
\OC_App::loadApp('user_ldap'); | |
OCA\user_ldap\lib\Helper::clearMapping('user'); | |
$ldapWrapper = new OCA\user_ldap\lib\LDAP(); | |
$configPrefixes = OCA\user_ldap\lib\Helper::getServerConfigurationPrefixes(true); | |
$connector = new OCA\user_ldap\lib\Connection($ldapWrapper, $configPrefixes[0]); | |
$userManager = new OCA\user_ldap\lib\user\Manager(\OC::$server->getConfig(), | |
new OCA\user_ldap\lib\FilesystemHelper(), | |
new OCA\user_ldap\lib\LogWrapper(), | |
\OC::$server->getAvatarManager(), | |
new \OCP\Image()); | |
$ldapAccess = new OCA\user_ldap\lib\Access($connector, $ldapWrapper, $userManager); | |
$userBackend = new OCA\user_ldap\USER_LDAP($ldapAccess); | |
$users = $userBackend->getUsers('', 10, 0); | |
$ok = count($users) === 10; | |
if($ok) { | |
print('Step 1: fetching 10 users succeeded' . PHP_EOL); | |
} else { | |
print('Step 1: fetching 10 users failed, check your setup! Users found: ' . count($users) . PHP_EOL); | |
exit; | |
} | |
$ldapAccess->readAttribute($ldapAccess->connection->ldapAgentName, 'cn'); | |
print('Step 2: reading attribute done' . PHP_EOL); | |
$users = $userBackend->getUsers('', 10, 10); | |
$ok = count($users) === 10; | |
if($ok) { | |
print('Validation: cancelling Paged Search succeeded :) !' . PHP_EOL); | |
} else { | |
print('Validation: cancelling Paged Search failed! Users found: ' . count($users) . PHP_EOL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In line 12 the first active configuration is picked – if you have more and want to select a different one, you need to adjust the index accordingly.