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

VariantResolverHelperSpec::it_is_helper()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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