Completed
Push — master ( c66308...141223 )
by Kamil
28:38 queued 09:41
created

UpdatePage   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A specifyTitle() 0 4 1
A specifyComment() 0 4 1
A chooseRating() 0 6 1
A getRating() 0 4 1
A getProductName() 0 4 1
A getCustomerName() 0 4 1
A getDefinedElements() 0 11 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\ProductReview;
13
14
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
15
16
/**
17
 * @author Grzegorz Sadowski <[email protected]>
18
 */
19
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function specifyTitle($title)
25
    {
26
        $this->getElement('title')->setValue($title);
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function specifyComment($comment)
33
    {
34
        $this->getElement('comment')->setValue($comment);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function chooseRating($rating)
41
    {
42
        $position = (int) $rating - 1;
43
44
        $this->getElement('rating', ['%position%' => $position])->getParent()->click();
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getRating()
51
    {
52
        return $this->getElement('checked_rating')->getValue();
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function getProductName()
59
    {
60
        return $this->getElement('review_subject')->getHtml();
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function getCustomerName()
67
    {
68
        return $this->getElement('author')->getHtml();
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    protected function getDefinedElements()
75
    {
76
        return array_merge(parent::getDefinedElements(), [
77
            'author' => '#author-name > .header',
78
            'checked_rating' => 'input[checked="checked"]',
79
            'comment' => '#sylius_product_review_comment',
80
            'rating' => '#sylius_product_review_rating_%position%',
81
            'review_subject' => '#review-subject-name > .header',
82
            'title' => '#sylius_product_review_title',
83
        ]);
84
    }
85
}
86