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.

SecurityListenerTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testAccess() 0 6 1
A testDenied() 0 6 1
A createPreCommandEvent() 0 4 1
A createFakePolicy() 0 10 1
1
<?php
2
3
namespace APL\Tests\Security;
4
5
use APL\Security\SecurityListener;
6
use APL\Event\PreCommandEvent;
7
8
/**
9
 *
10
 * @author David Badura <[email protected]>
11
 */
12
class SecurityListenerTest extends \PHPUnit_Framework_TestCase
13
{
14
15
    public function testAccess()
16
    {
17
        $listener = new SecurityListener();
18
        $listener->addPolicy($this->createFakePolicy(true));
19
        $listener->preCommand($this->createPreCommandEvent());
20
    }
21
22
    /**
23
     *
24
     * @expectedException \APL\Exception\SecurityException
25
     */
26
    public function testDenied()
27
    {
28
        $listener = new SecurityListener();
29
        $listener->addPolicy($this->createFakePolicy(false));
30
        $listener->preCommand($this->createPreCommandEvent());
31
    }
32
33
    /**
34
     *
35
     * @return PreCommandEvent
36
     */
37
    private function createPreCommandEvent()
38
    {
39
        return new PreCommandEvent($this->getMock('APL\Command\CommandInterface'));
40
    }
41
42
    /**
43
     *
44
     * @param bool $return
45
     * @return \APL\Security\PolicyInterface
46
     */
47
    private function createFakePolicy($return)
48
    {
49
        $policy = $this->getMock('APL\Security\PolicyInterface');
50
        $policy
51
            ->expects($this->once())
52
            ->method('check')
53
            ->will($this->returnValue($return));
54
55
        return $policy;
56
    }
57
}
58