Completed
Push — master ( 10a049...816620 )
by Kamil
105:30 queued 82:52
created

VariantResolverHelperSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_helper() 0 4 1
A it_returns_null_if_product_has_no_variants() 0 9 1
A it_has_name() 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 spec\Sylius\Bundle\CoreBundle\Templating\Helper;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Component\Core\Model\ProductInterface;
18
use Sylius\Component\Product\Resolver\ProductVariantResolverInterface;
19
use Symfony\Component\Templating\Helper\Helper;
20
21
final class VariantResolverHelperSpec extends ObjectBehavior
22
{
23
    function let(ProductVariantResolverInterface $productVariantResolver): void
24
    {
25
        $this->beConstructedWith($productVariantResolver);
26
    }
27
28
    function it_is_helper(): void
29
    {
30
        $this->shouldHaveType(Helper::class);
31
    }
32
33
    function it_returns_null_if_product_has_no_variants(
34
        ProductVariantResolverInterface $productVariantResolver,
35
        ProductInterface $product
36
    )
37
    {
38
        $productVariantResolver->getVariant($product)->willReturn(null);
39
40
        $this->resolveVariant($product)->shouldBeEqualTo(null);
41
    }
42
43
    function it_has_name(): void
44
    {
45
        $this->getName()->shouldReturn('sylius_resolve_variant');
46
    }
47
}
48