Completed
Push — master ( 284884...b70f30 )
by Kamil
20:25
created

ShowPage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
c 1
b 1
f 0
lcom 1
cbo 4
dl 0
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isRegistered() 0 6 1
A deleteAccount() 0 14 2
A getRouteName() 0 4 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\Admin\Customer;
13
14
use Sylius\Behat\Page\ElementNotFoundException;
15
use Sylius\Behat\Page\SymfonyPage;
16
17
/**
18
 * @author Magdalena Banasiak <[email protected]>
19
 */
20
class ShowPage extends SymfonyPage implements ShowPageInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function isRegistered()
26
    {
27
        $username = $this->getDocument()->find('css', '#username')->getText();
28
29
        return '' != $username;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function deleteAccount()
36
    {
37
        $deleteButton = $this->getDocument()->find('css', '.delete-action-form');
38
39
        if (null === $deleteButton) {
40
            throw new ElementNotFoundException('Element not found.');
41
        }
42
43
        $deleteButton->press();
44
45
        $confirmationModal = $this->getDocument()->find('css', '#confirmation-modal-confirm');
46
        $this->waitForModalToAppear($confirmationModal);
47
        $confirmationModal->find('css', 'a:contains("Delete")')->press();
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    protected function getRouteName()
54
    {
55
        return 'sylius_backend_customer_show';
56
    }
57
}
58