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');
 }
Ejemplo n.º 2
0
 public function actionUpdate($id)
 {
     /* @var User $model */
     $model = User::findOne($id);
     if (!$model) {
         throw new NotFoundHttpException();
     }
     if ($model->load($_POST) && $model->save()) {
         $generator = new GeneratorUserConfig(['module' => $this->module, 'model' => $model]);
         $generator->generate();
         return $this->redirect(['index']);
     }
     return $this->render('update', ['model' => $model]);
 }