Completed
Push — master ( 9e29b7...c3d8ab )
by Yaroslav
19:31
created

AuthContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A gatherContexts() 0 6 1
A iLoginAsAdmin() 0 7 1
1
<?php
2
3
use Behat\Behat\Context\Environment\InitializedContextEnvironment;
4
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
5
use Behat\MinkExtension\Context\RawMinkContext;
6
7
class AuthContext extends RawMinkContext
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
    /**
10
     * @var MinkContext
11
     */
12
    private $minkContext;
13
14
    /**
15
     * @BeforeScenario
16
     * @param BeforeScenarioScope $scope
17
     */
18
    public function gatherContexts(BeforeScenarioScope $scope)
19
    {
20
        /** @var InitializedContextEnvironment $environment */
21
        $environment = $scope->getEnvironment();
22
        $this->minkContext = $environment->getContext(MinkContext::class);
23
    }
24
25
    /**
26
     * @Given /^I login as admin$/
27
     */
28
    public function iLoginAsAdmin()
29
    {
30
        $this->minkContext->visit('/admin/login');
31
        $this->minkContext->fillField('username or email', 'admin');
32
        $this->minkContext->fillField('password', 'admin');
33
        $this->minkContext->pressButton('Log in');
34
    }
35
}
36