public function testQuoteValueWithPdoPgsql() { if (!$this->adapters['pdo_pgsql'] instanceof \PDO) { $this->markTestSkipped('Postgres (PDO_PGSQL) not configured in unit test configuration file'); } $pgsql = new Postgresql($this->adapters['pdo_pgsql']); $value = $pgsql->quoteValue('value'); $this->assertEquals('\'value\'', $value); $pgsql = new Postgresql(new Pdo\Pdo(new Pdo\Connection($this->adapters['pdo_pgsql']))); $value = $pgsql->quoteValue('value'); $this->assertEquals('\'value\'', $value); }
/** * @covers Zend\Db\Adapter\Platform\Postgresql::quoteIdentifierInFragment */ public function testQuoteIdentifierInFragment() { $this->assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar')); $this->assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar')); // single char words $this->assertEquals('("foo"."bar" = "boo"."baz")', $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', array('(', ')', '='))); // case insensitive safe words $this->assertEquals('("foo"."bar" = "boo"."baz") AND ("foo"."baz" = "boo"."baz")', $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz) AND (foo.baz = boo.baz)', array('(', ')', '=', 'and'))); }
/** * @covers Zend\Db\Adapter\Platform\Postgresql::quoteIdentifierInFragment */ public function testQuoteIdentifierInFragment() { $this->assertEquals('"foo"."bar"', $this->platform->quoteIdentifierInFragment('foo.bar')); $this->assertEquals('"foo" as "bar"', $this->platform->quoteIdentifierInFragment('foo as bar')); }
/** * @group ZF2-386 * @covers Zend\Db\Adapter\Platform\Postgresql::quoteIdentifierInFragment */ public function testQuoteIdentifierInFragmentIgnoresSingleCharSafeWords() { $this->assertEquals('("foo"."bar" = "boo"."baz")', $this->platform->quoteIdentifierInFragment('(foo.bar = boo.baz)', array('(', ')', '='))); }