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\Crud\IndexPageInterface; |
16
|
|
|
use Sylius\Behat\Page\Admin\Locale\CreatePageInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @author Łukasz Chruściel <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
final class ManagingLocalesContext implements Context |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var IndexPageInterface |
25
|
|
|
*/ |
26
|
|
|
private $indexPage; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var CreatePageInterface |
30
|
|
|
*/ |
31
|
|
|
private $createPage; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param IndexPageInterface $indexPage |
35
|
|
|
* @param CreatePageInterface $createPage |
36
|
|
|
*/ |
37
|
|
|
public function __construct(IndexPageInterface $indexPage, CreatePageInterface $createPage) |
38
|
|
|
{ |
39
|
|
|
$this->indexPage = $indexPage; |
40
|
|
|
$this->createPage = $createPage; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @Given I want to create a new locale |
45
|
|
|
*/ |
46
|
|
|
public function iWantToCreateNewLocale() |
47
|
|
|
{ |
48
|
|
|
$this->createPage->open(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @When I choose :name |
53
|
|
|
*/ |
54
|
|
|
public function iChoose($name) |
55
|
|
|
{ |
56
|
|
|
$this->createPage->chooseName($name); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @When I add it |
61
|
|
|
*/ |
62
|
|
|
public function iAdd() |
63
|
|
|
{ |
64
|
|
|
$this->createPage->create(); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @Then I should be notified about success |
69
|
|
|
*/ |
70
|
|
|
public function iShouldBeNotifiedAboutSuccess() |
71
|
|
|
{ |
72
|
|
|
expect($this->indexPage->hasSuccessMessage())->toBe(true); |
73
|
|
|
expect($this->indexPage->isSuccessfullyCreated())->toBe(true); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @Then the store should be available in the :name language |
78
|
|
|
*/ |
79
|
|
|
public function storeShouldBeAvailableInLanguage($name) |
80
|
|
|
{ |
81
|
|
|
expect($this->indexPage->isResourceOnPage(['name' => $name]))->toBe(true); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|