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

IndexPage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A accept() 0 4 1
A reject() 0 4 1
A getActionButtonsField() 0 10 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 Behat\Mink\Element\NodeElement;
15
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
16
17
/**
18
 * @author Grzegorz Sadowski <[email protected]>
19
 */
20
class IndexPage extends BaseIndexPage implements IndexPageInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function accept(array $parameters)
26
    {
27
        $this->getActionButtonsField($parameters)->pressButton('Accept');
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function reject(array $parameters)
34
    {
35
        $this->getActionButtonsField($parameters)->pressButton('Reject');
36
    }
37
38
    /**
39
     * @param array $parameters
40
     *
41
     * @return NodeElement
42
     */
43
    private function getActionButtonsField(array $parameters)
44
    {
45
        $tableAccessor = $this->getTableAccessor();
46
        $table = $this->getElement('table');
47
48
        $row = $tableAccessor->getRowWithFields($table, $parameters);
49
        $actionButtonsField = $tableAccessor->getFieldFromRow($table, $row, 'actions');
50
51
        return $actionButtonsField;
52
    }
53
}
54