Postgres datasource support regular expression operators.

This commit is contained in:
nojimage 2013-02-22 10:14:06 +09:00
parent 9f25da49ef
commit 84725993e5
2 changed files with 19 additions and 0 deletions
lib/Cake/Test/Case/Model/Datasource/Database

View file

@ -486,6 +486,18 @@ class PostgresTest extends CakeTestCase {
$this->assertEquals($data, $result['BinaryTest']['data']);
}
/**
* Tests passing PostgreSQL regular expression operators when building queries
*
* @return void
*/
public function testRegexpOperatorConditionsParsing() {
$this->assertSame(' WHERE "name" ~ \'[a-z_]+\'', $this->Dbo->conditions(array('name ~' => '[a-z_]+')));
$this->assertSame(' WHERE "name" ~* \'[a-z_]+\'', $this->Dbo->conditions(array('name ~*' => '[a-z_]+')));
$this->assertSame(' WHERE "name" !~ \'[a-z_]+\'', $this->Dbo->conditions(array('name !~' => '[a-z_]+')));
$this->assertSame(' WHERE "name" !~* \'[a-z_]+\'', $this->Dbo->conditions(array('name !~*' => '[a-z_]+')));
}
/**
* Tests the syntax of generated schema indexes
*