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

AuthContext::iLoginAsAdmin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
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