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.

CommandStackTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCommandStack() 0 51 1
A createCommand() 0 4 1
1
<?php
2
3
namespace APL\Tests\Dispatcher;
4
5
use APL\Command;
6
use APL\Dispatcher\CommandStack;
7
8
class CommandStackTest extends \PHPUnit_Framework_TestCase
9
{
10
11
    public function testCommandStack()
12
    {
13
        $stack = new CommandStack();
14
15
        $command1 = $this->createCommand();
16
        $command2 = $this->createCommand();
17
        $command3 = $this->createCommand();
18
19
        $this->assertEquals(null, $stack->getCurrentCommand());
20
        $this->assertEquals(null, $stack->getMasterCommand());
21
        $this->assertEquals(null, $stack->getParentCommand());
22
        $this->assertEquals(null, $stack->pop());
23
24
        $stack->push($command1);
25
26
        $this->assertEquals($command1, $stack->getCurrentCommand());
27
        $this->assertEquals($command1, $stack->getMasterCommand());
28
        $this->assertEquals(null, $stack->getParentCommand());
29
30
        $stack->push($command2);
31
32
        $this->assertEquals($command2, $stack->getCurrentCommand());
33
        $this->assertEquals($command1, $stack->getMasterCommand());
34
        $this->assertEquals($command1, $stack->getParentCommand());
35
36
        $stack->push($command3);
37
38
        $this->assertEquals($command3, $stack->getCurrentCommand());
39
        $this->assertEquals($command1, $stack->getMasterCommand());
40
        $this->assertEquals($command2, $stack->getParentCommand());
41
42
        $this->assertEquals($command3, $stack->pop());
43
        $this->assertEquals($command2, $stack->getCurrentCommand());
44
        $this->assertEquals($command1, $stack->getMasterCommand());
45
        $this->assertEquals($command1, $stack->getParentCommand());
46
47
        $this->assertEquals($command2, $stack->pop());
48
        $this->assertEquals($command1, $stack->getCurrentCommand());
49
        $this->assertEquals($command1, $stack->getMasterCommand());
50
        $this->assertEquals(null, $stack->getParentCommand());
51
52
        $this->assertEquals($command1, $stack->pop());
53
        $this->assertEquals(null, $stack->getCurrentCommand());
54
        $this->assertEquals(null, $stack->getMasterCommand());
55
        $this->assertEquals(null, $stack->getParentCommand());
56
57
        $this->assertEquals(null, $stack->pop());
58
        $this->assertEquals(null, $stack->getCurrentCommand());
59
        $this->assertEquals(null, $stack->getMasterCommand());
60
        $this->assertEquals(null, $stack->getParentCommand());
61
    }
62
63
    /**
64
     *
65
     * @return Command
66
     */
67
    protected function createCommand()
68
    {
69
        return $this->getMock('APL\Command\CommandInterface');
70
    }
71
}
72