Skip to content
Snippets Groups Projects
Commit 7e2bff85 authored by Thomas Müller's avatar Thomas Müller
Browse files

adding unit test to truncate the table

parent 7458e21f
No related branches found
No related tags found
No related merge requests found
...@@ -172,7 +172,7 @@ class Helper { ...@@ -172,7 +172,7 @@ class Helper {
} }
/** /**
* extractsthe domain from a given URL * extracts the domain from a given URL
* @param string $url the URL * @param string $url the URL
* @return string|false domain as string on success, false otherwise * @return string|false domain as string on success, false otherwise
*/ */
......
<?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());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment