SanityTest::testStore()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
class SanityTest extends KintTestCase
4
{
5
    /**
6
     * Essentially a copy paste job of the basic.php test.
7
     *
8
     * It's more of an integration test than a unit test.
9
     */
10
    public function testSanity()
11
    {
12
        $testdata = array(
13
            1234,
14
            (object) array('abc' => 'def'),
15
            1234.5678,
16
            'Good news everyone! I\'ve got some bad news!',
17
            null,
18
        );
19
20
        $testdata[] = &$testdata;
21
22
        $array_structure = array(
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
23
            '0', 'integer', '1234',
24
            '1', 'stdClass', '1',
25
                'public', 'abc', 'string', '3', 'def',
26
            '2', 'double', '1234.5678',
27
            '3', 'string', '43', 'Good news everyone! I\'ve got some bad news!',
28
            '4', 'null',
29
        );
30
31
        Kint::$return = true;
32
        Kint::$cli_detection = false;
33
34
        Kint::$enabled_mode = Kint::MODE_RICH;
35
        $this->assertLike(array_merge(
36
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
37
                array('&amp;array', '6'),
38
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
39
                array('&amp;array', 'Recursion')
40
            ),
41
            d($testdata)
42
        );
43
44
        Kint::$enabled_mode = Kint::MODE_PLAIN;
45
        $this->assertLike(array_merge(
46
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
47
                array('&amp;array', '6'),
48
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
49
                array('&amp;array', 'RECURSION')
50
            ),
51
            d($testdata)
52
        );
53
54
        Kint::$enabled_mode = Kint::MODE_CLI;
55
        $this->assertLike(array_merge(
56
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
57
                array('&array', '6'),
58
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
59
                array('&array', 'RECURSION')
60
            ),
61
            d($testdata)
62
        );
63
64
        Kint::$enabled_mode = Kint::MODE_TEXT;
65
        $this->assertLike(array_merge(
66
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
67
                array('&array', '6'),
68
                $array_structure,
0 ignored issues
show
Coding Style introduced by
$array_structure does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
69
                array('&array', 'RECURSION')
70
            ),
71
            d($testdata)
72
        );
73
    }
74
75
    /**
76
     * Test this test suite's restore after test.
77
     */
78
    public function testStore()
79
    {
80
        Kint::$return = 'test_store';
0 ignored issues
show
Documentation Bug introduced by
The property $return was declared of type boolean, but 'test_store' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
81
        $this->assertEquals('test_store', Kint::$return);
82
    }
83
84
    /**
85
     * Test this test suite's restore after test.
86
     *
87
     * @depends testStore
88
     */
89
    public function testRestore()
90
    {
91
        $this->assertNotEquals('test_store', Kint::$return);
92
    }
93
}
94