mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding fixes for test in [4811] fixes Ticket #1100
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4812 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5e2d4167e3
commit
d0c8cde9ab
2 changed files with 5 additions and 5 deletions
|
@ -1529,7 +1529,7 @@ class DboSource extends DataSource {
|
|||
$end = preg_quote($this->endQuote);
|
||||
}
|
||||
$conditions = str_replace(array($start, $end), '', $conditions);
|
||||
preg_match_all('/(?:\'[^\'\\\]*(?:\\\.[^\'\\\]*)*\')|([a-z0-9_' . $start . $end . ']*\\.[a-z0-9_' . $start . $end . ']*)/i', $conditions, $replace, PREG_PATTERN_ORDER);
|
||||
preg_match_all('/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_' . $start . $end . ']*\\.[a-z0-9_' . $start . $end . ']*)/i', $conditions, $replace, PREG_PATTERN_ORDER);
|
||||
|
||||
if(isset($replace['1']['0'])) {
|
||||
$pregCount = count($replace['1']);
|
||||
|
|
|
@ -1000,21 +1000,21 @@ class DboSourceTest extends UnitTestCase {
|
|||
$expected = " WHERE DATEDIFF(NOW(),`Article`.`published`) < 1 && `Article`.`live`=1";
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
|
||||
function testQuotesInStringConditions() {
|
||||
$result = $this->db->conditions('Member.email = \'mariano@cricava.com\'');
|
||||
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$result = $this->db->conditions('Member.email = "mariano@cricava.com"');
|
||||
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com"';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$result = $this->db->conditions('Member.email = \'mariano@cricava.com\' AND Member.user LIKE \'mariano.iglesias%\'');
|
||||
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\' AND `Member`.`user` LIKE \'mariano.iglesias%\'';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
|
||||
$result = $this->db->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
|
||||
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
|
Loading…
Add table
Reference in a new issue