dblayeroo : Add test for GROUPBY

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4287 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2018-07-15 08:06:23 +00:00
parent 5deab3c430
commit b18adcc441

View File

@@ -974,7 +974,7 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
), $res); ), $res);
} }
public function test_displayAdd_MAX1 () public function test_displayAdd_MAX_GROUPBY1 ()
{ {
$tbl2 = $this->tbl2 (); $tbl2 = $this->tbl2 ();
$res = $tbl2->select () $res = $tbl2->select ()
@@ -991,7 +991,7 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
$res); $res);
} }
public function test_displayAdd_MAX2 () public function test_displayAdd_MAX_GROUPBY2 ()
{ {
$tbl2 = $this->tbl2 (); $tbl2 = $this->tbl2 ();
$res = $tbl2->select () $res = $tbl2->select ()
@@ -1000,4 +1000,22 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
$tbl2->disconnect (); $tbl2->disconnect ();
$this->assertSame (array (array ('MAX(uid)' => 6)), $res); $this->assertSame (array (array ('MAX(uid)' => 6)), $res);
} }
public function test_displayAdd_MAX_GROUPBY3 ()
{
$tbl1 = $this->tbl1 ();
$tbl2 = $this->tbl2 ();
$tbl1->select ()
->displayAdd ("group");
$res = $tbl2->select ()
->displayAdd ("MAX(uid)")
->joinInner ($tbl1, array ("group"=>"group"))
->debug (1)
->execute ();
$tbl2->disconnect ();
$this->assertSame (array (array (
'groupedoo.group' => 'group1',
'MAX(usersoo.uid)' => 6,
)), $res);
}
} }