Completed
Push — master ( 4e9462...2570d1 )
by Kamil
18:48
created

ShowPage::pressDelete()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 15
rs 9.4285
cc 2
eloc 8
nc 2
nop 0
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\ShippingMethod;
13
14
use Sylius\Behat\Page\ElementNotFoundException;
15
use Sylius\Behat\Page\SymfonyPage;
16
17
/**
18
 * @author Jan Góralski <[email protected]>
19
 */
20
class ShowPage extends SymfonyPage implements ShowPageInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function getRouteName()
26
    {
27
        return 'sylius_backend_shipping_method_show';
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function pressDelete()
34
    {
35
        $this->getDocument()->pressButton('Delete');
36
37
        $modal = $this->getDocument()->find('css', $modalName = '#confirmation-modal');
38
        if (null === $modal) {
39
            throw new ElementNotFoundException(sprintf('The element "%s" was not found on page.', $modalName));
40
        }
41
42
        $confirmButton = $modal->find('css', 'a:contains(Delete)');
43
44
        $this->waitForModalToAppear($modal);
45
46
        $confirmButton->press();
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function flashContainsMessage($message)
53
    {
54
        return false !== strpos($this->getDocument()->find('css', '#flashes > div')->getText(), $message);
55
    }
56
}
57