Completed
Push — master ( 3ff7e6...cf5edc )
by Kamil
96:30 queued 63:14
created

IndexPage   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getRouteName() 0 4 1
A countReviews() 0 4 1
A hasReviewTitled() 0 4 1
A hasNoReviewMessage() 0 4 1
A getDefinedElements() 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\ProductReview;
13
14
use Sylius\Behat\Page\SymfonyPage;
15
16
/**
17
 * @author Mateusz Zalewski <[email protected]>
18
 */
19
class IndexPage extends SymfonyPage implements IndexPageInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getRouteName()
25
    {
26
        return 'sylius_shop_product_reviews_index';
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function countReviews()
33
    {
34
        return count($this->getElement('reviews')->findAll('css', '.comment'));
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function hasReviewTitled($title)
41
    {
42
        return null !== $this->getElement('reviews')->find('css', sprintf('.comment:contains("%s")', $title));
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function hasNoReviewMessage()
49
    {
50
        return 'There are no reviews' === $this->getElement('reviews')->find('css', '.comments')->getText();
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    protected function getDefinedElements()
57
    {
58
        return array_merge(parent::getDefinedElements(), [
59
            'reviews' => '#reviews',
60
        ]);
61
    }
62
}
63