Completed
Push — master ( bbd2b1...f08c3b )
by Kamil
31:47 queued 09:37
created

ManagingChannelsBillingDataContext   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 66
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A specifyCompanyAs() 0 4 1
A specifyTaxIdAs() 0 4 1
A specifyShopBillingAddressAs() 0 8 1
A thisChannelCompanyShouldBe() 0 4 1
A thisChanneTaxIdShouldBe() 0 4 1
A thisChannelShopBillingAddressShouldBe() 0 8 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\Element\Admin\Channel\ShopBillingDataElementInterface;
18
use Sylius\Component\Addressing\Model\CountryInterface;
19
use Webmozart\Assert\Assert;
20
21
final class ManagingChannelsBillingDataContext implements Context
22
{
23
    /** @var ShopBillingDataElementInterface */
24
    private $shopBillingDataElement;
25
26
    public function __construct(ShopBillingDataElementInterface $shopBillingDataElement)
27
    {
28
        $this->shopBillingDataElement = $shopBillingDataElement;
29
    }
30
31
    /**
32
     * @When I specify company as :company
33
     */
34
    public function specifyCompanyAs(string $company): void
35
    {
36
        $this->shopBillingDataElement->specifyCompany($company);
37
    }
38
39
    /**
40
     * @When I specify tax ID as :taxId
41
     */
42
    public function specifyTaxIdAs(string $taxId): void
43
    {
44
        $this->shopBillingDataElement->specifyTaxId($taxId);
45
    }
46
47
    /**
48
     * @When I specify shop billing address as :street, :postcode :city, :country
49
     */
50
    public function specifyShopBillingAddressAs(
51
        string $street,
52
        string $postcode,
53
        string $city,
54
        CountryInterface $country
55
    ): void {
56
        $this->shopBillingDataElement->specifyBillingAddress($street, $postcode, $city, $country->getCode());
57
    }
58
59
    /**
60
     * @Then this channel company should be :company
61
     */
62
    public function thisChannelCompanyShouldBe(string $company): void
63
    {
64
        Assert::true($this->shopBillingDataElement->hasCompany($company));
65
    }
66
67
    /**
68
     * @Then this channel tax ID should be :taxId
69
     */
70
    public function thisChanneTaxIdShouldBe(string $taxId): void
71
    {
72
        Assert::true($this->shopBillingDataElement->hasTaxId($taxId));
73
    }
74
75
    /**
76
     * @Then this channel shop billing address should be :street, :postcode :city, :country
77
     */
78
    public function thisChannelShopBillingAddressShouldBe(
79
        string $street,
80
        string $postcode,
81
        string $city,
82
        CountryInterface $country
83
    ): void {
84
        Assert::true($this->shopBillingDataElement->hasBillingAddress($street, $postcode, $city, $country->getCode()));
85
    }
86
}
87