Completed
Push — master ( a9aa0c...602f1d )
by Kamil
26:22 queued 09:35
created

__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\Page\Admin\Product\UpdateSimpleProductPageInterface;
18
use Sylius\Behat\Page\Admin\ProductVariant\UpdatePageInterface;
19
use Sylius\Component\Core\Model\ProductInterface;
20
use Sylius\Component\Core\Model\ProductVariantInterface;
21
use Webmozart\Assert\Assert;
22
23
final class AccessingEditPageFromProductShowPageContext implements Context
24
{
25
    /** @var UpdateSimpleProductPageInterface */
26
    private $updateSimpleProductPage;
27
28
    /** @var UpdatePageInterface */
29
    private $updateVariantProductPage;
30
31
    public function __construct(
32
        UpdateSimpleProductPageInterface $updateSimpleProductPage,
33
        UpdatePageInterface $updateVariantProductPage
34
    ) {
35
        $this->updateSimpleProductPage = $updateSimpleProductPage;
36
        $this->updateVariantProductPage = $updateVariantProductPage;
37
    }
38
39
    /**
40
     * @Then I should be on :product product edit page
41
     */
42
    public function iShouldBeOnProductEditPage(ProductInterface $product): void
43
    {
44
        Assert::true($this->updateSimpleProductPage->isOpen(['id' => $product->getId()]));
45
    }
46
47
    /**
48
     * @Then I should be on :variant variant edit page
49
     */
50
    public function iShouldBeOnVariantEditPage(ProductVariantInterface $variant): void
51
    {
52
        Assert::true($this->updateVariantProductPage->isOpen(['productId' => $variant->getProduct()->getId(), 'id' => $variant->getId()]));
53
    }
54
}
55