Completed
Pull Request — 3.1 (#348)
by Piotr
01:23
created

Filters   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hasBetweenFilter() 0 6 3
A hasChoiceFilter() 0 4 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\Element;
13
14
use SensioLabs\Behat\PageObjectExtension\PageObject\Element;
15
16
class Filters extends Element
17
{
18
    protected $selector = ['css' => 'form.filters'];
19
20
    public function hasBetweenFilter($filterName, $fromName, $toName): bool
21
    {
22
        return $this->find('css', sprintf('label:contains("%s")', $filterName))
23
            && $this->findField($fromName)
24
            && $this->findField($toName);
25
    }
26
27
    public function hasChoiceFilter($filterName): bool
28
    {
29
        return $this->hasField($filterName) && ($this->findField($filterName)->getTagName() == 'select');
30
    }
31
}
32