testConstructorRequiredAssignments()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace erasys\OpenApi\Tests\Spec;
4
5
use erasys\OpenApi\Spec\v3\Discriminator;
6
use erasys\OpenApi\Spec\v3\ExtensibleInterface;
7
use PHPUnit\Framework\TestCase;
8
9
class DiscriminatorUnitTest extends TestCase
10
{
11
    public function testConstructorRequiredAssignments()
12
    {
13
        $propertyName = 'foo';
14
15
        $obj = new Discriminator($propertyName);
16
17
        $this->assertNotInstanceOf(ExtensibleInterface::class, $obj);
18
        $this->assertEquals($propertyName, $obj->propertyName);
19
        $this->assertNull($obj->mapping);
20
    }
21
22
    public function testConstructorAllAssignments()
23
    {
24
        $propertyName = 'foo';
25
        $mapping      = ['foo' => 'bar'];
26
27
        $obj = new Discriminator($propertyName, $mapping);
28
29
        $this->assertNotInstanceOf(ExtensibleInterface::class, $obj);
30
        $this->assertEquals($propertyName, $obj->propertyName);
31
        $this->assertEquals($mapping, $obj->mapping);
32
    }
33
}
34