Completed
Push — master ( 5bd0a6...5cfde8 )
by Kamil
20:21
created

ProductContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A iShouldBeAbleToAccessProduct() 0 6 1
A iShouldNotBeAbleToAccessProduct() 0 6 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
namespace Sylius\Behat\Context\Ui;
13
14
use Behat\Behat\Context\Context;
15
use Sylius\Behat\Page\Product\ProductShowPage;
16
use Sylius\Component\Core\Model\ProductInterface;
17
18
/**
19
 * @author Kamil Kokot <[email protected]>
20
 */
21
final class ProductContext implements Context
22
{
23
    /**
24
     * @var ProductShowPage
25
     */
26
    private $productShowPage;
27
28
    /**
29
     * @param ProductShowPage $productShowPage
30
     */
31
    public function __construct(ProductShowPage $productShowPage)
32
    {
33
        $this->productShowPage = $productShowPage;
34
    }
35
36
    /**
37
     * @Then I should be able to access product :product
38
     */
39
    public function iShouldBeAbleToAccessProduct(ProductInterface $product)
40
    {
41
        $this->productShowPage->tryToOpen(['product' => $product]);
42
43
        expect($this->productShowPage->isOpen(['product' => $product]))->toBe(true);
44
    }
45
46
    /**
47
     * @Then I should not be able to access product :product
48
     */
49
    public function iShouldNotBeAbleToAccessProduct(ProductInterface $product)
50
    {
51
        $this->productShowPage->tryToOpen(['product' => $product]);
52
53
        expect($this->productShowPage->isOpen(['product' => $product]))->toBe(false);
54
    }
55
}
56