diff options
author | Vitor Mattos <vitor@php.rio> | 2022-01-03 11:04:05 -0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-01-03 12:45:00 -0300 |
commit | 7b9fea85b6e893aca874b7a0a07866443822005a (patch) | |
tree | c5f96ba7800a8ae60edcb3921fc83d01ebedffd8 /tests | |
parent | 79b3df00f82f3d0eee397f5389d23c8af1727afd (diff) | |
download | nextcloud-server-7b9fea85b6e893aca874b7a0a07866443822005a.tar.gz nextcloud-server-7b9fea85b6e893aca874b7a0a07866443822005a.zip |
Add unit test and orderBy parameter
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/DB/QueryBuilder/FunctionBuilderTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php index 71ae3d5c7f6..b824b86fecf 100644 --- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php @@ -54,6 +54,32 @@ class FunctionBuilderTest extends TestCase { $this->assertEquals('foobar', $column); } + public function testGroupConcatWithoutSeparatorAndOrder() { + $query = $this->connection->getQueryBuilder(); + + $query->select($query->func()->groupConcat('appid')); + $query->from('appconfig') + ->setMaxResults(1); + + $result = $query->execute(); + $column = $result->fetchOne(); + $result->closeCursor(); + $this->assertGreaterThan(1, str_getcsv($column, ',')); + } + + public function testGroupConcatWithSeparatorAndOrder() { + $query = $this->connection->getQueryBuilder(); + + $query->select($query->func()->groupConcat('appid', '#', 'appid')); + $query->from('appconfig') + ->setMaxResults(1); + + $result = $query->execute(); + $column = $result->fetchOne(); + $result->closeCursor(); + $this->assertGreaterThan(1, str_getcsv($column, '#', 'appid')); + } + public function testMd5() { $query = $this->connection->getQueryBuilder(); |