SessionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 43
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRequest() 0 15 1
A getBouncer() 0 9 1
A testSessionId() 0 12 1
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 SessionTest extends \PHPUnit_Framework_TestCase
15
{
16
17
    public function getRequest()
18
    {
19
        $ip = '92.78.176.182';
20
21
        $cookies = array();
22
        $cookies['bsid'] = '529460e691b0f2c87ff95acd6c4e00d2';
23
24
        $server = array();
25
        $server['REMOTE_ADDR'] = $ip;
26
27
        $request = new \Bouncer\Request;
28
        $request->initialize(array(), array(), array(), $cookies, array(), $server);
29
30
        return $request;
31
    }
32
33
    public function getBouncer($request)
34
    {
35
        $bouncer = new Bouncer(array(
36
            'request' => $request,
37
            'profile' => new \Bouncer\Profile\TestProfile,
38
        ));
39
40
        return $bouncer;
41
    }
42
43
    public function testSessionId()
44
    {
45
        $request = $this->getRequest();
46
47
        $bouncer = $this->getBouncer($request);
48
49
        $identity = $bouncer->getIdentity();
50
51
        $this->assertInstanceOf('\\Bouncer\\Resource\\Session', $identity->getSession());
52
53
        $this->assertEquals('529460e691b0f2c87ff95acd6c4e00d2', $identity->getSession()->getId());
54
    }
55
56
}
57