SchemaStorageTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testStoresSchemas() 0 15 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gorynych\Tests\Util;
6
7
use DG\BypassFinals;
8
use Gorynych\Util\OAReader;
9
use Gorynych\Util\SchemaStorage;
10
use OpenApi\Annotations\Components;
11
use OpenApi\Annotations\OpenApi;
12
use OpenApi\Annotations\Schema;
13
use PHPUnit\Framework\TestCase;
14
15
class SchemaStorageTest extends TestCase
16
{
17
    public function testStoresSchemas(): void
18
    {
19
        $components = new Components([]);
20
        $components->schemas = [new Schema([])];
21
        $openApi = new OpenApi([]);
22
        $openApi->components = $components;
23
24
        BypassFinals::enable();
25
26
        $oaReaderMock = $this->createMock(OAReader::class);
27
        $oaReaderMock->expects($this->once())->method('read')->willReturn($openApi);
28
29
        $schemas = (new SchemaStorage($oaReaderMock))->getSchemas();
30
31
        $this->assertInstanceOf(Schema::class, $schemas->first());
32
    }
33
}
34