[Pkg-owncloud-commits] [owncloud] 82/258: adding unit test to truncate the table

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 82ccb04182c0e7035030e2435a812b59407ffc37
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Tue Sep 16 16:17:25 2014 +0200

    adding unit test to truncate the table
---
 apps/user_ldap/lib/helper.php   |  2 +-
 apps/user_ldap/tests/helper.php | 31 +++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php
index bce2823..ecda49f 100644
--- a/apps/user_ldap/lib/helper.php
+++ b/apps/user_ldap/lib/helper.php
@@ -172,7 +172,7 @@ class Helper {
 	}
 
 	/**
-	 * extractsthe domain from a given URL
+	 * extracts the domain from a given URL
 	 * @param string $url the URL
 	 * @return string|false domain as string on success, false otherwise
 	 */
diff --git a/apps/user_ldap/tests/helper.php b/apps/user_ldap/tests/helper.php
new file mode 100644
index 0000000..07c24d6
--- /dev/null
+++ b/apps/user_ldap/tests/helper.php
@@ -0,0 +1,31 @@
+<?php
+/**
+* ownCloud
+*
+* @author Thomas Müller
+* @copyright 2014 Thomas Müller deepdiver at owncloud.com
+*
+*/
+
+namespace OCA\user_ldap\tests;
+
+use OCA\user_ldap\lib\Helper;
+
+class Test_Helper extends \PHPUnit_Framework_TestCase {
+
+	public function testTableTruncate() {
+
+		$statement = \OCP\DB::prepare('INSERT INTO `*PREFIX*ldap_user_mapping` (`ldap_dn`, `owncloud_name`, `directory_uuid`) VALUES (?, ?, ?)');
+		$statement->execute(array('db01', 'oc1', '000-0000-0000'));
+		$statement->execute(array('db02', 'oc2', '000-0000-0001'));
+
+		$statement = \OCP\DB::prepare('SELECT count(*) FROM `*PREFIX*ldap_user_mapping`');
+		$result = $statement->execute();
+		$this->assertEquals(2, $result->fetchOne());
+
+		Helper::clearMapping('user');
+
+		$result = $statement->execute();
+		$this->assertEquals(0, $result->fetchOne());
+	}
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list