Completed
Pull Request — master (#124)
by Jon
13:19
created

WebContext::makeARequestSettingNameTo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Behat\Sf2DemoBundle\Features\Context;
4
5
use Behat\MinkExtension\Context\MinkContext;
6
use Behat\Sf2DemoBundle\Service\NameService;
7
use Behat\Symfony2Extension\Context\KernelAwareContext;
8
use PHPUnit\Framework\Assert;
9
use Symfony\Component\HttpFoundation\Session\Session;
10
use Symfony\Component\HttpKernel\KernelInterface;
11
12
class WebContext extends MinkContext implements KernelAwareContext
13
{
14
    private $kernel;
15
    
16
    /**
17
     * @var NameService
18
     */
19
    private $nameService;
20
21
    public function __construct(Session $session, $simpleParameter, $simpleArg, array $services, array $params, NameService $nameService)
0 ignored issues
show
Unused Code introduced by
The parameter $session is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $simpleParameter is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $simpleArg is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $services is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
        $this->nameService = $nameService;
24
    }
25
26
    /**
27
     * Sets HttpKernel instance.
28
     * This method will be automatically called by Symfony2Extension ContextInitializer.
29
     *
30
     * @param KernelInterface $kernel
31
     */
32
    public function setKernel(KernelInterface $kernel)
33
    {
34
        $this->kernel = $kernel;
35
    }
36
37
    /**
38
     * @Given I have a service set to :name
39
     */
40
    public function iHaveANameService($name)
41
    {
42
        $this->nameService->setName($name);
43
    }
44
45
    /**
46
     * @When make a request setting name to :name
47
     */
48
    public function makeARequestSettingNameTo($name)
49
    {
50
        $this->visit('set-name/'.$name);
51
    }
52
53
    /**
54
     * @Then the service value should have remained :name
55
     * @Then the service value should have changed to :name
56
     */
57
    public function theServiceValueShouldRemain($name)
58
    {
59
        Assert::assertEquals($name, $this->nameService->getName());
60
    }
61
}
62