ApplicationTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testShouldReturnApplicationsAvailable() 0 8 1
B getResponse() 0 24 2
1
<?php
2
/*
3
 *   This file is part of the Vultr PHP library.
4
 *
5
 *   (c) Albert Leitato <[email protected]>
6
 *
7
 *   For the full copyright and license information, please view the LICENSE
8
 *   file that was distributed with this source code.
9
 */
10
namespace Vultr\Tests\Unit;
11
12
use Vultr\Tests\TestCase;
13
use Vultr\Api\Application;
14
15
class ApplicationTest extends TestCase
16
{
17
    /**
18
     * undocumented function.
19
     *
20
     * @author
21
     **/
22
    public function testShouldReturnApplicationsAvailable()
23
    {
24
        $application = new Application($this->getRequest());
25
        $apps        = $application->list();
26
        $this->assertEquals(\count($apps), 2);
27
        $app = $apps[1];
28
        $this->assertInstanceOf('Vultr\Entity\Application', $app);
29
    }
30
31
    protected function getResponse($decode = false)
32
    {
33
        $response = '{
34
					    "1": {
35
					        "APPID": "1",
36
					        "name": "LEMP",
37
					        "short_name": "lemp",
38
					        "deploy_name": "LEMP on CentOS 6 x64",
39
					        "surcharge": 0
40
					    },
41
					    "2": {
42
					        "APPID": "2",
43
					        "name": "WordPress",
44
					        "short_name": "wordpress",
45
					        "deploy_name": "WordPress on CentOS 6 x64",
46
					        "surcharge": 0
47
					    }
48
					}';
49
        if ($decode) {
50
            return \json_decode($response);
51
        }
52
53
        return $response;
54
    }
55
}
56