ContextTest::testString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Bouncer package.
5
 *
6
 * (c) François Hodierne <[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 Bouncer;
13
14
class ContextTest extends \PHPUnit_Framework_TestCase
15
{
16
17
    public function testString()
18
    {
19
        $bouncer = new Bouncer();
20
21
        $bouncer->addContext('key', 'value');
22
        $context = $bouncer->getContext();
23
        $this->assertEquals($context['key'], 'value');
24
25
        $bouncer->addContext('key', 'newvalue');
26
        $context = $bouncer->getContext();
27
        $this->assertEquals($context['key'], 'newvalue');
28
    }
29
30
    public function testArray()
31
    {
32
        $bouncer = new Bouncer();
33
34
        $bouncer->addContext('key', array('property' => 'value', 'property2' => 'value2'));
35
        $context = $bouncer->getContext();
36
        $this->assertEquals($context['key']['property'], 'value');
37
38
        $bouncer->addContext('key', array('property' => 'newvalue'));
39
        $context = $bouncer->getContext();
40
        $this->assertEquals($context['key']['property'], 'newvalue');
41
        $this->assertEquals($context['key']['property2'], 'value2');
42
    }
43
44
}
45