Completed
Push — master ( d898e2...4cc160 )
by Kamil
19:55
created

UpdatePage::specifyPermalink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
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\Taxon;
13
14
use Behat\Mink\Element\NodeElement;
15
use Sylius\Behat\Behaviour\ChecksCodeImmutability;
16
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
17
use Sylius\Component\Core\Model\TaxonInterface;
18
19
/**
20
 * @author Arkadiusz Krakowiak <[email protected]>
21
 */
22
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
23
{
24
    use ChecksCodeImmutability;
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function chooseParent(TaxonInterface $taxon)
30
    {
31
        $this->getElement('parent')->selectOption($taxon->getName(), false);
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function describeItAs($description, $languageCode)
38
    {
39
        $this->getDocument()->fillField(sprintf('sylius_taxon_translations_%s_description', $languageCode), $description);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function nameIt($name, $languageCode)
46
    {
47
        $this->getDocument()->fillField(sprintf('sylius_taxon_translations_%s_name', $languageCode), $name);
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function specifyPermalink($permalink, $languageCode)
54
    {
55
        $this->getDocument()->fillField(sprintf('sylius_taxon_translations_%s_permalink', $languageCode), $permalink);
56
    }
57
58
    /**
59
     * @return NodeElement
60
     */
61
    protected function getCodeElement()
62
    {
63
        return $this->getElement('code');
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    protected function getDefinedElements()
70
    {
71
        return array_merge(parent::getDefinedElements(), [
72
            'code' => '#sylius_taxon_code',
73
            'name' => '#sylius_taxon_translations_en_US_name',
74
            'parent' => '#sylius_taxon_parent',
75
            'permalink' => '#sylius_taxon_translations_en_US_permalink',
76
            'description' => '#sylius_taxon_translations_en_US_description',
77
        ]);
78
    }
79
}
80