diff options
author | Joas Schilling <coding@schilljs.com> | 2022-01-03 17:25:45 +0100 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-01-03 21:43:51 -0300 |
commit | 43fa2d5c8cbbe3dc4976feedd565ddf837af1dfc (patch) | |
tree | fd40b8a43c8aff01536a5f3bb554e2780f45bdfb /tests | |
parent | fb6a9f308d01148a35f8aa7c8cb6b4a5fa5b220f (diff) | |
download | nextcloud-server-43fa2d5c8cbbe3dc4976feedd565ddf837af1dfc.tar.gz nextcloud-server-43fa2d5c8cbbe3dc4976feedd565ddf837af1dfc.zip |
Test with real data
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/DB/QueryBuilder/FunctionBuilderTest.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php index 938ab6d2b05..a0ae05d0149 100644 --- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php @@ -58,7 +58,7 @@ class FunctionBuilderTest extends TestCase { $delete = $this->connection->getQueryBuilder(); $delete->delete('appconfig') - ->where($delete->expr()->eq('appid', $delete->createNamedParameter('group_concat', IQueryBuilder::PARAM_STR))); + ->where($delete->expr()->eq('appid', $delete->createNamedParameter('group_concat'))); $delete->executeStatement(); } @@ -67,9 +67,9 @@ class FunctionBuilderTest extends TestCase { $insert = $this->connection->getQueryBuilder(); $insert->insert('appconfig') - ->setValue('appid', $insert->createNamedParameter('group_concat', IQueryBuilder::PARAM_STR)) - ->setValue('configvalue', $insert->createNamedParameter('unittest', IQueryBuilder::PARAM_STR)) - ->setValue('configkey', $insert->createParameter('value', IQueryBuilder::PARAM_STR)); + ->setValue('appid', $insert->createNamedParameter('group_concat')) + ->setValue('configvalue', $insert->createNamedParameter('unittest')) + ->setValue('configkey', $insert->createParameter('value')); $insert->setParameter('value', '1'); $insert->executeStatement(); @@ -90,10 +90,13 @@ class FunctionBuilderTest extends TestCase { $result = $query->execute(); $column = $result->fetchOne(); $result->closeCursor(); - $this->assertGreaterThan(1, str_getcsv($column, ',')); + $this->assertStringContainsString(',', $column); + $actual = explode(',', $column); + $this->assertEqualsCanonicalizing([1,2,3], $actual); } - public function testGroupConcatWithSeparatorAndOrder() { + public function testGroupConcatWithSeparator() { + $this->addDummyData(); $query = $this->connection->getQueryBuilder(); $query->select($query->func()->groupConcat('configkey', '#')) @@ -103,7 +106,9 @@ class FunctionBuilderTest extends TestCase { $result = $query->execute(); $column = $result->fetchOne(); $result->closeCursor(); - $this->assertGreaterThan(1, str_getcsv($column, '#', 'appid')); + $this->assertStringContainsString('#', $column); + $actual = explode('#', $column); + $this->assertEqualsCanonicalizing([1,2,3], $actual); } public function testMd5() { |