Completed
Push — master ( 3c3f7e...cb27b7 )
by Mahmoud
03:18
created

ListUserApplicationsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testListStoreApplications_() 0 20 1
1
<?php
2
3
namespace App\Containers\Application\UI\API\Tests\Functional;
4
5
use App\Containers\Application\Models\Application;
6
use App\Port\Tests\PHPUnit\Abstracts\TestCase;
7
8
/**
9
 * Class ListUserApplicationsTest
10
 *
11
 * @author  Mahmoud Zalt  <[email protected]>
12
 */
13
class ListUserApplicationsTest extends TestCase
14
{
15
16
    private $endpoint = '/apps';
17
18
    public function testListStoreApplications_()
19
    {
20
        $user = $this->registerAndLoginTestingDeveloper();
21
22
        factory(Application::class, 2)->create();
23
24
        factory(Application::class, 4)->create([
25
            'user_id' => $user->id,
26
        ]);
27
28
        // send the HTTP request
29
        $response = $this->apiCall($this->endpoint, 'get');
30
31
        // assert response status is correct
32
        $this->assertEquals($response->getStatusCode(), '200');
33
34
        $responseObject = $this->getResponseObject($response);
35
36
        $this->assertEquals(4, count($responseObject->data));
37
    }
38
39
}
40