mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Fixed tests
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4817 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
81b473f2a3
commit
0fbcd7f9a4
1 changed files with 11 additions and 7 deletions
|
@ -248,7 +248,7 @@ class TestModel8 extends Model {
|
|||
var $hasOne = array(
|
||||
'TestModel9' => array(
|
||||
'className' => 'TestModel9',
|
||||
'foreignKey' => 'test_model8_id',
|
||||
'foreignKey' => 'test_model9_id',
|
||||
'conditions' => 'TestModel9.name != \'mariano\''
|
||||
)
|
||||
);
|
||||
|
@ -257,6 +257,7 @@ class TestModel8 extends Model {
|
|||
if (!isset($this->_tableInfo)) {
|
||||
$this->_tableInfo = new Set(array(
|
||||
array('name' => 'id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
|
||||
array('name' => 'test_model9_id', 'type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
|
||||
array('name' => 'name', 'type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||
array('name' => 'created', 'type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||
array('name' => 'updated', 'type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||
|
@ -698,7 +699,7 @@ class DboSourceTest extends UnitTestCase {
|
|||
$this->assertPattern('/\s+WHERE\s+1 = 1\s+$/', $result);
|
||||
}
|
||||
|
||||
function testGenerateAssociationQuerySelfJoinWithConditionsInBinding() {
|
||||
function testGenerateAssociationQuerySelfJoinWithConditionsInHasOneBinding() {
|
||||
$this->model = new TestModel8();
|
||||
$this->model->loadInfo();
|
||||
$this->_buildRelatedModels($this->model);
|
||||
|
@ -716,11 +717,13 @@ class DboSourceTest extends UnitTestCase {
|
|||
|
||||
$result = $this->db->generateAssociationQuery($this->model, $null, null, null, null, $queryData, false, $null);
|
||||
|
||||
$this->assertPattern('/^SELECT\s+`TestModel8`\.`id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`, `TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`\s+/', $result);
|
||||
$this->assertPattern('/^SELECT\s+`TestModel8`\.`id`, `TestModel8`\.`test_model9_id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`, `TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`\s+/', $result);
|
||||
$this->assertPattern('/FROM\s+`test_model8` AS `TestModel8`\s+LEFT JOIN\s+`test_model9` AS `TestModel9`/', $result);
|
||||
$this->assertPattern('/\s+ON\s+\(`TestModel8`.`test_model8_id` = `TestModel9`.`id`\s+AND\s+`TestModel9`\.`name` != \'mariano\'\)\s+WHERE/', $result);
|
||||
$this->assertPattern('/\s+ON\s+\(`TestModel8`.`test_model9_id` = `TestModel9`.`id`\s+AND\s+`TestModel9`\.`name` != \'mariano\'\)\s+WHERE/', $result);
|
||||
$this->assertPattern('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||
|
||||
}
|
||||
|
||||
function testGenerateAssociationQuerySelfJoinWithConditionsInBelongsToBinding() {
|
||||
$this->model = new TestModel9();
|
||||
$this->model->loadInfo();
|
||||
$this->_buildRelatedModels($this->model);
|
||||
|
@ -738,7 +741,7 @@ class DboSourceTest extends UnitTestCase {
|
|||
|
||||
$result = $this->db->generateAssociationQuery($this->model, $null, null, null, null, $queryData, false, $null);
|
||||
|
||||
$this->assertPattern('/^SELECT\s+`TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`, `TestModel8`\.`id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`\s+/', $result);
|
||||
$this->assertPattern('/^SELECT\s+`TestModel9`\.`id`, `TestModel9`\.`test_model8_id`, `TestModel9`\.`name`, `TestModel9`\.`created`, `TestModel9`\.`updated`, `TestModel8`\.`id`, `TestModel8`\.`test_model9_id`, `TestModel8`\.`name`, `TestModel8`\.`created`, `TestModel8`\.`updated`\s+/', $result);
|
||||
$this->assertPattern('/FROM\s+`test_model9` AS `TestModel9`\s+LEFT JOIN\s+`test_model8` AS `TestModel8`/', $result);
|
||||
$this->assertPattern('/\s+ON\s+\(`TestModel9`.`test_model8_id` = `TestModel8`.`id`\s+AND\s+`TestModel8`\.`name` != \'larry\'\)\s+WHERE/', $result);
|
||||
$this->assertPattern('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||
|
@ -846,9 +849,10 @@ class DboSourceTest extends UnitTestCase {
|
|||
$this->assertTrue($result);
|
||||
|
||||
$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`, `TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+/', $result);
|
||||
$this->assertPattern('/\s+FROM\s+`test_model4` AS `TestModel4`\s+LEFT JOIN\s+`test_model5` AS `TestModel5`/', $result);
|
||||
$this->assertPattern('/\s+ON\s+\(`TestModel5`.`test_model4_id`\s+=\s+`TestModel4`.`id`\s+AND\s+`TestModel5`.`name`\s+!=\s+\'mariano\'\)\s+WHERE/', $result);
|
||||
$this->assertPattern('/\s+ON\s+\(`TestModel5`.`test_model4_id`\s+=\s+`TestModel4`.`id`\)\s+WHERE/', $result);
|
||||
$this->assertPattern('/\s+WHERE\s+(?:\()?\s*`TestModel5`.`name`\s+!=\s+\'mariano\'\s*(?:\))?\s*$/', $result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue