Completed
Branch master (95b3ba)
by Ryan
28:02 queued 13:03
created

XmlNsTest::testIntrospect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright (c) 2017 Ryan Parman <http://ryanparman.com>.
4
 * Copyright (c) 2017 Contributors.
5
 *
6
 * http://opensource.org/licenses/Apache2.0
7
 */
8
9
declare(strict_types=1);
10
11
namespace SimplePie\Test\Unit\Enum;
12
13
use SimplePie\Enum\XmlNs;
14
use SimplePie\Test\Unit\AbstractTestCase;
15
16
class XmlNsTest extends AbstractTestCase
17
{
18
    public function testIntrospect(): void
19
    {
20
        $this->assertSame(XmlNs::introspect(), [
21
            'ATOM_03' => 'http://purl.org/atom/ns#',
22
            'ATOM_10' => 'http://www.w3.org/2005/Atom',
23
            'RDF'     => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
24
            'RSS_090' => 'http://my.netscape.com/rdf/simple/0.9/',
25
            'RSS_10'  => 'http://purl.org/rss/1.0/',
26
            'RSS_20'  => '',
27
            'XHTML'   => 'http://www.w3.org/1999/xhtml',
28
            'XML'     => 'http://www.w3.org/XML/1998/namespace',
29
        ]);
30
    }
31
32
    public function testIntrospectKeys(): void
33
    {
34
        $this->assertSame(XmlNs::introspectKeys(), [
35
            'ATOM_03',
36
            'ATOM_10',
37
            'RDF',
38
            'RSS_090',
39
            'RSS_10',
40
            'RSS_20',
41
            'XHTML',
42
            'XML',
43
        ]);
44
    }
45
46
    public function testHasValue(): void
47
    {
48
        $this->assertTrue(XmlNs::hasValue(XmlNs::ATOM_03));
49
        $this->assertTrue(XmlNs::hasValue(XmlNs::ATOM_10));
50
        $this->assertTrue(XmlNs::hasValue(XmlNs::RDF));
51
        $this->assertTrue(XmlNs::hasValue(XmlNs::RSS_090));
52
        $this->assertTrue(XmlNs::hasValue(XmlNs::RSS_10));
53
        $this->assertTrue(XmlNs::hasValue(XmlNs::RSS_20));
54
        $this->assertTrue(XmlNs::hasValue(XmlNs::XHTML));
55
        $this->assertTrue(XmlNs::hasValue(XmlNs::XML));
56
57
        $this->assertFalse(XmlNs::hasValue('nope'));
58
    }
59
}
60