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

SecuritySchemeUnitTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructorRequiredAssignments() 0 9 1
A testConstructorAllAssignments() 0 15 1
1
<?php
2
3
namespace erasys\OpenApi\Tests\Spec;
4
5
use erasys\OpenApi\Spec\v3\Document;
6
use erasys\OpenApi\Spec\v3\ExtensibleInterface;
7
use erasys\OpenApi\Spec\v3\SecurityScheme;
8
use PHPUnit\Framework\TestCase;
9
10
class SecuritySchemeUnitTest extends TestCase
11
{
12
    public function testConstructorRequiredAssignments()
13
    {
14
        $type = 'apiKey';
15
16
        $obj = new SecurityScheme($type);
17
18
        $this->assertInstanceOf(ExtensibleInterface::class, $obj);
19
        $this->assertEquals($type, $obj->type);
20
        $this->assertNull($obj->description);
21
    }
22
23
    public function testConstructorAllAssignments()
24
    {
25
        $type        = 'apiKey';
26
        $description = 'Lorem ipsum dolor sit amet';
27
        $additional  = [
28
            'in'          => Document::PARAM_IN_HEADER,
29
            'description' => null,
30
        ];
31
32
        $obj = new SecurityScheme($type, $description, $additional);
33
34
        $this->assertInstanceOf(ExtensibleInterface::class, $obj);
35
        $this->assertEquals($type, $obj->type);
36
        $this->assertEquals($description, $obj->description);
37
        $this->assertEquals($additional['in'], $obj->in);
38
    }
39
}
40