summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-09-09 11:31:50 +0200
committerLukas Reschke <lukas@owncloud.com>2014-09-09 11:31:50 +0200
commit353155b516e862d71de4effc7c1a1cf61c289b57 (patch)
tree958f4e1e638cc62b8deae5873a95ba9ea31df885 /tests
parented2414fd0d983bd8e4682ded9c5b0c1b78c9fc97 (diff)
parentc4fa07d7cfa06073e8c59ad7641a4221a844254c (diff)
downloadnextcloud-server-353155b516e862d71de4effc7c1a1cf61c289b57.tar.gz
nextcloud-server-353155b516e862d71de4effc7c1a1cf61c289b57.zip
Merge pull request #7323 from owncloud/Jonny007-MKD-master
Update adapter.php
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/db.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib/db.php b/tests/lib/db.php
index 4b1a474c4ef..1f62413cbe4 100644
--- a/tests/lib/db.php
+++ b/tests/lib/db.php
@@ -125,6 +125,28 @@ class Test_DB extends PHPUnit_Framework_TestCase {
$this->assertEquals(4, count($result->fetchAll()));
}
+ public function testInsertIfNotExistNull() {
+ $categoryentries = array(
+ array('addressbookid' => 123, 'fullname' => null, 'expectedResult' => 1),
+ array('addressbookid' => 123, 'fullname' => null, 'expectedResult' => 0),
+ array('addressbookid' => 123, 'fullname' => 'test', 'expectedResult' => 1),
+ );
+
+ foreach($categoryentries as $entry) {
+ $result = OC_DB::insertIfNotExist('*PREFIX*'.$this->table2,
+ array(
+ 'addressbookid' => $entry['addressbookid'],
+ 'fullname' => $entry['fullname'],
+ ));
+ $this->assertEquals($entry['expectedResult'], $result);
+ }
+
+ $query = OC_DB::prepare('SELECT * FROM `*PREFIX*'.$this->table2.'`');
+ $result = $query->execute();
+ $this->assertTrue((bool)$result);
+ $this->assertEquals(2, count($result->fetchAll()));
+ }
+
public function testinsertIfNotExistDontOverwrite() {
$fullname = 'fullname test';
$uri = 'uri_1';