Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-01-03 17:04:05 +0300
committerVitor Mattos <vitor@php.rio>2022-01-03 18:45:00 +0300
commit7b9fea85b6e893aca874b7a0a07866443822005a (patch)
treec5f96ba7800a8ae60edcb3921fc83d01ebedffd8 /tests/lib/DB
parent79b3df00f82f3d0eee397f5389d23c8af1727afd (diff)
Add unit test and orderBy parameter
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests/lib/DB')
-rw-r--r--tests/lib/DB/QueryBuilder/FunctionBuilderTest.php26
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();