/** * @covers Zend\Db\Sql\Update::getSqlString */ public function testGetSqlString() { $this->update->table('foo')->set(array('bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null))->where('x = y'); $this->assertEquals('UPDATE "foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', $this->update->getSqlString()); // with TableIdentifier $this->update = new Update(); $this->update->table(new TableIdentifier('foo', 'sch'))->set(array('bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null))->where('x = y'); $this->assertEquals('UPDATE "sch"."foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', $this->update->getSqlString()); }
/** * @coversNothing */ public function testSpecificationconstantsCouldBeOverridedByExtensionInGetSqlString() { $this->update = new UpdateIgnore(); $this->update->table('foo')->set(array('bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null))->where('x = y'); $this->assertEquals('UPDATE IGNORE "foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', $this->update->getSqlString(new TrustingSql92Platform())); // with TableIdentifier $this->update = new UpdateIgnore(); $this->update->table(new TableIdentifier('foo', 'sch'))->set(array('bar' => 'baz', 'boo' => new Expression('NOW()'), 'bam' => null))->where('x = y'); $this->assertEquals('UPDATE IGNORE "sch"."foo" SET "bar" = \'baz\', "boo" = NOW(), "bam" = NULL WHERE x = y', $this->update->getSqlString(new TrustingSql92Platform())); }
/** * @covers Zend\Db\Sql\Update::getSqlString * @todo Implement testGetSqlString(). */ public function testGetSqlString() { $this->update->table('foo')->set(array('bar' => 'baz', 'boo' => new Expression('NOW()')))->where('x = y'); $this->assertEquals('UPDATE "foo" SET "bar" = \'baz\', "boo" = NOW() WHERE x = y', $this->update->getSqlString()); }
/** * @param string $expectedSql */ protected function assertTableGatewayLastSqlUpdate($expectedSql) { $actualSql = $this->update->getSqlString($this->mysqlPlatform); $this->assertSqlEquals($expectedSql, $actualSql); }