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\Component\Promotion\Model; |
15
|
|
|
|
16
|
|
|
use PhpSpec\ObjectBehavior; |
17
|
|
|
use Sylius\Component\Promotion\Model\PromotionInterface; |
18
|
|
|
use Sylius\Component\Promotion\Model\PromotionRuleInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Saša Stamenković <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
final class PromotionRuleSpec extends ObjectBehavior |
24
|
|
|
{ |
25
|
|
|
function it_is_a_promotion_rule(): void |
26
|
|
|
{ |
27
|
|
|
$this->shouldImplement(PromotionRuleInterface::class); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
function it_does_not_have_id_by_default(): void |
31
|
|
|
{ |
32
|
|
|
$this->getId()->shouldReturn(null); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
function it_does_not_have_type_by_default(): void |
36
|
|
|
{ |
37
|
|
|
$this->getType()->shouldReturn(null); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
function its_type_is_mutable(): void |
41
|
|
|
{ |
42
|
|
|
$this->setType('type'); |
43
|
|
|
$this->getType()->shouldReturn('type'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
function it_initializes_array_for_configuration_by_default(): void |
47
|
|
|
{ |
48
|
|
|
$this->getConfiguration()->shouldReturn([]); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
function its_configuration_is_mutable(): void |
52
|
|
|
{ |
53
|
|
|
$this->setConfiguration(['value' => 500]); |
54
|
|
|
$this->getConfiguration()->shouldReturn(['value' => 500]); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
function it_does_not_have_a_promotion_by_default(): void |
58
|
|
|
{ |
59
|
|
|
$this->getPromotion()->shouldReturn(null); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
function its_promotion_by_is_mutable(PromotionInterface $promotion): void |
63
|
|
|
{ |
64
|
|
|
$this->setPromotion($promotion); |
65
|
|
|
$this->getPromotion()->shouldReturn($promotion); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|