Completed
Push — master ( 4de43c...7a7d43 )
by Paul
06:26
created

JavascriptContext::maximizeWindow()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 2
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace Victoire\Tests\Features\Context;
4
5
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
6
use Behat\Mink\Driver\Selenium2Driver;
7
use Knp\FriendlyContexts\Context\RawMinkContext;
8
9
class JavascriptContext extends RawMinkContext
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
10
{
11
    /**
12
     * @BeforeScenario
13
     *
14
     * @param BeforeScenarioScope $scope
15
     */
16
    public function maximizeWindow(BeforeScenarioScope $scope)
0 ignored issues
show
Unused Code introduced by
The parameter $scope 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...
17
    {
18
        if (($this->getSession()->getDriver() instanceof Selenium2Driver)) {
19
            $this->iMaximizeTheWindow();
20
        }
21
    }
22
23
    /**
24
     * @When /^I maximize the window/
25
     */
26
    public function iMaximizeTheWindow()
27
    {
28
        //the window got with maximizeWindow native function is too small
29
        $this->getSession()->resizeWindow(1600, 1200, 'current');
30
    }
31
32
    /**
33
     * @When /^I minimize the window/
34
     */
35
    public function iMinimizeTheWindow()
36
    {
37
        $this->getSession()->resizeWindow(500, 500, 'current');
38
    }
39
40
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$width" missing
Loading history...
introduced by
Doc comment for parameter "$height" missing
Loading history...
41
     * @When /^I resize the window to (\d+)x(\d+)/
42
     */
43
    public function iResizeTheWindow($width, $height)
44
    {
45
        $this->getSession()->resizeWindow(intval($width), intval($height), 'current');
46
    }
47
}
48