/** * Creates a new ProjectType model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new ProjectType(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * @covers \App\Services\Factories\ProjectTypeFactory::modify() */ public function testModify() { $projectType = new ProjectType(array('name' => 'Foo')); $projectType->save(); $input = array('name' => 'Bar'); $this->projectTypeFactory->modify($projectType, $input); $projectTypeRepository = App::make('\\App\\Repositories\\Eloquent\\EloquentProjectTypeRepository'); $this->assertEquals(1, $projectTypeRepository->all()->count()); $this->assertEquals('Bar', $projectTypeRepository->all()->first()->name); }