diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-09-16 21:03:03 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-09-16 21:03:03 +0200 |
commit | 95815c0b57c0d255a1ad5dd71d8f925fc5cc4588 (patch) | |
tree | c81f4509fbadfc58d0f2ad9d55ffdba45606e662 /tests/lib | |
parent | ca35d86c5a85485a418916ebf236b575d4401136 (diff) | |
download | nextcloud-server-95815c0b57c0d255a1ad5dd71d8f925fc5cc4588.tar.gz nextcloud-server-95815c0b57c0d255a1ad5dd71d8f925fc5cc4588.zip |
add test case for ILIKE with wildcard
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/db.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/lib/db.php b/tests/lib/db.php index 22792930f0a..d4270737d86 100644 --- a/tests/lib/db.php +++ b/tests/lib/db.php @@ -283,4 +283,35 @@ class Test_DB extends PHPUnit_Framework_TestCase { $result = $query->execute(array('foobar')); $this->assertCount(1, $result->fetchAll()); } + + public function testILIKEWildcard() { + $table = "*PREFIX*{$this->table2}"; + + $query = OC_DB::prepare("INSERT INTO `$table` (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)"); + $query->execute(array('FooBAR', 'foo', 'bar')); + + $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); + $result = $query->execute(array('%bar')); + $this->assertCount(0, $result->fetchAll()); + + $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); + $result = $query->execute(array('foo%')); + $this->assertCount(0, $result->fetchAll()); + + $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` LIKE ?"); + $result = $query->execute(array('%ba%')); + $this->assertCount(0, $result->fetchAll()); + + $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); + $result = $query->execute(array('%bar')); + $this->assertCount(1, $result->fetchAll()); + + $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); + $result = $query->execute(array('foo%')); + $this->assertCount(1, $result->fetchAll()); + + $query = OC_DB::prepare("SELECT * FROM `$table` WHERE `fullname` ILIKE ?"); + $result = $query->execute(array('%ba%')); + $this->assertCount(1, $result->fetchAll()); + } } |