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:57
created

FeatureContext::saveBananasWithScope()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
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\BeforeScenarioScope;
13
use Gorghoa\ScenarioStateBehatExtension\Annotation\ScenarioStateArgument;
14
use Gorghoa\ScenarioStateBehatExtension\Context\ScenarioStateAwareContext;
15
use Gorghoa\ScenarioStateBehatExtension\ScenarioStateInterface;
16
use Gorghoa\ScenarioStateBehatExtension\TestApp\Gorilla;
17
18
/**
19
 * @author Rodrigue Villetard <[email protected]>
20
 */
21
class FeatureContext implements ScenarioStateAwareContext
22
{
23
    /**
24
     * @beforeSuite
25
     */
26
    public static function setUpSuite()
27
    {
28
        require_once __DIR__.'/../../autoload.php';
29
    }
30
31
    /**
32
     * @var ScenarioStateInterface
33
     */
34
    private $scenarioState;
35
36
    /**
37
     * @param ScenarioStateInterface $scenarioState
38
     */
39
    public function setScenarioState(ScenarioStateInterface $scenarioState)
40
    {
41
        $this->scenarioState = $scenarioState;
42
    }
43
44
    /**
45
     * @BeforeScenario
46
     */
47
    public function initBananas()
48
    {
49
        $this->scenarioState->provideStateFragment('bananas', ['foo', 'bar']);
50
    }
51
52
    /**
53
     * @BeforeScenario
54
     *
55
     * @ScenarioStateArgument("bananas")
56
     *
57
     * @param array $bananas
58
     */
59
    public function saveBananasWithoutScope(array $bananas)
60
    {
61
        \PHPUnit_Framework_Assert::assertEquals(['foo', 'bar'], $bananas);
62
    }
63
64
    /**
65
     * @BeforeScenario
66
     *
67
     * @ScenarioStateArgument("bananas")
68
     *
69
     * @param BeforeScenarioScope $scope
70
     * @param array               $bananas
71
     */
72
    public function saveBananasWithScope(BeforeScenarioScope $scope, array $bananas)
73
    {
74
        \PHPUnit_Framework_Assert::assertNotNull($scope);
75
        \PHPUnit_Framework_Assert::assertEquals(['foo', 'bar'], $bananas);
76
    }
77
78
    /**
79
     * @BeforeScenario
80
     *
81
     * @param BeforeScenarioScope $scope
82
     */
83
    public function initApples(BeforeScenarioScope $scope)
84
    {
85
        \PHPUnit_Framework_Assert::assertNotNull($scope);
86
    }
87
88
    /**
89
     * @When the bonobo takes a banana
90
     */
91
    public function takeBanana()
92
    {
93
        $this->scenarioState->provideStateFragment('scenarioBanana', 'Yammy Banana');
94
    }
95
96
    /**
97
     * @When gives this banana to gorilla
98
     *
99
     * @ScenarioStateArgument("scenarioBanana")
100
     *
101
     * @param string $scenarioBanana
102
     */
103
    public function giveBananaToGorilla($scenarioBanana)
104
    {
105
        \PHPUnit_Framework_Assert::assertEquals('Yammy Banana', $scenarioBanana);
106
        $gorilla = new Gorilla();
107
        $gorilla->setBanana($scenarioBanana);
108
        $this->scenarioState->provideStateFragment('scenarioGorilla', $gorilla);
109
    }
110
111
    /**
112
     * @Then the gorilla has the banana
113
     *
114
     * @ScenarioStateArgument("scenarioBanana")
115
     * @ScenarioStateArgument(name="scenarioGorilla", argument="gorilla")
116
     *
117
     * @param string  $scenarioBanana
118
     * @param Gorilla $gorilla
119
     */
120
    public function gorillaHasBanana($scenarioBanana, Gorilla $gorilla)
121
    {
122
        \PHPUnit_Framework_Assert::assertEquals('Yammy Banana', $scenarioBanana);
123
        \PHPUnit_Framework_Assert::assertEquals('Yammy Banana', $gorilla->getBanana());
124
    }
125
}
126