-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenApiSpecResolverTest.php
More file actions
37 lines (30 loc) · 1.01 KB
/
OpenApiSpecResolverTest.php
File metadata and controls
37 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
namespace Studio\OpenApiContractTesting\Tests\Unit;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Studio\OpenApiContractTesting\OpenApiSpec;
use Studio\OpenApiContractTesting\OpenApiSpecResolver;
#[OpenApiSpec('petstore-3.0')]
class OpenApiSpecResolverTest extends TestCase
{
use OpenApiSpecResolver;
#[Test]
public function class_level_attribute_is_resolved(): void
{
$this->assertSame('petstore-3.0', $this->resolveOpenApiSpec());
}
#[Test]
#[OpenApiSpec('petstore-3.1')]
public function method_level_attribute_overrides_class_level(): void
{
$this->assertSame('petstore-3.1', $this->resolveOpenApiSpec());
}
#[Test]
public function fallback_returns_empty_string_when_no_attribute(): void
{
// This test class has a class-level attribute, so we verify
// the fallback method itself returns empty by default.
$this->assertSame('', $this->openApiSpecFallback());
}
}