Completed
Push — master ( b716f1...2f9340 )
by Kamil
18:43
created

SecurityContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 43
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A iAmLoggedInAs() 0 4 1
A setMink() 0 4 1
A setMinkParameters() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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 Sylius\Behat\Context\Setup;
13
14
use Behat\Behat\Context\Context;
15
use Behat\Mink\Mink;
16
use Behat\MinkExtension\Context\MinkAwareContext;
17
use Sylius\Bundle\CoreBundle\Test\Services\SecurityServiceInterface;
18
19
/**
20
 * @author Arkadiusz Krakowiak <[email protected]>
21
 */
22
final class SecurityContext implements Context, MinkAwareContext
23
{
24
    /**
25
     * @var SecurityServiceInterface
26
     */
27
    private $securityService;
28
29
    /**
30
     * @var Mink
31
     */
32
    private $mink;
33
34
    /**
35
     * @param SecurityServiceInterface $securityService
36
     */
37
    public function __construct(SecurityServiceInterface $securityService)
38
    {
39
        $this->securityService = $securityService;
40
    }
41
42
    /**
43
     * @Given I am logged in as :email
44
     */
45
    public function iAmLoggedInAs($email)
46
    {
47
        $this->securityService->logIn($email, 'main', $this->mink->getSession());
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function setMink(Mink $mink)
54
    {
55
        $this->mink = $mink;
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function setMinkParameters(array $parameters)
62
    {
63
    }
64
}
65