mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding tests for #2414
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4911 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
91d4b05e9b
commit
5903e2226c
1 changed files with 56 additions and 4 deletions
|
@ -1285,6 +1285,58 @@ class DboSourceTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testParenthesisInStringConditions() {
|
||||
$result = $this->db->conditions('Member.name = \'Mariano Iglesias (mariano.iglesias)\'');
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions('Member.name = "Mariano Iglesias (mariano.iglesias)"');
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\"Mariano Iglesias \(mariano.iglesias\)\"$/', $result);
|
||||
}
|
||||
|
||||
function testParenthesisInArrayConditions() {
|
||||
$result = $this->db->conditions(array('Member.name' => '(lu'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(lu\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => ')lu'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\)lu\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => 'va(lu'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => 'va)lu'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\)lu\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => 'va(lu)'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => 'va(lu)e'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)e\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => '(mariano)'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => '(mariano)iglesias'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)iglesias\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => '(mariano) iglesias'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\) iglesias\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => '(mariano word) iglesias'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano word\) iglesias\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => '(mariano.iglesias)'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\)\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => 'Mariano Iglesias (mariano.iglesias)'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => 'Mariano Iglesias (mariano.iglesias) CakePHP'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\) CakePHP\'$/', $result);
|
||||
|
||||
$result = $this->db->conditions(array('Member.name' => '(mariano.iglesias) CakePHP'));
|
||||
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result);
|
||||
}
|
||||
|
||||
function testArrayConditionsParsing() {
|
||||
$result = $this->db->conditions(array('Candy.name' => 'LIKE a', 'HardCandy.name' => 'LIKE c'));
|
||||
$this->assertPattern("/^\s+WHERE\s+`Candy`.`name` LIKE\s+'a'\s+AND\s+`HardCandy`.`name`\s+LIKE\s+'c'/", $result);
|
||||
|
|
Loading…
Add table
Reference in a new issue