Adding more tests for #2414

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4912 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mariano.iglesias 2007-04-29 04:24:47 +00:00
parent 5903e2226c
commit 6978359505

View file

@ -1286,11 +1286,47 @@ class DboSourceTest extends UnitTestCase {
} }
function testParenthesisInStringConditions() { function testParenthesisInStringConditions() {
$result = $this->db->conditions('Member.name = \'(lu\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(lu\'$/', $result);
$result = $this->db->conditions('Member.name = \')lu\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\)lu\'$/', $result);
$result = $this->db->conditions('Member.name = \'va(lu\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\'$/', $result);
$result = $this->db->conditions('Member.name = \'va)lu\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\)lu\'$/', $result);
$result = $this->db->conditions('Member.name = \'va(lu)\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)\'$/', $result);
$result = $this->db->conditions('Member.name = \'va(lu)e\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'va\(lu\)e\'$/', $result);
$result = $this->db->conditions('Member.name = \'(mariano)\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)\'$/', $result);
$result = $this->db->conditions('Member.name = \'(mariano)iglesias\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\)iglesias\'$/', $result);
$result = $this->db->conditions('Member.name = \'(mariano) iglesias\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano\) iglesias\'$/', $result);
$result = $this->db->conditions('Member.name = \'(mariano word) iglesias\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano word\) iglesias\'$/', $result);
$result = $this->db->conditions('Member.name = \'(mariano.iglesias)\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\)\'$/', $result);
$result = $this->db->conditions('Member.name = \'Mariano Iglesias (mariano.iglesias)\''); $result = $this->db->conditions('Member.name = \'Mariano Iglesias (mariano.iglesias)\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result); $this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\)\'$/', $result);
$result = $this->db->conditions('Member.name = "Mariano Iglesias (mariano.iglesias)"'); $result = $this->db->conditions('Member.name = \'Mariano Iglesias (mariano.iglesias) CakePHP\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\"Mariano Iglesias \(mariano.iglesias\)\"$/', $result); $this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'Mariano Iglesias \(mariano.iglesias\) CakePHP\'$/', $result);
$result = $this->db->conditions('Member.name = \'(mariano.iglesias) CakePHP\'');
$this->assertPattern('/^\s+WHERE\s+`Member`.`name`\s+=\s+\'\(mariano.iglesias\) CakePHP\'$/', $result);
} }
function testParenthesisInArrayConditions() { function testParenthesisInArrayConditions() {