|
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\Core\Model; |
|
13
|
|
|
|
|
14
|
|
|
use PhpSpec\ObjectBehavior; |
|
15
|
|
|
use Sylius\Component\Core\Model\Image; |
|
16
|
|
|
use Sylius\Component\Core\Model\ImageAwareInterface; |
|
17
|
|
|
use Sylius\Component\Core\Model\TaxonImage; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @author Grzegorz Sadowski <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
final class TaxonImageSpec extends ObjectBehavior |
|
23
|
|
|
{ |
|
24
|
|
|
function it_is_initializable() |
|
25
|
|
|
{ |
|
26
|
|
|
$this->shouldHaveType(TaxonImage::class); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
function it_extends_an_image() |
|
30
|
|
|
{ |
|
31
|
|
|
$this->shouldHaveType(Image::class); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
function it_does_not_have_id_by_default() |
|
35
|
|
|
{ |
|
36
|
|
|
$this->getId()->shouldReturn(null); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
function it_does_not_have_file_by_default() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->hasFile()->shouldReturn(false); |
|
42
|
|
|
$this->getFile()->shouldReturn(null); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function its_file_is_mutable() |
|
46
|
|
|
{ |
|
47
|
|
|
$file = new \SplFileInfo(__FILE__); |
|
48
|
|
|
$this->setFile($file); |
|
49
|
|
|
$this->getFile()->shouldReturn($file); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
function its_path_is_mutable() |
|
53
|
|
|
{ |
|
54
|
|
|
$this->setPath(__FILE__); |
|
55
|
|
|
$this->getPath()->shouldReturn(__FILE__); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
function it_does_not_have_type_by_default() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->getType()->shouldReturn(null); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
function its_type_is_mutable() |
|
64
|
|
|
{ |
|
65
|
|
|
$this->setType('banner'); |
|
66
|
|
|
$this->getType()->shouldReturn('banner'); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
function it_does_not_have_owner_by_default() |
|
70
|
|
|
{ |
|
71
|
|
|
$this->getOwner()->shouldReturn(null); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
function its_owner_is_mutable(ImageAwareInterface $owner) |
|
75
|
|
|
{ |
|
76
|
|
|
$this->setOwner($owner); |
|
77
|
|
|
$this->getOwner()->shouldReturn($owner); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|