Completed
Push — master ( 35528d...2fa5ae )
by Paweł
34:34 queued 34:19
created

DashboardPage::hasValueInCustomerSection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
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
namespace Sylius\Behat\Page\Shop\Account;
13
14
use Sylius\Behat\Page\SymfonyPage;
15
16
/**
17
 * @author Grzegorz Sadowski <[email protected]>
18
 */
19
class DashboardPage extends SymfonyPage implements DashboardPageInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getRouteName()
25
    {
26
        return 'sylius_shop_account_dashboard';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function hasCustomerName($name)
33
    {
34
        return $this->hasValueInCustomerSection($name);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function hasCustomerEmail($email)
41
    {
42
        return $this->hasValueInCustomerSection($email);
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    protected function getDefinedElements()
49
    {
50
        return array_merge(parent::getDefinedElements(), [
51
            'customer' => '#customer-information',
52
        ]);
53
    }
54
    
55
    private function hasValueInCustomerSection($value)
56
    {
57
        $customerText = $this->getElement('customer')->getText();
58
59
        return stripos($customerText, $value) !== false;
60
    }
61
}
62