Test Failed
Push — master ( 39a51a...f867c3 )
by Adrien
01:53
created

SplEnumTest::test()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 13
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Part of SplTypes package.
5
 *
6
 * (c) Adrien Loyant <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ducks\Component\SplTypes\Tests\phpunit;
13
14
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
16
class SplEnumTest extends TestCase
17
{
18
    protected static $fixturesPath;
19
20
    public static function setUpBeforeClass()
21
    {
22
        self::$fixturesPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . '../common/Fixtures/');
23
        require_once self::$fixturesPath . '/Month.php';
24
    }
25
26
    public function test()
27
    {
28
        $test = new \Month();
29
        $this->assertEquals(\Month::__default, (string) $test);
30
        unset($test);
31
32
        $test = new \Month(\Month::SEPTEMBER);
33
        $this->assertEquals(\Month::SEPTEMBER, (string) $test);
34
        unset($test);
35
36
        $test = new \Month('1', false);
37
        $this->assertEquals(\Month::JANUARY, (string) $test);
38
        unset($test);
39
    }
40
41
    public function test_unexpected_value_exception()
42
    {
43
        $this->expectException('\UnexpectedValueException');
44
        new \Month('1');
45
    }
46
47
    public function test_list()
48
    {
49
        $list = array(
50
            '__default' => 1,
51
            'JANUARY' => 1,
52
            'FEBRUARY' => 2,
53
            'MARCH' => 3,
54
            'APRIL' => 4,
55
            'MAY' => 5,
56
            'JUNE' => 6,
57
            'JULY' => 7,
58
            'AUGUST' => 8,
59
            'SEPTEMBER' => 9,
60
            'OCTOBER' => 10,
61
            'NOVEMBER' => 11,
62
            'DECEMBER' => 12,
63
        );
64
        $month = new \Month();
65
66
        $test = $month->getConstList(true);
67
        $this->assertSame($list, $test);
68
        unset($test, $list['__default']);
69
70
        $test = $month->getConstList();
71
        $this->assertSame($list, $test);
72
        unset($month, $test, $list);
73
    }
74
}
75