diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-09-16 16:17:25 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-09-16 16:17:25 +0200 |
commit | 7e2bff8545c7cbf0b63eb2b2ef2cae7dd625a245 (patch) | |
tree | d2f35eee7d9b069e8ded78b7f4e388e651dca9c9 /apps/user_ldap/tests | |
parent | 7458e21f2cfb00d6c0628ed41a0bcd7a87e19ee8 (diff) | |
download | nextcloud-server-7e2bff8545c7cbf0b63eb2b2ef2cae7dd625a245.tar.gz nextcloud-server-7e2bff8545c7cbf0b63eb2b2ef2cae7dd625a245.zip |
adding unit test to truncate the table
Diffstat (limited to 'apps/user_ldap/tests')
-rw-r--r-- | apps/user_ldap/tests/helper.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/user_ldap/tests/helper.php b/apps/user_ldap/tests/helper.php new file mode 100644 index 00000000000..07c24d64499 --- /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@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()); + } +} |