forked from cebe/php-openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeaderTest.php
More file actions
33 lines (28 loc) · 825 Bytes
/
Copy pathHeaderTest.php
File metadata and controls
33 lines (28 loc) · 825 Bytes
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
<?php
use cebe\openapi\Reader;
use cebe\openapi\spec\Header;
/**
* @covers \cebe\openapi\spec\Header
*/
class HeaderTest extends \PHPUnit\Framework\TestCase
{
public function testRead()
{
/** @var $header Header */
$header = Reader::readFromJson(<<<JSON
{
"description": "The number of allowed requests in the current period",
"schema": {
"type": "integer"
}
}
JSON
, Header::class);
$result = $header->validate();
$this->assertEquals([], $header->getErrors());
$this->assertTrue($result);
$this->assertEquals('The number of allowed requests in the current period', $header->description);
$this->assertInstanceOf(\cebe\openapi\spec\Schema::class, $header->schema);
$this->assertEquals('integer', $header->schema->type);
}
}