예제 #1
0
 /**
  * @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());
 }
예제 #2
0
 /**
  * @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()));
 }
예제 #3
0
파일: UpdateTest.php 프로젝트: Rovak/zf2
 /**
  * @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);
 }