Example #1
0
 public function testUpdateMultiple()
 {
     $update = new Update('foo');
     $update->set('name', 'hello');
     $update->set('title', 'world');
     $update->whereEquals('id', 1);
     $update->limit(10);
     list($sql, $params) = $update->toQuery();
     $this->assertEqualsSql('UPDATE foo SET name = ?, title=? WHERE id=:id LIMIT 10', $sql);
     $this->assertEquals(array('hello', 'world', 1), $params);
 }
Example #2
0
 /**
  * Create a new update query builder
  *
  *     $h->table('users')->update(['age' => 25])->where('name', 'Johanna')
  *         
  * @param array                                  $values
  * @return Update
  */
 public function update(array $values = array())
 {
     $query = new Update($this);
     return $query->set($values);
 }
Example #3
0
 /**
  * @covers Zend\Db\Sql\Update::set
  */
 public function testSet()
 {
     $this->update->set(array('foo' => 'bar'));
     $this->assertEquals(array('foo' => 'bar'), $this->readAttribute($this->update, 'set'));
 }