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 ( e272cc...762696 )
by Adam
02:08
created

SlotTest::testGetKeys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 9.4285
cc 1
eloc 12
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the SlotMachine library.
5
 *
6
 * (c) Adam Elsodaney <[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 tests\SlotMachine;
13
14
use Symfony\Component\HttpFoundation\Request;
15
use Symfony\Component\Yaml\Yaml;
16
17
class SlotTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @covers SlotMachine\Slot::getCard
21
     * @covers SlotMachine\Slot::__toString
22
     */
23
    public function testGetCard()
24
    {
25
        $slot = new Slot(array(
26
            'name' => 'city',
27
            'keys' => array(
28
                'h'
29
            ),
30
            'reel' => array(
31
                'cards' => array(
32
                    0 => 'London',
33
                    1 => 'Paris',
34
                    2 => 'Madrid'
35
                )
36
            ),
37
        ));
38
        $this->assertEquals('London', $slot->getCard());
39
        $this->assertEquals('Madrid', $slot->getCard(2));
40
        $this->assertEquals('London', $slot);
41
    }
42
43
    /**
44
     * @covers SlotMachine\Slot::getCardByAlias
45
     * @covers SlotMachine\Slot::getDefaultIndex
46
     * @covers SlotMachine\Slot::getDefaultCard
47
     * @covers SlotMachine\Slot::getFallbackCard
48
     */
49
    public function testGetCardByAlias()
50
    {
51
        $slot = new Slot(array(
52
            'name' => 'months',
53
            'keys' => array(
54
                'm'
55
            ),
56
            'reel' => array(
57
                'aliases' => array(
58
                    '_default'  => 4,  // May
59
                    '_fallback' => 8,  // September
60
                    'xmas'      => 11, // December
61
                ),
62
                'cards' => array(
63
                    0 => 'January',
64
                    1 => 'February',
65
                    2 => 'March',
66
                    3 => 'April',
67
                    4 => 'May',
68
                    5 => 'June',
69
                    6 => 'July',
70
                    7 => 'August',
71
                    8 => 'September',
72
                    9 => 'October',
73
                    10 => 'November',
74
                    11 => 'December'
75
                )
76
            ),
77
        ));
78
79
        $this->assertEquals('December', $slot->getCardByAlias('xmas'));
80
        $this->assertEquals(4, $slot->getDefaultIndex());
81
        $this->assertEquals('May', $slot->getDefaultCard());
82
        $this->assertEquals('September', $slot->getFallbackCard());
83
    }
84
85
    /**
86
     * @covers SlotMachine\Slot::getKey
87
     * @covers SlotMachine\Slot::getKeys
88
     */
89
    public function testGetKeys()
90
    {
91
        $slot = new Slot(array(
92
            'name' => 'towns',
93
            'keys' => array(
94
                't', 'town', 'app_data[t]'
95
            ),
96
97
            'reel' => array(
98
                'cards' => array(
99
                    0 => 'Hastings',
100
                    1 => 'Cheltenham',
101
                    2 => 'Poole'
102
                )
103
            ),
104
        ));
105
106
        $this->assertEquals('t', $slot->getKey());
107
        $this->assertEquals(array('t', 'town', 'app_data[t]'), array_values($slot->getKeys()));
108
    }
109
110
    /**
111
     * @covers SlotMachine\Slot::getNested
112
     */
113
    public function testGetNested()
114
    {
115
        $slot = new Slot(array(
116
            'name' => 'message',
117
            'keys' => array(
118
                'm',
119
            ),
120
            'reel' => array(
121
                'cards' => array(
122
                    0 => 'Welcome to {town}',
123
                    1 => 'Hope you enjoy your stay in {town}',
124
                    2 => 'Have you ever visted {town} before?'
125
                )
126
            ),
127
            'nested' => array(
128
                'town'
129
            ),
130
        ));
131
132
        $nested = $slot->getNested();
133
134
        $this->assertEquals(1, count($nested));
135
        $this->assertEquals('town', $nested[0]);
136
    }
137
}
138