Completed
Push — master ( 0d15f5...968507 )
by Paweł
23s
created

ThankYouPage::goToOrderDetails()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
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\Shop\Order;
13
14
use Sylius\Behat\Page\SymfonyPage;
15
16
/**
17
 * @author Arkadiusz Krakowiak <[email protected]>
18
 * @author Grzegorz Sadowski <[email protected]>
19
 */
20
class ThankYouPage extends SymfonyPage implements ThankYouPageInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function goToOrderDetails()
26
    {
27
        $this->getElement('order_details')->click();
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function hasThankYouMessage()
34
    {
35
        $thankYouMessage = $this->getElement('thank_you')->getText();
36
37
        return false !== strpos($thankYouMessage, 'Thank you!');
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getInstructions()
44
    {
45
        return $this->getElement('instructions')->getText();
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function hasInstructions()
52
    {
53
        return null !== $this->getDocument()->find('css', '#sylius-payment-method-instructions');
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function hasChangePaymentMethodButton()
60
    {
61
        return null !== $this->getDocument()->find('css', '#sylius-show-order');
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getRouteName()
68
    {
69
        return 'sylius_shop_thank_you';
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    protected function getDefinedElements()
76
    {
77
        return array_merge(parent::getDefinedElements(), [
78
            'order_details' => '#sylius-show-order',
79
            'instructions' => '#sylius-payment-method-instructions',
80
            'thank_you' => '#sylius-thank-you',
81
        ]);
82
    }
83
}
84