Completed
Pull Request — master (#44)
by Dmitry
04:42
created

IndexPage::containsLegend()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace hipanel\tests\_support\Page;
4
5
use hipanel\tests\_support\Page\Widget\Input\TestableInput;
6
7
class IndexPage extends Authenticated
8
{
9
    /**
10
     * @param TestableInput[] $inputs Example:
11
     * ```php
12
     *  [
13
     *      new Input('Domain name'),
14
     *      new Textarea('Domain names (one per row)'),
15
     *      new Select2('Status'),
16
     *  ]
17
     *```
18
     */
19
    public function containsFilters(array $inputs): void
20
    {
21
        $I = $this->tester;
22
23
        $I->see('Advanced search', 'h3');
24
        $formId = $I->grabAttributeFrom("//form[contains(@id, 'advancedsearch')]", 'id');
25
26
        foreach ($inputs as $input) {
27
            $input->isVisible($I, $formId);
28
        }
29
        $I->see('Search', "//form[@id='$formId']//button[@type='submit']");
30
        $I->see('Clear', "//form[@id='$formId']//a");
31
    }
32
33
    /**
34
     * @param string[] $list array of legend list
35
     */
36
    public function containsLegend(array $list): void
37
    {
38
        $I = $this->tester;
39
40
        $I->see('Legend', 'h3');
41
42
        foreach ($list as $text) {
43
            $I->see($text, "//h3[text()='Legend']/../../div/ul/li");
44
        }
45
    }
46
47
    /**
48
     * @param string[] $buttons array of buttons
49
     */
50
    public function containsBulkButtons(array $buttons): void
51
    {
52
        $I = $this->tester;
53
54
        foreach ($buttons as $text) {
55
            $I->see($text, "//button[@type='submit' or @type='button']");
56
        }
57
    }
58
59
    /**
60
     * @param string $formId
0 ignored issues
show
Bug introduced by
There is no parameter named $formId. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
61
     * @param string[] $columnNames array of column names
62
     */
63
    public function containsColumns(array $columnNames): void
64
    {
65
        $I = $this->tester;
66
        $formId = $I->grabAttributeFrom("//form[contains(@id, 'bulk') and contains(@id, 'search')]", 'id');
67
68
        foreach ($columnNames as $column) {
69
            $I->see($column, "//form[@id='$formId']//table/thead/tr/th");
70
        }
71
    }
72
}
73