/** * @dataProvider updateDataProvider */ public function testUpdate($expectedSql, $table, $data, $where, $bind) { $bind = is_null($bind) ? [] : $bind; $executeArgs = array_merge(array_values($data), $bind); // Returned stmt will have rowCount called $pdoStatement = $this->getMock('\\PDOStatement'); $pdoStatement->expects($this->once())->method('rowCount'); // Query should be called with the SQL and bind $this->adapter->expects($this->once())->method('query')->with($expectedSql, $executeArgs)->will($this->returnValue($pdoStatement)); $result = !is_null($where) ? !is_null($bind) ? $this->crud->update($table, $data, $where, $bind) : $this->crud->update($table, $data, $where) : $this->crud->update($table, $data); }
/** * @param string $table * @param array $data * @param string $where * @param array $bind * @return int */ public function update($table, array $data, $where = '', array $bind = array()) { return $this->crud->update($table, $data, $where, $bind); }