summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-01-11 13:31:32 -0300
committerVitor Mattos <vitor@php.rio>2022-01-21 08:37:06 -0300
commitb6d9e0542df4524b79e94a941663c57b2968ef7e (patch)
tree5207d03cde2449f027289902ed37b05bb8db6cdd
parent425b5cf081576d4af85cb33b5d8a3540b7ec6fd5 (diff)
downloadnextcloud-server-b6d9e0542df4524b79e94a941663c57b2968ef7e.tar.gz
nextcloud-server-b6d9e0542df4524b79e94a941663c57b2968ef7e.zip
Fix column size to work with Oracle. Add unit tests
Signed-off-by: Vitor Mattos <vitor@php.rio>
-rw-r--r--tests/lib/DB/QueryBuilder/QueryBuilderTest.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
index d94fda4852c..fab080eec86 100644
--- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
@@ -28,6 +28,7 @@ use OC\DB\QueryBuilder\Literal;
use OC\DB\QueryBuilder\Parameter;
use OC\DB\QueryBuilder\QueryBuilder;
use OC\SystemConfig;
+use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
use OCP\ILogger;
@@ -506,7 +507,13 @@ class QueryBuilderTest extends \Test\TestCase {
}
public function dataFrom() {
+ $config = $this->createMock(SystemConfig::class);
+ $logger = $this->createMock(ILogger::class);
+ $qb = new QueryBuilder(\OC::$server->getDatabaseConnection(), $config, $logger);
return [
+ [$qb->createFunction('(' . $qb->select('*')->from('test')->getSQL() . ')'), 'q', null, null, [
+ ['table' => '(SELECT * FROM `*PREFIX*test`)', 'alias' => '`q`']
+ ], '(SELECT * FROM `*PREFIX*test`) `q`'],
['data', null, null, null, [['table' => '`*PREFIX*data`', 'alias' => null]], '`*PREFIX*data`'],
['data', 't', null, null, [['table' => '`*PREFIX*data`', 'alias' => '`t`']], '`*PREFIX*data` `t`'],
['data1', null, 'data2', null, [
@@ -523,9 +530,9 @@ class QueryBuilderTest extends \Test\TestCase {
/**
* @dataProvider dataFrom
*
- * @param string $table1Name
+ * @param string|IQueryFunction $table1Name
* @param string $table1Alias
- * @param string $table2Name
+ * @param string|IQueryFunction $table2Name
* @param string $table2Alias
* @param array $expectedQueryPart
* @param string $expectedQuery