diff options
author | Vitor Mattos <vitor@php.rio> | 2022-01-11 12:20:13 -0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-01-21 08:37:06 -0300 |
commit | afe5b6dd8aa9a0eb761434231327e8daecb1d79e (patch) | |
tree | e3792c47644857a894e3451ef493ec6184b19db6 /tests | |
parent | a7c0868a4cc7a0f041484800ad56901f11086459 (diff) | |
download | nextcloud-server-afe5b6dd8aa9a0eb761434231327e8daecb1d79e.tar.gz nextcloud-server-afe5b6dd8aa9a0eb761434231327e8daecb1d79e.zip |
Prevent query error when use subquery
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/DB/QueryBuilder/QueryBuilderTest.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index 19278504707..d94fda4852c 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -1204,6 +1204,9 @@ class QueryBuilderTest extends \Test\TestCase { } public function dataGetTableName() { + $config = $this->createMock(SystemConfig::class); + $logger = $this->createMock(ILogger::class); + $qb = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger); return [ ['*PREFIX*table', null, '`*PREFIX*table`'], ['*PREFIX*table', true, '`*PREFIX*table`'], @@ -1212,13 +1215,17 @@ class QueryBuilderTest extends \Test\TestCase { ['table', null, '`*PREFIX*table`'], ['table', true, '`*PREFIX*table`'], ['table', false, '`table`'], + + [$qb->createFunction('(' . $qb->select('*')->from('table')->getSQL() . ')'), null, '(SELECT * FROM `*PREFIX*table`)'], + [$qb->createFunction('(' . $qb->select('*')->from('table')->getSQL() . ')'), true, '(SELECT * FROM `*PREFIX*table`)'], + [$qb->createFunction('(' . $qb->select('*')->from('table')->getSQL() . ')'), false, '(SELECT * FROM `*PREFIX*table`)'], ]; } /** * @dataProvider dataGetTableName * - * @param string $tableName + * @param string|IQueryFunction $tableName * @param bool $automatic * @param string $expected */ |