Code Duplication    Length = 79-79 lines in 2 locations

tests/Behat/Page/Admin/ProductBlock/UpdatePage.php 1 location

@@ 7-85 (lines=79) @@
4
5
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
6
7
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function changeBodyTo($body)
13
    {
14
        $this->getElement('body')->setValue($body);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function changeLinkTo($link)
21
    {
22
        $this->getElement('link')->setValue($link);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function changeTitleTo($title)
29
    {
30
        $this->getElement('title')->setValue($title);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function changeProductTo($productName)
37
    {
38
        $this->getElement('product')->selectOption($productName);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getBody()
45
    {
46
        return $this->getElement('body')->getValue();
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getLink()
53
    {
54
        return $this->getElement('link')->getValue();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getTitle()
61
    {
62
        return $this->getElement('title')->getValue();
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getProduct()
69
    {
70
        return $this->getElement('product')->find('css', 'option:selected')->getText();
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    protected function getDefinedElements()
77
    {
78
        return array_merge(parent::getDefinedElements(), [
79
            'body' => '#lakion_sylius_cms_product_block_body',
80
            'link' => '#lakion_sylius_cms_product_block_linkUrl',
81
            'product' => '#lakion_sylius_cms_product_block_product',
82
            'title' => '#lakion_sylius_cms_product_block_title',
83
        ]);
84
    }
85
}
86

tests/Behat/Page/Admin/TaxonBlock/UpdatePage.php 1 location

@@ 7-85 (lines=79) @@
4
5
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
6
7
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function changeBodyTo($body)
13
    {
14
        $this->getElement('body')->setValue($body);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function changeLinkTo($link)
21
    {
22
        $this->getElement('link')->setValue($link);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function changeTitleTo($title)
29
    {
30
        $this->getElement('title')->setValue($title);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function changeTaxonTo($taxonName)
37
    {
38
        $this->getElement('taxon')->selectOption($taxonName);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function getBody()
45
    {
46
        return $this->getElement('body')->getValue();
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function getLink()
53
    {
54
        return $this->getElement('link')->getValue();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function getTitle()
61
    {
62
        return $this->getElement('title')->getValue();
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getTaxon()
69
    {
70
        return $this->getElement('taxon')->find('css', 'option:selected')->getText();
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    protected function getDefinedElements()
77
    {
78
        return array_merge(parent::getDefinedElements(), [
79
            'body' => '#lakion_sylius_cms_taxon_block_body',
80
            'link' => '#lakion_sylius_cms_taxon_block_linkUrl',
81
            'taxon' => '#lakion_sylius_cms_taxon_block_taxon',
82
            'title' => '#lakion_sylius_cms_taxon_block_title',
83
        ]);
84
    }
85
}
86