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

ActivePromotionsProviderSpec   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_implements_active_promotions_provider_interface() 0 4 1
A it_provides_active_promotions() 0 10 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