public function testUpdateById() { $this->mockEngineMethod('updateById')->with($this->equalTo('table'), $this->equalTo([]), $this->equalTo('id'))->will($this->returnValue(true)); $this->assertTrue(DbClient::updateById('table', [], 'id')); }
/** * @return void */ public function update() { $row = $this->getRow(); if (isset($row['id'])) { $id = $row['id']; if (count($row) > 1) { unset($row['id']); DbClient::updateById(static::getTableName(), $row, $id); } } else { $class = get_called_class(); throw new DbActiveRecordException("Cannot update active record '{$class}' which is not persistent, " . "because column 'id' is missing."); } }