public function testGenerate()
 {
     /* @var User $model */
     $model = $this->model->findOne(['username' => 'choateyao']);
     $this->generator->setModel($model);
     $this->generator->setModule(new Module('vsftpd', null, ['vsftpdUserConfigPath' => '/tmp']));
     $this->assertEquals(strlen($model->buildConfigBySetting()), $this->generator->generate());
     $this->assertFileExists('/tmp/choateyao');
 }
예제 #2
0
 public function actionDelete($id)
 {
     /* @var User $model */
     $model = User::findOne($id);
     if (!$model) {
         throw new NotFoundHttpException();
     }
     $generator = new GeneratorUserConfig(['module' => $this->module, 'model' => $model]);
     $generator->remove();
     $model->delete();
     return $this->redirect(['index']);
 }