|
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\Bundle\ThemeBundle\Model; |
|
13
|
|
|
|
|
14
|
|
|
use PhpSpec\ObjectBehavior; |
|
15
|
|
|
use Sylius\Bundle\ThemeBundle\Model\Theme; |
|
16
|
|
|
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface; |
|
17
|
|
|
use Sylius\Component\Resource\Model\ResourceInterface; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @mixin Theme |
|
21
|
|
|
* |
|
22
|
|
|
* @author Kamil Kokot <[email protected]> |
|
23
|
|
|
*/ |
|
24
|
|
|
class ThemeSpec extends ObjectBehavior |
|
25
|
|
|
{ |
|
26
|
|
|
function it_is_initializable() |
|
27
|
|
|
{ |
|
28
|
|
|
$this->shouldHaveType('Sylius\Bundle\ThemeBundle\Model\Theme'); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
function it_implements_theme_interface() |
|
32
|
|
|
{ |
|
33
|
|
|
$this->shouldImplement(ThemeInterface::class); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
function it_implements_resource_interface() |
|
37
|
|
|
{ |
|
38
|
|
|
$this->shouldImplement(ResourceInterface::class); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
function its_id_is_slug() |
|
42
|
|
|
{ |
|
43
|
|
|
$this->getId()->shouldReturn(null); |
|
44
|
|
|
|
|
45
|
|
|
$this->setSlug('slug'); |
|
46
|
|
|
$this->getId()->shouldReturn('slug'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
function it_has_name() |
|
50
|
|
|
{ |
|
51
|
|
|
$this->getName()->shouldReturn(null); |
|
52
|
|
|
|
|
53
|
|
|
$this->setName("Foo Bar"); |
|
54
|
|
|
$this->getName()->shouldReturn("Foo Bar"); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
function it_has_slug() |
|
58
|
|
|
{ |
|
59
|
|
|
$this->getSlug()->shouldReturn(null); |
|
60
|
|
|
|
|
61
|
|
|
$this->setSlug("foo/bar"); |
|
62
|
|
|
$this->getSlug()->shouldReturn("foo/bar"); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
function it_has_path() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->getPath()->shouldReturn(null); |
|
68
|
|
|
|
|
69
|
|
|
$this->setPath("/foo/bar"); |
|
70
|
|
|
$this->getPath()->shouldReturn("/foo/bar"); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
function it_has_description() |
|
74
|
|
|
{ |
|
75
|
|
|
$this->getDescription()->shouldReturn(null); |
|
76
|
|
|
|
|
77
|
|
|
$this->setDescription("Lorem ipsum."); |
|
78
|
|
|
$this->getDescription()->shouldReturn("Lorem ipsum."); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
function it_has_code_based_on_md5ed_slug() |
|
82
|
|
|
{ |
|
83
|
|
|
$this->setSlug('slug'); |
|
84
|
|
|
|
|
85
|
|
|
$this->getCode()->shouldReturn(substr(md5('slug'), 0, 8)); |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|