Ejemplo n.º 1
0
 public function testCreateModel()
 {
     $this->auth();
     $model = ModelModel::create('new model', 1);
     $this->assertTrue($model instanceof ModelModel);
 }
Ejemplo n.º 2
0
 /**
  * Create action.  Simply creates a new model.
  */
 public function createAction()
 {
     // fetch model parameters
     $modelParams = $this->_getParam('model');
     // make sure that another model with this name does not already exist
     if (count(ModelModel::findModelsByName($modelParams['name'])) > 0) {
         $this->flash('error', 'A model with the specified name already exists');
     } else {
         ModelModel::create($modelParams['name'], $modelParams['questionnaireID']);
     }
     // redirect back to the model selection screen
     $this->_redirector->gotoUrl("/compare?questionnaire={$this->_getParam('questionnaire')}");
 }