From 425fd36d05275425808d445dce65a88e6f90c9e7 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 12 Sep 2017 18:51:01 +0000 Subject: [PATCH] dblayeroo: Update tests to add DISTINCT in tests git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3945 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- Tests/dblayerooComplet.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Tests/dblayerooComplet.php b/Tests/dblayerooComplet.php index 627098d..38639bd 100644 --- a/Tests/dblayerooComplet.php +++ b/Tests/dblayerooComplet.php @@ -550,6 +550,7 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase ->displayAdd ("group") ->joinLeft ($tbl2, array ("group"=>"group")) ->orderAdd ("group", "ASC") +->debug (1) ->execute (); $tbl1->disconnect (); $tbl2->disconnect (); @@ -930,8 +931,30 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase $tbl1 = $this->tbl1 (); $tbl1->displayAdd ("group_concat (group ),group ", "Group Alias,Group2"); + // PGSQL generate an exception : + // function string_agg(character varying) does not exist + if ($this->engine === "pgsql") + $this->setExpectedException ("PDOException"); $res = $tbl1->select () ->execute (); $tbl1->disconnect (); + if ($this->engine !== "pgsql") + $this->assertSame (array ( + array ('Group Alias' => 'group1', + 'Group2' => 'group1',), + array ('Group Alias' => 'group2', + 'Group2' => 'group2',), + ), $res); + } + + public function test_displayAdd_DISTINCT1 () + { + $tbl1 = $this->tbl1 (); + $res = $tbl1->select () + ->displayAdd ("distinct where", "ALIAS") + ->execute (); + $tbl1->disconnect (); + $this->assertSame (array (0=>array ("ALIAS"=>"where2")), + $res); } }