GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 52d4c8...30de9c )
by Mohammad Abdoli
03:41
created

ConfigTest::testSerializableInterface()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Rad\Configure\Tests;
4
5
use PHPUnit_Framework_TestCase;
6
use Rad\Configure\Config;
7
8
/**
9
 * Config Test
10
 *
11
 * @package Rad\Configure\Tests
12
 */
13
class ConfigTest extends PHPUnit_Framework_TestCase
14
{
15
    protected static $fixtures;
16
17
    /**
18
     * @inheritdoc
19
     */
20
    public static function setUpBeforeClass()
21
    {
22
        self::$fixtures = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures';
23
    }
24
25
    /**
26
     * Test load config file
27
     */
28
    public function testLoad()
29
    {
30
        $this->assertTrue(Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php'));
31
        $this->assertEquals(Config::get('foo'), 'bar');
32
33
        Config::load(self::$fixtures . '/Engine/PhpConfig/other_config.php');
34
        $this->assertEquals(Config::get('key2.sub-key1.sub-sub-key2'), 'changed-val2');
35
36
        Config::load(self::$fixtures . '/Engine/PhpConfig/other_config.php', 'default', false);
37
        $this->assertNotEquals(Config::get('foo'), 'bar');
38
39
        $this->assertFalse(Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php', 'not_exists_engine'));
40
    }
41
42
    /**
43
     * Test dump config file
44
     */
45
    public function testDump()
46
    {
47
        Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php');
48
        $tmpFile = tempnam(sys_get_temp_dir(), 'TestConfigure');
49
50
        $this->assertFalse(Config::dump($tmpFile, 'not_exists_engine'));
51
        $this->assertTrue(Config::dump($tmpFile));
52
53
        Config::load($tmpFile, 'default', false);
54
        $this->assertEquals(Config::get('key2.sub-key1.sub-sub-key2'), 'val2');
55
    }
56
57
    /**
58
     * Test set config
59
     */
60
    public function testSet()
61
    {
62
        Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php');
63
        Config::set('foo', 'new-bar');
64
        $this->assertEquals(Config::get('foo'), 'new-bar');
65
66
        Config::set('key1.sub-key1', 'new-val1');
67
        $this->assertEquals(Config::get('key1.sub-key1'), 'new-val1');
68
69
        Config::set('key1.sub-new-key1', 'val1');
70
        $this->assertEquals(Config::get('key1.sub-new-key1'), 'val1');
71
    }
72
73
    /**
74
     * Test get config
75
     */
76
    public function testGet()
77
    {
78
        Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php');
79
        $this->assertEquals(Config::get('foo'), 'bar');
80
        $this->assertEquals(Config::get('key0', 'defaultValue'), 'defaultValue');
81
    }
82
83
    /**
84
     * Test has exist identifier
85
     */
86
    public function testHas()
87
    {
88
        Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php');
89
        $this->assertTrue(Config::has('foo'));
90
        $this->assertFalse(Config::has('not-exists-key'));
91
    }
92
93
    /**
94
     * Test array access interface
95
     */
96
    public function testArrayAccessInterface()
97
    {
98
        Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php');
99
        $configObject = Config::getInstance();
100
101
        $this->assertTrue(isset($configObject['foo']));
102
        $this->assertEquals($configObject['foo'], 'bar');
103
104
        $configObject['foo'] = 'new-bar';
105
        $this->assertEquals($configObject['foo'], 'new-bar');
106
107
        $this->setExpectedExceptionRegExp('Rad\Configure\Exception', '/Can not unset value/');
108
        unset($configObject['foo']);
109
    }
110
111
    /**
112
     * Test serializable interface
113
     */
114
    public function testSerializableInterface()
115
    {
116
        Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php');
117
        $configObject = unserialize(serialize(Config::getInstance()));
118
119
        $this->assertEquals($configObject['foo'], 'bar');
120
    }
121
122
    /**
123
     * Test json serialize interface
124
     */
125
    public function testJsonSerializeInterface()
126
    {
127
        Config::load(self::$fixtures . '/Engine/PhpConfig/base_config.php');
128
        $configArray = json_decode(json_encode(Config::getInstance()), true);
129
130
        $this->assertEquals($configArray['foo'], 'bar');
131
    }
132
}
133