/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new EmployeeTermination(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['EmployeeTermination'])) { $model->attributes = $_POST['EmployeeTermination']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
/** * @covers ::save * @covers ::get */ public function testGet() { $positionData = (object) array('reasons' => 'TOO COOL', 'attendance' => 'EVERY HOUR OF EVERY DAY', 'attitude' => 'GODLIKE', 'performance' => 'THE BEST', 'netID' => 'netId', 'submitter' => 'employee2', 'area' => 2, 'rehirable' => 'true', 'guid' => null); $positionAccessor = new EmployeeTermination(); $positionAccessor->save($positionData); $position = $positionAccessor->get('netId'); $this->assertEquals($position->reasons, 'TOO COOL'); $this->assertEquals($position->attendance, 'EVERY HOUR OF EVERY DAY'); $this->assertEquals($position->attitude, 'GODLIKE'); $this->assertEquals($position->performance, 'THE BEST'); $this->assertEquals($position->netID, 'netId'); $this->assertEquals($position->submitter, 'employee2'); $this->assertEquals($position->area, 2); $this->assertEquals($position->rehirable, 'true'); }