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

SplEnum::test()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 15
nc 1
nop 0
dl 0
loc 21
rs 9.7666
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\atoum;
13
14
require_once __DIR__ . DIRECTORY_SEPARATOR . '../common/Fixtures/' . '/Month.php';
15
16
use mageekguy\atoum;
0 ignored issues
show
Bug introduced by
The type mageekguy\atoum 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...
17
18
/**
19
 * @namespace \Tests\atoum
20
 */
21
class SplEnum extends atoum
22
{
23
    public function test()
24
    {
25
        $this
26
            ->given($test = new \Month)
27
            ->then
28
                ->integer((int) (string) $test)
29
                    ->isEqualTo(\Month::__default)
30
        ;
31
32
        $this
33
            ->given($test = new \Month(\Month::SEPTEMBER))
34
            ->then
35
                ->integer((int) (string) $test)
36
                    ->isEqualTo(\Month::SEPTEMBER)
37
        ;
38
39
        $this
40
            ->given($test = new \Month('1', false))
41
            ->then
42
                ->integer((int) (string) $test)
43
                    ->isEqualTo(\Month::JANUARY)
44
        ;
45
    }
46
47
    public function test_unexpected_value_exception()
48
    {
49
        $this
50
            ->exception(
51
                function() {
52
                    new \Month('1');
53
                }
54
            )
55
            ->isInstanceOf('\UnexpectedValueException')
56
        ;
57
    }
58
59
    public function test_list()
60
    {
61
        $list = array(
62
            '__default' => 1,
63
            'JANUARY' => 1,
64
            'FEBRUARY' => 2,
65
            'MARCH' => 3,
66
            'APRIL' => 4,
67
            'MAY' => 5,
68
            'JUNE' => 6,
69
            'JULY' => 7,
70
            'AUGUST' => 8,
71
            'SEPTEMBER' => 9,
72
            'OCTOBER' => 10,
73
            'NOVEMBER' => 11,
74
            'DECEMBER' => 12,
75
        );
76
77
        $this
78
            ->given($test = new \Month)
79
            ->then
80
                ->array($test->getConstList(true))
81
                    ->isEqualTo($list)
82
        ;
83
84
        unset($list['__default']);
85
86
        $this
87
            ->given($test = new \Month)
88
            ->then
89
                ->array($test->getConstList())
90
                    ->isEqualTo($list)
91
        ;
92
    }
93
}
94