Completed
Push — master ( e62357...459429 )
by Loïc
17s queued 11s
created

DashboardPage::getNumberOfNewCustomersInTheList()   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
/*
4
 * This file is part of monofony.
5
 *
6
 * (c) Mobizel
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace App\Behat\Page\Backend;
15
16
use App\Behat\Service\Accessor\TableAccessorInterface;
17
use Behat\Mink\Session;
18
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
19
use Symfony\Component\Routing\RouterInterface;
20
21
class DashboardPage extends SymfonyPage
22
{
23
    /** @var TableAccessorInterface */
24
    private $tableAccessor;
25
26
    public function __construct(
27
        Session $session,
28
        $minkParameters,
29
        RouterInterface $router,
30
        TableAccessorInterface $tableAccessor
31
    ) {
32
        parent::__construct($session, $minkParameters, $router);
33
34
        $this->tableAccessor = $tableAccessor;
35
    }
36
37
    public function getRouteName(): string
38
    {
39
        return 'app_backend_dashboard';
40
    }
41
42
    public function getNumberOfNewCustomersInTheList(): int
43
    {
44
        return $this->tableAccessor->countTableBodyRows($this->getElement('customer_list'));
45
    }
46
47
    public function getNumberOfNewCustomers(): int
48
    {
49
        return (int) $this->getElement('new_customers')->getText();
50
    }
51
52
    protected function getDefinedElements(): array
53
    {
54
        return array_merge(parent::getDefinedElements(), [
55
            'customer_list' => '#customers',
56
            'new_customers' => '#new-customers',
57
        ]);
58
    }
59
}
60