Code Duplication    Length = 14-16 lines in 3 locations

tests/CommentAPITest.php 1 location

@@ 93-106 (lines=14) @@
90
     *
91
     * @return void
92
     */
93
    public function testCanBePostCommentAndSeeInDB()
94
    {
95
        $user = $this->createUser();
96
        $video = $this->createFakeVideo($user);
97
98
        $data = [
99
            'user_id'  => $user->id,
100
            'video_id' => $video->id,
101
            'comment'  => 'This is example comment',
102
        ];
103
104
        $this->post('/api/videos/'.$video->id.'/comments', $data, ['X-Authorization' => $user->apiKey->key])->seeInDatabase('comments', $data);
105
        $this->get('/api/videos/'.$video->id.'/comments')->seeJsonContains($data)->seeStatusCode(200);
106
    }
107
108
    /**
109
     * Test videos can be update and see changes on database.

tests/LikeDislikeAPITest.php 2 locations

@@ 150-163 (lines=14) @@
147
     *
148
     * @return void
149
     */
150
    public function testCanBePostLikeAndSeeInDB()
151
    {
152
        $user = $this->createUser();
153
        $video = $this->createFakeVideo($user);
154
155
        $data = [
156
            'user_id'  => $user->id,
157
            'video_id' => $video->id,
158
            'type'     => 'like',
159
        ];
160
161
        $this->post('/api/videos/'.$video->id.'/like-dislike', $data, ['X-Authorization' => $user->apiKey->key])->seeInDatabase('likes_dislikes', $data);
162
        $this->get('/api/videos/'.$video->id.'/likes')->seeJsonContains($data)->seeStatusCode(200);
163
    }
164
165
    /**
166
     * Test delete likeDislike and not see in DB.
@@ 170-185 (lines=16) @@
167
     *
168
     * @return void
169
     */
170
    public function testCanBeDeleteLikeAndSeeInDB()
171
    {
172
        $user = $this->createUser();
173
        $video = $this->createFakeVideo($user);
174
175
        $data = [
176
            'user_id'  => $user->id,
177
            'video_id' => $video->id,
178
            'type'     => 'like',
179
        ];
180
181
        LikeDislike::create($data);
182
183
        $this->post('/api/videos/'.$video->id.'/like-dislike', $data, ['X-Authorization' => $user->apiKey->key])->notSeeInDatabase('likes_dislikes', $data);
184
        $this->get('/api/videos/'.$video->id.'/likes')->dontSeeJson([$data])->seeStatusCode(200);
185
    }
186
187
    /**
188
     * Test update type likeDislike and not see in DB.