mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding double-escaping test case for DboSource, disproves #4196
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6476 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
4e573f48f0
commit
f056ee4a3d
1 changed files with 46 additions and 16 deletions
|
@ -630,6 +630,38 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$time = microtime(true) - $start;
|
$time = microtime(true) - $start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testFieldDoubleEscaping() {
|
||||||
|
$test =& ConnectionManager::create('quoteTest', array('driver' => 'test'));
|
||||||
|
|
||||||
|
$this->Model = new Article2(array('name' => 'Article', 'ds' => 'quoteTest'));
|
||||||
|
$this->Model->setDataSource('quoteTest');
|
||||||
|
|
||||||
|
$this->assertEqual($this->Model->escapeField(), '`Article`.`id`');
|
||||||
|
$result = $test->fields($this->Model, null, $this->Model->escapeField());
|
||||||
|
$this->assertEqual($result, array('`Article`.`id`'));
|
||||||
|
|
||||||
|
$result = $test->read($this->Model, array(
|
||||||
|
'fields' => $this->Model->escapeField(),
|
||||||
|
'conditions' => null,
|
||||||
|
'recursive' => -1
|
||||||
|
));
|
||||||
|
$this->assertEqual(trim($test->simulated[0]), 'SELECT `Article`.`id` FROM `article` AS `Article` WHERE 1 = 1');
|
||||||
|
|
||||||
|
$test->startQuote = '[';
|
||||||
|
$test->endQuote = ']';
|
||||||
|
$this->assertEqual($this->Model->escapeField(), '[Article].[id]');
|
||||||
|
|
||||||
|
$result = $test->fields($this->Model, null, $this->Model->escapeField());
|
||||||
|
$this->assertEqual($result, array('[Article].[id]'));
|
||||||
|
|
||||||
|
$result = $test->read($this->Model, array(
|
||||||
|
'fields' => $this->Model->escapeField(),
|
||||||
|
'conditions' => null,
|
||||||
|
'recursive' => -1
|
||||||
|
));
|
||||||
|
$this->assertEqual(trim($test->simulated[1]), 'SELECT [Article].[id] FROM [article] AS [Article] WHERE 1 = 1');
|
||||||
|
}
|
||||||
|
|
||||||
function testGenerateAssociationQuerySelfJoin() {
|
function testGenerateAssociationQuerySelfJoin() {
|
||||||
$this->startTime = microtime(true);
|
$this->startTime = microtime(true);
|
||||||
$this->Model = new Article2();
|
$this->Model = new Article2();
|
||||||
|
@ -690,9 +722,7 @@ class DboSourceTest extends CakeTestCase {
|
||||||
'table' => '`test_model4`',
|
'table' => '`test_model4`',
|
||||||
'alias' => 'TestModel4Parent',
|
'alias' => 'TestModel4Parent',
|
||||||
'type' => 'LEFT',
|
'type' => 'LEFT',
|
||||||
'conditions' => array (
|
'conditions' => array('`TestModel4`.`parent_id`' => '{$__cakeIdentifier[TestModel4Parent.id]__$}')
|
||||||
'`TestModel4`.`parent_id`' => '{$__cakeIdentifier[TestModel4Parent.id]__$}'
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'table' => '`test_model4`',
|
'table' => '`test_model4`',
|
||||||
|
|
Loading…
Add table
Reference in a new issue