mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixed test to used array based self join
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4771 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f0cd2d49ea
commit
a53e15ee51
1 changed files with 30 additions and 3 deletions
|
@ -595,9 +595,36 @@ class DboSourceTest extends UnitTestCase {
|
||||||
$result = $this->db->generateSelfAssociationQuery($this->model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external'], $resultSet);
|
$result = $this->db->generateSelfAssociationQuery($this->model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external'], $resultSet);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
|
|
||||||
//$this->assertPattern('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel4Parent`\.`id`, `TestModel4Parent`\.`name`, `TestModel4Parent`\.`created`, `TestModel4Parent`\.`updated`\s+/', $queryData['selfJoin'][0]);
|
$expected = array (array (
|
||||||
//$this->assertPattern('/FROM\s+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+`test_model4` AS `TestModel4Parent`/', $queryData['selfJoin'][0]);
|
'fields' => array (
|
||||||
//$this->assertPattern('/\s+ON\s+\(`TestModel4`.`parent_id` = `TestModel4Parent`.`id`\)\s+WHERE\s+1 = 1\s*$/', $queryData['selfJoin'][0]);
|
'`TestModel4`.`id`',
|
||||||
|
'`TestModel4`.`name`',
|
||||||
|
'`TestModel4`.`created`',
|
||||||
|
'`TestModel4`.`updated`',
|
||||||
|
'`TestModel4Parent`.`id`',
|
||||||
|
'`TestModel4Parent`.`name`',
|
||||||
|
'`TestModel4Parent`.`created`',
|
||||||
|
'`TestModel4Parent`.`updated`'
|
||||||
|
),
|
||||||
|
'joins' => array (
|
||||||
|
array (
|
||||||
|
'table' => '`test_model4`',
|
||||||
|
'alias' => 'TestModel4Parent',
|
||||||
|
'type' => 'LEFT',
|
||||||
|
'conditions' => array (
|
||||||
|
'`TestModel4`.`parent_id`' => '{$__cakeIdentifier[TestModel4Parent.id]__$}'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
'table' => '`test_model4`',
|
||||||
|
'alias' => 'TestModel4',
|
||||||
|
'limit' => array ( ),
|
||||||
|
'offset' => array ( ),
|
||||||
|
'conditions' => array ( ),
|
||||||
|
'order' => array ( )
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->assertEqual($queryData['selfJoin'], $expected);
|
||||||
|
|
||||||
$result = $this->db->generateAssociationQuery($this->model, $null, null, null, null, $queryData, false, $null);
|
$result = $this->db->generateAssociationQuery($this->model, $null, null, null, null, $queryData, false, $null);
|
||||||
$this->assertPattern('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel4Parent`\.`id`, `TestModel4Parent`\.`name`, `TestModel4Parent`\.`created`, `TestModel4Parent`\.`updated`\s+/', $result);
|
$this->assertPattern('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`, `TestModel4Parent`\.`id`, `TestModel4Parent`\.`name`, `TestModel4Parent`\.`created`, `TestModel4Parent`\.`updated`\s+/', $result);
|
||||||
|
|
Loading…
Add table
Reference in a new issue