From 11dfe0b40c1d7f8ec72b4ffb988fc773a4843d69 Mon Sep 17 00:00:00 2001 From: Eric Jiang <eric@doublemap.com> Date: Sat, 21 May 2016 15:47:09 -0700 Subject: [PATCH] Add test case for trailing hyphen in column name --- .../Test/Case/Model/Datasource/DboSourceTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index 5de319547..306d6a071 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -197,6 +197,18 @@ class DboSourceTest extends CakeTestCase { $this->assertEquals(' WHERE 1 = 1', $result, 'nested empty conditions failed'); } +/** + * test that PostgreSQL json operators can be used. + * + * @return void + */ + public function testColumnHyphenOperator() { + $result = $this->testDb->conditions(array('Foo.bar->>\'fieldName\'' => 42)); + echo "Result is: "; + echo $result; + $this->assertEquals(' WHERE `Foo`.`bar`->>\'fieldName\' = 42', $result, 'pgsql json operator failed'); + } + /** * test that order() will accept objects made from DboSource::expression *