Code Duplication    Length = 25-26 lines in 2 locations

app/Containers/User/UI/API/Tests/Functional/RegisterUserTest.php 1 location

@@ 30-55 (lines=26) @@
27
    /**
28
     * @test
29
     */
30
    public function testRegisterNewUserWithCredentials_()
31
    {
32
        $data = [
33
            'email'    => '[email protected]',
34
            'name'     => 'Apiato',
35
            'password' => 'secretpass',
36
        ];
37
38
        // send the HTTP request
39
        $response = $this->makeCall($data);
40
41
        // assert response status is correct
42
        $response->assertStatus(200);
43
44
        $this->assertResponseContainKeyValue([
45
            'email' => $data['email'],
46
            'name'  => $data['name'],
47
        ]);
48
49
        $responseContent = $this->getResponseContentObject();
50
51
        $this->assertNotEmpty($responseContent->data);
52
53
         // assert the data is stored in the database
54
        $this->assertDatabaseHas('users', ['email' => $data['email']]);
55
    }
56
57
    /**
58
     * @test

app/Containers/User/UI/API/Tests/Functional/UpdateUserTest.php 1 location

@@ 28-52 (lines=25) @@
25
    /**
26
     * @test
27
     */
28
    public function testUpdateExistingUser_()
29
    {
30
        $user = $this->getTestingUser();
31
32
        $data = [
33
            'name'     => 'Updated Name',
34
            'password' => 'updated#Password',
35
        ];
36
37
        // send the HTTP request
38
        $response = $this->injectId($user->id)->makeCall($data);
39
40
        // assert response status is correct
41
        $response->assertStatus(200);
42
43
        // assert returned user is the updated one
44
        $this->assertResponseContainKeyValue([
45
            'object' => 'User',
46
            'email'  => $user->email,
47
            'name'   => $data['name'],
48
        ]);
49
50
        // assert data was updated in the database
51
        $this->assertDatabaseHas('users', ['name' => $data['name']]);
52
    }
53
54
    /**
55
     * @test