Completed
Push — api ( cecea0...116a36 )
by Kamil
29:57 queued 30s
created

NotificationContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A iShouldBeNotifiedThatItHasBeenSuccessfullyCreated() 0 4 1
A iShouldBeNotifiedThatItHasBeenSuccessfullyDeleted() 0 4 1
A iShouldBeNotifiedThatItHasBeenSuccessfullyEdited() 0 4 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\Api\Admin;
15
16
use Behat\Behat\Context\Context;
17
use Sylius\Behat\Client\ApiClientInterface;
18
use Webmozart\Assert\Assert;
19
20
final class NotificationContext implements Context
21
{
22
    /** @var ApiClientInterface */
23
    private $client;
24
25
    public function __construct(ApiClientInterface $client)
26
    {
27
        $this->client = $client;
28
    }
29
30
    /**
31
     * @Then I should be notified that it has been successfully created
32
     */
33
    public function iShouldBeNotifiedThatItHasBeenSuccessfullyCreated(): void
34
    {
35
        Assert::true($this->client->isCreationSuccessful(), 'Resource could not be created');
36
    }
37
38
    /**
39
     * @Then I should be notified that it has been successfully deleted
40
     */
41
    public function iShouldBeNotifiedThatItHasBeenSuccessfullyDeleted(): void
42
    {
43
        Assert::true($this->client->isDeletionSuccessful(), 'Resource could not be deleted');
44
    }
45
46
    /**
47
     * @Then I should be notified that it has been successfully edited
48
     */
49
    public function iShouldBeNotifiedThatItHasBeenSuccessfullyEdited(): void
50
    {
51
        Assert::true($this->client->isUpdateSuccessful(), 'Resource could not be edited');
52
    }
53
}
54