* dblayeroo: allow to sort the ORDER statements (the first added is the first use)
* dblayeroo: allow to sort the Display statements (the first added is the first use) * dblayeroo: change displayColumns to displayAdd git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3541 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -542,9 +542,9 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
// Filter on the db1, do not display db2
|
||||
$db1 = $this->db1 ();
|
||||
$db2 = $this->db2 ();
|
||||
$db2->displayColumn ();
|
||||
$db2->displayAdd ();
|
||||
$res = $db1->select ()
|
||||
->displayColumn ("group")
|
||||
->displayAdd ("group")
|
||||
->joinLeft ($db2, array ("group"=>"group"))
|
||||
->execute ();
|
||||
$db1->disconnect ();
|
||||
@@ -573,33 +573,33 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
// Filter on the db1, display one column in db2
|
||||
$db1 = $this->db1 ();
|
||||
$db2 = $this->db2 ();
|
||||
$db2->displayColumn ("group");
|
||||
$db2->displayAdd ("group");
|
||||
$res = $db1->select ()
|
||||
->displayColumn ("group")
|
||||
->displayAdd ("group")
|
||||
->joinLeft ($db2, array ("group"=>"group"))
|
||||
->execute ();
|
||||
$db1->disconnect ();
|
||||
$db2->disconnect ();
|
||||
$this->assertSame (array (
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group2',
|
||||
'usersoo.group' => NULL,
|
||||
'groupedoo.group' => 'group2',
|
||||
),
|
||||
), $res);
|
||||
}
|
||||
@@ -609,9 +609,9 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
// Filter on the db1 and add order in full mode
|
||||
$db1 = $this->db1 ();
|
||||
$db2 = $this->db2 ();
|
||||
$db2->displayColumn ("group");
|
||||
$db2->displayAdd ("group");
|
||||
$res = $db1->select ()
|
||||
->displayColumn ("group")
|
||||
->displayAdd ("group")
|
||||
->joinLeft ($db2, array ("group"=>"group"))
|
||||
->orderAdd ("group", "DESC")
|
||||
->execute ();
|
||||
@@ -619,24 +619,24 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
$db2->disconnect ();
|
||||
$this->assertSame (array (
|
||||
array (
|
||||
'groupedoo.group' => 'group2',
|
||||
'usersoo.group' => NULL,
|
||||
'groupedoo.group' => 'group2',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'usersoo.group' => 'group1',
|
||||
'groupedoo.group' => 'group1',
|
||||
),
|
||||
), $res);
|
||||
}
|
||||
@@ -660,18 +660,18 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
// Two joins tables in left join
|
||||
$db1 = $this->db1 (); // Do not display anything from groupedoo
|
||||
$db1->displayColumn ("group");
|
||||
$db1->displayAdd ("group")
|
||||
->orderAdd ("group", "DESC");
|
||||
|
||||
$db2 = $this->db2 (); // Display the gecos and group from usersoo
|
||||
$db2->displayColumn ("gecos")
|
||||
$db2->displayAdd ("gecos")
|
||||
->orderAdd ("gecos", "ASC");
|
||||
|
||||
$db4 = $this->db4 (); // Display the name in rightsoo
|
||||
$db4->displayColumn ("name");
|
||||
$db4->displayAdd ("name");
|
||||
$db1->joinLeft ($db4, array ("group"=>"group"));
|
||||
$res = $db1->select ()
|
||||
->joinLeft ($db2, array ("group"=>"group"))
|
||||
->orderAdd ("group", "DESC")
|
||||
->execute ();
|
||||
$db1->disconnect ();
|
||||
$db2->disconnect ();
|
||||
@@ -679,29 +679,58 @@ class test_dblayeroo_{ENGINE} extends PHPUnit_Framework_TestCase
|
||||
$this->assertSame (array (
|
||||
array (
|
||||
'groupedoo.group' => 'group2',
|
||||
'rightsoo.name' => NULL,
|
||||
'usersoo.gecos' => NULL,
|
||||
'rightsoo.name' => NULL,
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'rightsoo.name' => 'RO',
|
||||
'usersoo.gecos' => 'name',
|
||||
'rightsoo.name' => 'RO',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'rightsoo.name' => 'RO',
|
||||
'usersoo.gecos' => 'name2',
|
||||
'rightsoo.name' => 'RO',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'rightsoo.name' => 'RO',
|
||||
'usersoo.gecos' => 'name3',
|
||||
'rightsoo.name' => 'RO',
|
||||
),
|
||||
array (
|
||||
'groupedoo.group' => 'group1',
|
||||
'rightsoo.name' => 'RO',
|
||||
'usersoo.gecos' => 'name4',
|
||||
'rightsoo.name' => 'RO',
|
||||
),
|
||||
), $res);
|
||||
}
|
||||
|
||||
public function test_sortOrder1 ()
|
||||
{
|
||||
$db1 = $this->db1 ();
|
||||
$res = $db1->getSortOrder ();
|
||||
$db1->disconnect ();
|
||||
$this->assertSame ("order1", $res);
|
||||
}
|
||||
|
||||
public function test_sortOrder2 ()
|
||||
{
|
||||
$db1 = $this->db1 ();
|
||||
$db1->getSortOrder ();
|
||||
$res = $db1->getSortOrder ();
|
||||
$db1->disconnect ();
|
||||
$this->assertSame ("order2", $res);
|
||||
}
|
||||
|
||||
public function test_sortOrder3 ()
|
||||
{
|
||||
$db1 = $this->db1 ();
|
||||
$db2 = $this->db2 ();
|
||||
$db1->getSortOrder ();
|
||||
$db1->getSortOrder ();
|
||||
$res = $db2->getSortOrder ();
|
||||
$db1->disconnect ();
|
||||
$db2->disconnect ();
|
||||
$this->assertSame ("order3", $res);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user