Completed
Push — master ( 1ecbe4...2ec63c )
by Kamil
21:52
created

CreateConfigurableProductPage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A nameItIn() 0 6 1
A selectOption() 0 4 1
A getDefinedElements() 0 7 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\Product;
13
14
use Sylius\Behat\Behaviour\SpecifiesItsCode;
15
use Sylius\Behat\Page\Admin\Crud\CreatePage as BaseCreatePage;
16
17
/**
18
 * @author Łukasz Chruściel <[email protected]>
19
 */
20
class CreateConfigurableProductPage extends BaseCreatePage implements CreateConfigurableProductPageInterface
21
{
22
    use SpecifiesItsCode;
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function nameItIn($name, $localeCode)
28
    {
29
        $this->getDocument()->fillField(
30
            sprintf('sylius_product_translations_%s_name', $localeCode), $name
31
        );
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function selectOption($optionName)
38
    {
39
        $this->getDocument()->selectFieldOption('Options', $optionName);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    protected function getDefinedElements()
46
    {
47
        return array_merge(parent::getDefinedElements(), [
48
            'code' => '#sylius_product_code',
49
            'name' => '#sylius_product_translations_en_US_name',
50
        ]);
51
    }
52
}
53