Completed
Push — 1.3 ( ea96f1...08f6de )
by Kamil
13:44
created

RemovingTaxonContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 4
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A iRemoveTaxonNamed() 0 5 1
A iShouldBeNotifiedThatPromotionHasBeenUpdated() 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
declare(strict_types=1);
13
14
namespace Sylius\Behat\Context\Ui\Admin;
15
16
use Behat\Behat\Context\Context;
17
use Sylius\Behat\NotificationType;
18
use Sylius\Behat\Page\Admin\Taxon\CreatePageInterface;
19
use Sylius\Behat\Service\NotificationCheckerInterface;
20
use Sylius\Component\Core\Model\PromotionInterface;
21
22
final class RemovingTaxonContext implements Context
23
{
24
    /** @var CreatePageInterface */
25
    private $createPage;
26
27
    /** @var NotificationCheckerInterface */
28
    private $notificationChecker;
29
30
    public function __construct(CreatePageInterface $createPage, NotificationCheckerInterface $notificationChecker)
31
    {
32
        $this->createPage = $createPage;
33
        $this->notificationChecker = $notificationChecker;
34
    }
35
36
    /**
37
     * @When I remove taxon named :name
38
     * @When I delete taxon named :name
39
     */
40
    public function iRemoveTaxonNamed(string $name): void
41
    {
42
        $this->createPage->open();
43
        $this->createPage->deleteTaxonOnPageByName($name);
44
    }
45
46
    /**
47
     * @Then I should be notified that :promotion promotion has been updated
48
     */
49
    public function iShouldBeNotifiedThatPromotionHasBeenUpdated(PromotionInterface $promotion): void
50
    {
51
        $this->notificationChecker->checkNotification(
52
            sprintf('Some rules of the promotions with codes %s have been updated.', $promotion->getCode()),
53
            NotificationType::info()
54
        );
55
    }
56
}
57