Completed
Pull Request — master (#71)
by
unknown
03:55
created

XEditable::getRowsInTableForFill()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace hipanel\tests\_support\Page\Widget\Input;
4
5
use hipanel\tests\_support\AcceptanceTester;
6
7
/**
8
 * Class XEditable
9
 *
10
 * Represent XEditable input element.
11
 * @package hipanel\tests\_support\Page\Widget\Input
12
 */
13
class XEditable
14
{
15
    private $tester;
16
17
    public function __construct(AcceptanceTester $tester)
18
    {
19
        $this->tester = $tester;
20
    }
21
22
    /**
23
     * @return int
24
     */
25
    public function getRowsInTableForFill(): int
26
    {
27
        return count($this->tester->grabMultiple("//a[contains(@class, 'editable')]"));
28
    }
29
30
    /**
31
     * @param string $note
32
     * @param int $row
33
     */
34
    public function fillNoteWithoutAjax(string $note, int $row): void
35
    {
36
        $this->tester->click("div.price-item:nth-child($row) a.editable");
37
        (new Input($this->tester, "div.price-item:nth-child($row) div.editable-input input"))
38
            ->setValue($note);
39
        $this->tester->click("div.price-item:nth-child($row) button[type=submit]");
40
    }
41
}
42
43