/** * @return \yii\web\Response */ public function actionDelete() { $model = new RedisItem(); $model->scenario = 'delete'; if ($model->load(\Yii::$app->request->post()) && $model->validate()) { $model->delete(); } else { \Yii::$app->session->setFlash('error', Html::errorSummary($model, ['encode' => true])); } return $this->redirect(Url::to(['/redisman/default/show'])); }
public function testDelete() { $model = new RedisItem(); $model->setAttributes(['key' => 'tfx_string']); $model->scenario = 'delete'; $this->assertTrue($model->validate()); $model->delete(); $this->assertEquals(0, $this->module->executeCommand('EXISTS', ['tfx_string'])); }