Completed
Push — master ( 2ec63c...d54afb )
by Kamil
21:51
created

DashboardPage   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 43
rs 10
c 2
b 1
f 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getRouteName() 0 4 1
A hasCustomerName() 0 4 1
A hasCustomerEmail() 0 4 1
A getDefinedElements() 0 6 1
A hasValueInCustomerSection() 0 6 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