forked from cebe/php-openapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXmlTest.php
More file actions
48 lines (41 loc) · 1.19 KB
/
Copy pathXmlTest.php
File metadata and controls
48 lines (41 loc) · 1.19 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
38
39
40
41
42
43
44
45
46
47
48
<?php
use cebe\openapi\Reader;
use cebe\openapi\spec\Xml;
/**
* @covers \cebe\openapi\spec\Xml
*/
class XmlTest extends \PHPUnit\Framework\TestCase
{
public function testRead()
{
/** @var $xml Xml */
$xml = Reader::readFromYaml(<<<YAML
name: animal
attribute: true
namespace: http://example.com/schema/sample
prefix: sample
wrapped: false
YAML
, Xml::class);
$result = $xml->validate();
$this->assertEquals([], $xml->getErrors());
$this->assertTrue($result);
$this->assertEquals('animal', $xml->name);
$this->assertTrue($xml->attribute);
$this->assertEquals('http://example.com/schema/sample', $xml->namespace);
$this->assertEquals('sample', $xml->prefix);
$this->assertFalse($xml->wrapped);
/** @var $xml Xml */
$xml = Reader::readFromYaml(<<<YAML
name: animal
YAML
, Xml::class);
$result = $xml->validate();
$this->assertEquals([], $xml->getErrors());
$this->assertTrue($result);
// attribute Default value is false.
$this->assertFalse($xml->attribute);
// wrapped Default value is false.
$this->assertFalse($xml->wrapped);
}
}