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

ScenarioStateHookableScenarioTester::setUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2.1481

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 4
cts 6
cp 0.6667
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 4
crap 2.1481
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
namespace Gorghoa\ScenarioStateBehatExtension\Hook\Tester;
13
14
use Behat\Behat\Hook\Scope\AfterScenarioScope;
15
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
16
use Behat\Behat\Tester\ScenarioTester;
17
use Behat\Gherkin\Node\FeatureNode;
18
use Behat\Gherkin\Node\ScenarioInterface as Scenario;
19
use Behat\Testwork\Environment\Environment;
20
use Behat\Testwork\Hook\Tester\Setup\HookedSetup;
21
use Behat\Testwork\Hook\Tester\Setup\HookedTeardown;
22
use Behat\Testwork\Tester\Result\TestResult;
23
use Gorghoa\ScenarioStateBehatExtension\Hook\Dispatcher\ScenarioStateHookDispatcher;
24
25
/**
26
 * @author Vincent Chalamon <[email protected]>
27
 */
28
final class ScenarioStateHookableScenarioTester implements ScenarioTester
29
{
30
    /**
31
     * @var ScenarioTester
32
     */
33
    private $baseTester;
34
35
    /**
36
     * @var ScenarioStateHookDispatcher
37
     */
38
    private $dispatcher;
39
40
    /**
41
     * @param ScenarioTester      $baseTester
42
     * @param ScenarioStateHookDispatcher $dispatcher
43
     */
44 3
    public function __construct(ScenarioTester $baseTester, ScenarioStateHookDispatcher $dispatcher)
45
    {
46 3
        $this->baseTester = $baseTester;
47 3
        $this->dispatcher = $dispatcher;
48 3
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 1 View Code Duplication
    public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55 1
        $setup = $this->baseTester->setUp($env, $feature, $scenario, true);
56
57 1
        if ($skip) {
58 1
            return $setup;
59
        }
60
61
        $hookCallResults = $this->dispatcher->dispatchScopeHooks(new BeforeScenarioScope($env, $feature, $scenario));
62
63
        return new HookedSetup($setup, $hookCallResults);
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69 1
    public function test(Environment $env, FeatureNode $feature, Scenario $scenario, $skip)
70
    {
71 1
        return $this->baseTester->test($env, $feature, $scenario, $skip);
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77 1 View Code Duplication
    public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
78
    {
79 1
        $teardown = $this->baseTester->tearDown($env, $feature, $scenario, true, $result);
80
81 1
        if ($skip) {
82 1
            return $teardown;
83
        }
84
85
        $hookCallResults = $this->dispatcher->dispatchScopeHooks(new AfterScenarioScope($env, $feature, $scenario, $result));
86
87
        return new HookedTeardown($teardown, $hookCallResults);
88
    }
89
}
90