Conversation
velkymx
left a comment
There was a problem hiding this comment.
If you use a variable once, just remove it and put in the value.
| $data['PRO_UID'] = $process->PRO_UID; | ||
| $data['PRO_ID'] = $process->PRO_ID; | ||
| $data['uid'] = Uuid::uuid4(); | ||
| // $data['PRO_UID'] = $process->uid; |
| @@ -35,15 +23,34 @@ public function testCreateProcess(): Process | |||
| public function testCreateUser(): User | |||
There was a problem hiding this comment.
This is not the correct place for this test.
| * @depends testCreateUser | ||
| * @return Process | ||
| */ | ||
| public function testCreateProcess(User $user): Process |
There was a problem hiding this comment.
Not the right place. This should be in a process test
| $this->auth($user->USR_USERNAME, self::DEFAULT_PASS); | ||
| $this->auth($user->username, self::DEFAULT_PASS); | ||
|
|
||
| $structure = [ |
There was a problem hiding this comment.
Just move this into $response->assertJsonStructure($structure); you're only using it once.
| $url = self::API_ROUTE . $process->uid . '/dynaform'; | ||
| $response = $this->api('POST', $url, $data); | ||
| //validating the answer is an error | ||
| $response->assertStatus(404); |
There was a problem hiding this comment.
Is 404 the correct response? Page not found?
| $id = $response->json('DYN_ID'); | ||
| $id = $response->json('id'); | ||
| //Check structure of response. | ||
| $response->assertJsonStructure($structure); |
There was a problem hiding this comment.
Put in JSON direct. No variable needed
| @@ -270,8 +272,8 @@ public function testGetDynaform(Process $process, User $user, Dynaform $Dynaform | |||
| $response->assertJsonStructure($structure); | |||
There was a problem hiding this comment.
Insert json remove variable
| //validating the answer is correct. | ||
| $response->assertStatus(422); | ||
| return Dynaform::where('DYN_ID', $id)->get()->first(); | ||
| return Dynaform::where('id', $id)->get()->first(); |
There was a problem hiding this comment.
->get()->first() is redundant just use ->first()
| @@ -270,8 +272,8 @@ public function testGetDynaform(Process $process, User $user, Dynaform $Dynaform | |||
| $response->assertJsonStructure($structure); | |||
| $url = self::API_ROUTE . $process->uid . '/dynaform/' . $dynaform->uid; | ||
| $response = $this->api('DELETE', $url); | ||
| //Validate the answer is correct | ||
| $response->assertStatus(200); |
There was a problem hiding this comment.
Can we use a different return on delete? A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity.
Change the field PRO_ID to process_id, and fields to lowercase