/** * @dataProvider deleteDataProvider */ public function testDelete($expectedSql, $table, $where, $bind) { $executeArgs = is_null($bind) ? [] : $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->delete($table, $where, $bind) : $this->crud->delete($table, $where) : $this->crud->delete($table); }
/** * @param string $table * @param string $where * @param array $bind * @return int */ public function delete($table, $where = '', array $bind = array()) { return $this->crud->delete($table, $where, $bind); }