public function updating(TaskType $taskType) { // check to see if the task_type.type exists. $result = $taskType->checkIfTypeExists($taskType); if ($result > 0) { session()->forget(appGlobals()->getInfoMessageType()); session()->flash(appGlobals()->getInfoMessageType(), appGlobals()->getInfoMessageText($result)); return false; } return true; }
/** * audit test * - check checkIfTypeContainsMultipleWords() -- return appGlobals()::TBL_TASK_TYPE_TYPE_RESTRICTED_TO_ONE_WORD * * @test */ public function NEG_it_checks_create_audits_checking_checkIfTypeContainsMultipleWords() { $type = 'Bob is not here'; $taskType = new TaskType(); $taskType->setType($type); $taskType->setDescription('was here'); $taskType->created_at = Carbon::now(); $taskType->updated_at = Carbon::now(); $taskType->client_id = 1; $result = $taskType->checkTaskTypeCreateAudits($taskType); $this->assertEquals($result, appGlobals()::TBL_TASK_TYPE_TYPE_RESTRICTED_TO_ONE_WORD); }
/** * @param $taskType * * @return int|mixed */ public function checkIfTypeConstraintExists($taskType) { /* @noinspection PhpUndefinedMethodInspection */ $val = Task::where('task_type_id', '=', $taskType->id)->first(); if (!is_null($val)) { return appGlobals()::TBL_TASK_TYPE_CONSTRAINT_VIOLATION; } return 0; }