Completed
Pull Request — master (#18)
by Kamil
03:02
created

CreatePage   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setBody() 0 4 1
A setLink() 0 4 1
A setName() 0 4 1
A setTitle() 0 4 1
A attachImage() 0 4 1
A getDefinedElements() 0 9 1
1
<?php
2
3
namespace Lakion\SyliusCmsBundle\Tests\Behat\Page\Admin\CustomBlock;
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 attachImage($relativePath)
45
    {
46
        $this->getSession()->getPage()->attachFileToField('Image', (string) $this->getParameter('files_path') . $relativePath);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    protected function getDefinedElements()
53
    {
54
        return array_merge(parent::getDefinedElements(), [
55
            'body' => '#lakion_sylius_cms_custom_block_body',
56
            'link' => '#lakion_sylius_cms_custom_block_linkUrl',
57
            'name' => '#lakion_sylius_cms_custom_block_name',
58
            'title' => '#lakion_sylius_cms_custom_block_title',
59
        ]);
60
    }
61
}
62