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.
Passed
Pull Request — master (#24)
by Vincent
02:48
created

FeatureContext::setUpSuite()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ScenarioStateBehatExtension project.
5
 *
6
 * (c) Rodrigue Villetard <[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
use Behat\Behat\Hook\Scope\AfterScenarioScope;
13
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
14
use Gorghoa\ScenarioStateBehatExtension\Annotation\ScenarioStateArgument;
15
use Gorghoa\ScenarioStateBehatExtension\Context\ScenarioStateAwareContext;
16
use Gorghoa\ScenarioStateBehatExtension\ScenarioStateInterface;
17
use Gorghoa\ScenarioStateBehatExtension\TestApp\Gorilla;
18
19
/**
20
 * @author Rodrigue Villetard <[email protected]>
21
 */
22
class FeatureContext implements ScenarioStateAwareContext
23
{
24
    /**
25
     * @beforeSuite
26
     */
27
    public static function setUpSuite()
28
    {
29
        require_once __DIR__.'/../../autoload.php';
30
    }
31
32
    /**
33
     * @var ScenarioStateInterface
34
     */
35
    private $scenarioState;
36
37
    /**
38
     * @param ScenarioStateInterface $scenarioState
39
     */
40
    public function setScenarioState(ScenarioStateInterface $scenarioState)
41
    {
42
        $this->scenarioState = $scenarioState;
43
    }
44
45
    /**
46
     * @BeforeScenario
47
     */
48
    public function initBananas()
49
    {
50
        $this->scenarioState->provideStateFragment('bananas', ['foo', 'bar']);
51
    }
52
53
    /**
54
     * @BeforeScenario
55
     *
56
     * @ScenarioStateArgument("bananas")
57
     *
58
     * @param array $bananas
59
     */
60
    public function saveBananasWithoutScopeBeforeScenario(array $bananas)
61
    {
62
        \PHPUnit_Framework_Assert::assertEquals(['foo', 'bar'], $bananas);
63
    }
64
65
    /**
66
     * @BeforeScenario
67
     *
68
     * @ScenarioStateArgument("bananas")
69
     *
70
     * @param BeforeScenarioScope $scope
71
     * @param array               $bananas
72
     */
73
    public function saveBananasWithScopeBeforeScenario(BeforeScenarioScope $scope, array $bananas)
74
    {
75
        \PHPUnit_Framework_Assert::assertNotNull($scope);
76
        \PHPUnit_Framework_Assert::assertEquals(['foo', 'bar'], $bananas);
77
    }
78
79
    /**
80
     * @BeforeScenario
81
     *
82
     * @param BeforeScenarioScope $scope
83
     */
84
    public function initApplesBeforeScenario(BeforeScenarioScope $scope)
85
    {
86
        \PHPUnit_Framework_Assert::assertNotNull($scope);
87
    }
88
89
    /**
90
     * @AfterScenario
91
     *
92
     * @ScenarioStateArgument("bananas")
93
     *
94
     * @param array $bananas
95
     */
96
    public function saveBananasWithoutScopeAfterScenario(array $bananas)
97
    {
98
        \PHPUnit_Framework_Assert::assertEquals(['foo', 'bar'], $bananas);
99
    }
100
101
    /**
102
     * @AfterScenario
103
     *
104
     * @ScenarioStateArgument("bananas")
105
     *
106
     * @param array              $bananas
107
     * @param AfterScenarioScope $scope
108
     */
109
    public function saveBananasWithScopeAfterScenario(array $bananas, AfterScenarioScope $scope)
110
    {
111
        \PHPUnit_Framework_Assert::assertNotNull($scope);
112
        \PHPUnit_Framework_Assert::assertEquals(['foo', 'bar'], $bananas);
113
    }
114
115
    /**
116
     * @AfterScenario
117
     *
118
     * @param AfterScenarioScope $scope
119
     */
120
    public function initApplesAfterScenario(AfterScenarioScope $scope)
121
    {
122
        \PHPUnit_Framework_Assert::assertNotNull($scope);
123
    }
124
125
    /**
126
     * @When the bonobo takes a banana
127
     */
128
    public function takeBanana()
129
    {
130
        $this->scenarioState->provideStateFragment('scenarioBanana', 'Yammy Banana');
131
    }
132
133
    /**
134
     * @When gives this banana to gorilla
135
     *
136
     * @ScenarioStateArgument("scenarioBanana")
137
     *
138
     * @param string $scenarioBanana
139
     */
140
    public function giveBananaToGorilla($scenarioBanana)
141
    {
142
        \PHPUnit_Framework_Assert::assertEquals('Yammy Banana', $scenarioBanana);
143
        $gorilla = new Gorilla();
144
        $gorilla->setBanana($scenarioBanana);
145
        $this->scenarioState->provideStateFragment('scenarioGorilla', $gorilla);
146
    }
147
148
    /**
149
     * @Then the gorilla has the banana
150
     *
151
     * @ScenarioStateArgument("scenarioBanana")
152
     * @ScenarioStateArgument(name="scenarioGorilla", argument="gorilla")
153
     *
154
     * @param string  $scenarioBanana
155
     * @param Gorilla $gorilla
156
     */
157
    public function gorillaHasBanana($scenarioBanana, Gorilla $gorilla)
158
    {
159
        \PHPUnit_Framework_Assert::assertEquals('Yammy Banana', $scenarioBanana);
160
        \PHPUnit_Framework_Assert::assertEquals('Yammy Banana', $gorilla->getBanana());
161
    }
162
}
163