Code Duplication    Length = 64-64 lines in 2 locations

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

@@ 7-70 (lines=64) @@
4
5
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
6
7
class CreatePage extends BaseCreatePage implements CreatePageInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function setBody($body)
13
    {
14
        $this->getSession()->getPage()->fillField('Body', $body);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function setLink($link)
21
    {
22
        $this->getSession()->getPage()->fillField('Link', $link);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function setName($name)
29
    {
30
        $this->getSession()->getPage()->fillField('Name', $name);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function setTitle($title)
37
    {
38
        $this->getSession()->getPage()->fillField('Title', $title);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function chooseProduct($productName)
45
    {
46
        $this->getSession()->getPage()->selectFieldOption('Product', $productName);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function attachImage($relativePath)
53
    {
54
        $this->getSession()->getPage()->attachFileToField('Image', (string) $this->getParameter('files_path') . $relativePath);
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    protected function getDefinedElements()
61
    {
62
        return array_merge(parent::getDefinedElements(), [
63
            'body' => '#lakion_sylius_cms_product_block_body',
64
            'link' => '#lakion_sylius_cms_product_block_linkUrl',
65
            'name' => '#lakion_sylius_cms_product_block_name',
66
            'product' => '#lakion_sylius_cms_product_block_product',
67
            'title' => '#lakion_sylius_cms_product_block_title',
68
        ]);
69
    }
70
}
71

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

@@ 7-70 (lines=64) @@
4
5
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
6
7
class CreatePage extends BaseCreatePage implements CreatePageInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function setBody($body)
13
    {
14
        $this->getSession()->getPage()->fillField('Body', $body);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function setLink($link)
21
    {
22
        $this->getSession()->getPage()->fillField('Link', $link);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function setName($name)
29
    {
30
        $this->getSession()->getPage()->fillField('Name', $name);
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function setTitle($title)
37
    {
38
        $this->getSession()->getPage()->fillField('Title', $title);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function chooseTaxon($taxonName)
45
    {
46
        $this->getSession()->getPage()->selectFieldOption('Taxon', $taxonName);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function attachImage($relativePath)
53
    {
54
        $this->getSession()->getPage()->attachFileToField('Image', (string) $this->getParameter('files_path') . $relativePath);
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    protected function getDefinedElements()
61
    {
62
        return array_merge(parent::getDefinedElements(), [
63
            'body' => '#lakion_sylius_cms_taxon_block_body',
64
            'link' => '#lakion_sylius_cms_taxon_block_linkUrl',
65
            'name' => '#lakion_sylius_cms_taxon_block_name',
66
            'taxon' => '#lakion_sylius_cms_taxon_block_taxon',
67
            'title' => '#lakion_sylius_cms_taxon_block_title',
68
        ]);
69
    }
70
}
71