summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-07-11 12:13:54 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-07-11 14:08:19 +0200
commit537468f4c4c8692a3dab4f911c505bee119acc55 (patch)
treebe20e20ad4647e1befedd0271d9beb5e0d5189bd /apps/user_ldap
parentebee3543ce30a88ccb631796826b075676680cb9 (diff)
downloadnextcloud-server-537468f4c4c8692a3dab4f911c505bee119acc55.tar.gz
nextcloud-server-537468f4c4c8692a3dab4f911c505bee119acc55.zip
make tests deal with missing bcmath
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/access.php2
-rw-r--r--apps/user_ldap/tests/access.php29
2 files changed, 30 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 1ffe4d236f3..23ba4253ed3 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -1302,7 +1302,7 @@ class Access extends LDAPUtility implements user\IUserTools {
\OCP\Util::writeLog('user_ldap',
'You need to install bcmath module for PHP to have support ' .
'for AD primary groups', \OCP\Util::WARN);
- throw new \Excpetion('missing bcmath module');
+ throw new \Exception('missing bcmath module');
}
$srl = ord($sid[0]);
$numberSubID = ord($sid[1]);
diff --git a/apps/user_ldap/tests/access.php b/apps/user_ldap/tests/access.php
index 2ff7540b8ef..e77aad769d4 100644
--- a/apps/user_ldap/tests/access.php
+++ b/apps/user_ldap/tests/access.php
@@ -82,6 +82,10 @@ class Test_Access extends \PHPUnit_Framework_TestCase {
list($lw, $con, $um) = $this->getConnecterAndLdapMock();
$access = new Access($con, $lw, $um);
+ if(!function_exists('\bcadd')) {
+ $this->markTestSkipped('bcmath not available');
+ }
+
$sidBinary = file_get_contents(__DIR__ . '/data/sid.dat');
$sidExpected = 'S-1-5-21-249921958-728525901-1594176202';
@@ -92,12 +96,37 @@ class Test_Access extends \PHPUnit_Framework_TestCase {
list($lw, $con, $um) = $this->getConnecterAndLdapMock();
$access = new Access($con, $lw, $um);
+ if(!function_exists('\bcadd')) {
+ $this->markTestSkipped('bcmath not available');
+ }
+
$sidIllegal = 'foobar';
$sidExpected = '';
$this->assertSame($sidExpected, $access->convertSID2Str($sidIllegal));
}
+ public function testConvertSID2StrNoBCMath() {
+ if(function_exists('\bcadd')) {
+ $removed = false;
+ if(function_exists('runkit_function_remove')) {
+ $removed = !runkit_function_remove('\bcadd');
+ }
+ if(!$removed) {
+ $this->markTestSkipped('bcadd could not be removed for ' .
+ 'testing without bcmath');
+ }
+ }
+
+ list($lw, $con, $um) = $this->getConnecterAndLdapMock();
+ $access = new Access($con, $lw, $um);
+
+ $sidBinary = file_get_contents(__DIR__ . '/data/sid.dat');
+ $sidExpected = '';
+
+ $this->assertSame($sidExpected, $access->convertSID2Str($sidBinary));
+ }
+
public function testGetDomainDNFromDNSuccess() {
list($lw, $con, $um) = $this->getConnecterAndLdapMock();
$access = new Access($con, $lw, $um);