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

SplBool::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
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...
15
16
/**
17
 * @namespace \Tests\atoum
18
 */
19
class SplBool extends atoum
20
{
21
    public function test()
22
    {
23
        $this
24
            ->given($this->newTestedInstance)
25
            ->then
26
                ->boolean((bool) (string) $this->testedInstance)
27
                    ->isEqualTo(false)
28
        ;
29
30
        $this
31
            ->given($this->newTestedInstance(true))
32
            ->then
33
                ->boolean((bool) (string) $this->testedInstance)
34
                    ->isEqualTo(true)
35
        ;
36
37
        $this
38
            ->given($this->newTestedInstance(1, false))
39
            ->then
40
                ->boolean((bool) (string) $this->testedInstance)
41
                    ->isEqualTo(true)
42
        ;
43
    }
44
45
    public function test_unexpected_value_exception_int()
46
    {
47
        $this
48
            ->exception(
49
                function() {
50
                    $this->newTestedInstance(0);
51
                }
52
            )
53
            ->isInstanceOf('\UnexpectedValueException')
54
        ;
55
    }
56
57
    public function test_unexpected_value_exception_string()
58
    {
59
        $this
60
            ->exception(
61
                function() {
62
                    $this->newTestedInstance('test');
63
                }
64
            )
65
            ->isInstanceOf('\UnexpectedValueException')
66
        ;
67
    }
68
69
    public function test_list()
70
    {
71
        $list = array(
72
            '__default' => false,
73
            'false' => false,
74
            'true' => true
75
        );
76
77
        $this
78
            ->given($this->newTestedInstance)
79
            ->then
80
                ->array($this->testedInstance->getConstList(true))
81
                    ->isEqualTo($list)
82
        ;
83
84
        unset($list['__default']);
85
86
        $this
87
            ->given($this->newTestedInstance)
88
            ->then
89
                ->array($this->testedInstance->getConstList())
90
                    ->isEqualTo($list)
91
        ;
92
    }
93
}
94