Completed
Push — master ( 55daec...2d65d3 )
by Kamil
18:26
created

ActivePromotionsProviderSpec::let()   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 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 spec\Sylius\Component\Promotion\Provider;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Promotion\Model\PromotionInterface;
16
use Sylius\Component\Promotion\Model\PromotionSubjectInterface;
17
use Sylius\Component\Promotion\Provider\PreQualifiedPromotionsProviderInterface;
18
use Sylius\Component\Promotion\Repository\PromotionRepositoryInterface;
19
20
/**
21
 * @author Mateusz Zalewski <[email protected]>
22
 */
23
class ActivePromotionsProviderSpec extends ObjectBehavior
24
{
25
    function let(PromotionRepositoryInterface $promotionRepository)
26
    {
27
        $this->beConstructedWith($promotionRepository);
28
    }
29
30
    function it_is_initializable()
31
    {
32
        $this->shouldHaveType('Sylius\Component\Promotion\Provider\ActivePromotionsProvider');
33
    }
34
35
    function it_implements_active_promotions_provider_interface()
36
    {
37
        $this->shouldImplement(PreQualifiedPromotionsProviderInterface::class);
38
    }
39
40
    function it_provides_active_promotions(
41
        $promotionRepository,
42
        PromotionInterface $promotion1,
43
        PromotionInterface $promotion2,
44
        PromotionSubjectInterface $subject
45
    ) {
46
        $promotionRepository->findActive()->willReturn([$promotion1, $promotion2]);
47
48
        $this->getPromotions($subject)->shouldReturn([$promotion1, $promotion2]);
49
    }
50
}
51