1 | <?php |
||
24 | final class ManagingTaxonsContext implements Context |
||
25 | { |
||
26 | /** |
||
27 | * @var Client |
||
28 | */ |
||
29 | private $client; |
||
30 | |||
31 | /** |
||
32 | * @var SessionInterface |
||
33 | */ |
||
34 | private $session; |
||
35 | |||
36 | /** |
||
37 | * @param Client $client |
||
38 | * @param SessionInterface $session |
||
39 | */ |
||
40 | public function __construct(Client $client, SessionInterface $session) |
||
45 | |||
46 | /** |
||
47 | * @When I look for a taxon with :phrase in name |
||
48 | */ |
||
49 | public function iTypeIn($phrase) |
||
54 | |||
55 | /** |
||
56 | * @When I want to get taxon with :code code |
||
57 | */ |
||
58 | public function iWantToGetTaxonWithCode($code) |
||
63 | |||
64 | /** |
||
65 | * @When /^I want to get children from (taxon "[^"]+")/ |
||
66 | */ |
||
67 | public function iWantToGetChildrenFromTaxon(TaxonInterface $taxon) |
||
68 | { |
||
69 | $this->client->getCookieJar()->set(new Cookie($this->session->getName(), $this->session->getId())); |
||
70 | $this->client->request('GET', '/admin/ajax/taxons/leafs', ['parentCode' => $taxon->getCode()], [], ['ACCEPT' => 'application/json']); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @When I want to get taxon root |
||
75 | */ |
||
76 | public function iWantToGetTaxonRoot() |
||
81 | |||
82 | /** |
||
83 | * @Then /^I should see (\d+) taxons on the list$/ |
||
84 | */ |
||
85 | public function iShouldSeeTaxonsInTheList($number) |
||
91 | |||
92 | /** |
||
93 | * @Then I should see the taxon named :firstName in the list |
||
94 | * @Then I should see the taxon named :firstName and :secondName in the list |
||
95 | * @Then I should see the taxon named :firstName, :secondName and :thirdName in the list |
||
96 | * @Then I should see the taxon named :firstName, :secondName, :thirdName and :fourthName in the list |
||
97 | */ |
||
98 | public function iShouldSeeTheTaxonNamedAnd(...$expectedTaxonNames) |
||
107 | } |
||
108 |