Completed
Push — master ( cec1cf...f9a404 )
by Javi
03:27
created

testConstructorRequiredAssignments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace erasys\OpenApi\Tests\Spec;
4
5
use erasys\OpenApi\Spec\v3\ExtensibleInterface;
6
use erasys\OpenApi\Spec\v3\Server;
7
use PHPUnit\Framework\TestCase;
8
9
class ServerUnitTest extends TestCase
10
{
11
    public function testConstructorRequiredAssignments()
12
    {
13
        $url = 'http://example.com';
14
15
        $obj = new Server($url);
16
17
        $this->assertInstanceOf(ExtensibleInterface::class, $obj);
18
        $this->assertEquals($url, $obj->url);
19
        $this->assertNull($obj->description);
20
        $this->assertNull($obj->variables);
21
    }
22
23
    public function testConstructorAllAssignments()
24
    {
25
        $url         = 'http://example.com';
26
        $description = 'Lorem ipsum dolor sit amet';
27
        $variables   = [];
28
        $additional  = [
29
            'url'         => 'http://xyz.com',
30
            'description' => null,
31
        ];
32
33
        $obj = new Server($url, $description, $variables, $additional);
34
35
        $this->assertInstanceOf(ExtensibleInterface::class, $obj);
36
        $this->assertEquals($url, $obj->url);
37
        $this->assertEquals($description, $obj->description);
38
        $this->assertEquals($variables, $obj->variables);
39
    }
40
}
41