Completed
Pull Request — 3.1 (#348)
by Piotr
20:24
created

DisplayContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setKernel() 0 4 1
A iShouldSeeDisplayWithFollowingFields() 0 7 2
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace FSi\Bundle\AdminBundle\Behat\Context;
13
14
use Behat\Gherkin\Node\TableNode;
15
use Behat\Symfony2Extension\Context\KernelAwareContext;
16
use SensioLabs\Behat\PageObjectExtension\Context\PageObjectContext;
17
use Symfony\Component\HttpKernel\KernelInterface;
18
19
class DisplayContext extends PageObjectContext implements KernelAwareContext
20
{
21
    /**
22
     * @var KernelInterface
23
     */
24
    protected $kernel;
25
26
    public function setKernel(KernelInterface $kernel): void
27
    {
28
        $this->kernel = $kernel;
29
    }
30
31
    /**
32
     * @Given /^I should see display with following fields$/
33
     */
34
    public function iShouldSeeDisplayWithFollowingFields(TableNode $table)
35
    {
36
        $display = $this->getPage('News display')->getElement('Display');
37
        foreach ($table->getHash() as $row) {
38
            expect($display->hasFieldWithName($row['Field name']))->toBe(true);
39
        }
40
    }
41
}
42