Completed
Push — master ( 6999e1...b703c9 )
by Kamil
23:47
created

ManagingLocalesContext::iCannotDisableIt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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\Context\Ui\Admin;
13
14
use Behat\Behat\Context\Context;
15
use Sylius\Behat\Page\Admin\Locale\CreatePageInterface;
16
use Sylius\Behat\Page\Admin\Crud\IndexPageInterface;
17
use Webmozart\Assert\Assert;
18
19
/**
20
 * @author Łukasz Chruściel <[email protected]>
21
 */
22
final class ManagingLocalesContext implements Context
23
{
24
    /**
25
     * @var CreatePageInterface
26
     */
27
    private $createPage;
28
29
    /**
30
     * @var IndexPageInterface
31
     */
32
    private $indexPage;
33
34
    /**
35
     * @param CreatePageInterface $createPage
36
     * @param IndexPageInterface $indexPage
37
     */
38
    public function __construct(CreatePageInterface $createPage, IndexPageInterface $indexPage)
39
    {
40
        $this->createPage = $createPage;
41
        $this->indexPage = $indexPage;
42
    }
43
44
    /**
45
     * @Given I want to create a new locale
46
     * @Given I want to add a new locale
47
     */
48
    public function iWantToCreateNewLocale()
49
    {
50
        $this->createPage->open();
51
    }
52
53
    /**
54
     * @When I choose :name
55
     */
56
    public function iChoose($name)
57
    {
58
        $this->createPage->chooseName($name);
59
    }
60
61
    /**
62
     * @When I add it
63
     */
64
    public function iAdd()
65
    {
66
        $this->createPage->create();
67
    }
68
69
    /**
70
     * @Then the store should be available in the :name language
71
     */
72
    public function storeShouldBeAvailableInLanguage($name)
73
    {
74
        $doesLocaleExist = $this->indexPage->isSingleResourceOnPage(['name' => $name]);
75
        Assert::true($doesLocaleExist);
76
    }
77
78
    /**
79
     * @Then I should not be able to choose :name
80
     */
81
    public function iShouldNotBeAbleToChoose($name)
82
    {
83
        Assert::false($this->createPage->isOptionAvailable($name));
84
    }
85
}
86