diff options
Diffstat (limited to 'tests/lib/DB/QueryBuilder/FunctionBuilderTest.php')
-rw-r--r-- | tests/lib/DB/QueryBuilder/FunctionBuilderTest.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php index a8af7f4fe07..0ddb50272bd 100644 --- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php @@ -198,4 +198,24 @@ class FunctionBuilderTest extends TestCase { $this->assertEquals(10, $query->execute()->fetchColumn()); } + + public function testGreatest() { + $query = $this->connection->getQueryBuilder(); + + $query->select($query->func()->greatest($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1))); + $query->from('appconfig') + ->setMaxResults(1); + + $this->assertEquals(2, $query->execute()->fetchColumn()); + } + + public function testLeast() { + $query = $this->connection->getQueryBuilder(); + + $query->select($query->func()->least($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1))); + $query->from('appconfig') + ->setMaxResults(1); + + $this->assertEquals(1, $query->execute()->fetchColumn()); + } } |