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

CharacterSetTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testIntrospect() 0 9 1
A testIntrospectKeys() 0 9 1
A testHasValue() 0 9 1
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\CharacterSet;
14
use SimplePie\Test\Unit\AbstractTestCase;
15
16
class CharacterSetTest extends AbstractTestCase
17
{
18
    public function testIntrospect(): void
19
    {
20
        $this->assertSame(CharacterSet::introspect(), [
21
            'ISO_8859_1' => 'iso-8859-1',
22
            'US_ASCII'   => 'us-ascii',
23
            'UTF_8'      => 'utf-8',
24
            'WIN_1252'   => 'windows-1252',
25
        ]);
26
    }
27
28
    public function testIntrospectKeys(): void
29
    {
30
        $this->assertSame(CharacterSet::introspectKeys(), [
31
            'ISO_8859_1',
32
            'US_ASCII',
33
            'UTF_8',
34
            'WIN_1252',
35
        ]);
36
    }
37
38
    public function testHasValue(): void
39
    {
40
        $this->assertTrue(CharacterSet::hasValue(CharacterSet::ISO_8859_1));
41
        $this->assertTrue(CharacterSet::hasValue(CharacterSet::US_ASCII));
42
        $this->assertTrue(CharacterSet::hasValue(CharacterSet::UTF_8));
43
        $this->assertTrue(CharacterSet::hasValue(CharacterSet::WIN_1252));
44
45
        $this->assertFalse(CharacterSet::hasValue('nope'));
46
    }
47
}
48