|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace spec\Yproximite\Api\Model\Media; |
|
4
|
|
|
|
|
5
|
|
|
use PhpSpec\ObjectBehavior; |
|
6
|
|
|
|
|
7
|
|
|
use Yproximite\Api\Model\Media\Media; |
|
8
|
|
|
|
|
9
|
|
|
class MediaSpec extends ObjectBehavior |
|
10
|
|
|
{ |
|
11
|
|
|
function it_is_initializable() |
|
12
|
|
|
{ |
|
13
|
|
|
$this->shouldHaveType(Media::class); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
function let() |
|
17
|
|
|
{ |
|
18
|
|
|
$data = [ |
|
19
|
|
|
'id' => '5', |
|
20
|
|
|
'filename' => 'apple-box', |
|
21
|
|
|
'originalFilename' => 'Apple Box', |
|
22
|
|
|
'originalFilenameSlugged' => 'App..Box.jpeg', |
|
23
|
|
|
'description' => 'The biggest image', |
|
24
|
|
|
'title' => 'Apple Box Title', |
|
25
|
|
|
'visible' => 1, |
|
26
|
|
|
'created_at' => '2011-05-19 20:46:21.000000', |
|
27
|
|
|
'updated_at' => '2016-01-11 00:00:00.000000', |
|
28
|
|
|
'mime' => 'image/jpeg', |
|
29
|
|
|
'type' => 'image', |
|
30
|
|
|
'size' => 11345, |
|
31
|
|
|
'extension' => 'jpg', |
|
32
|
|
|
'category_ids' => [1, 2, 3], |
|
33
|
|
|
'link_url' => 'http://site.com/media/original/apple-box.jpg', |
|
34
|
|
|
]; |
|
35
|
|
|
|
|
36
|
|
|
$this->beConstructedWith($data); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
function it_should_be_hydrated() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->getId()->shouldReturn(5); |
|
42
|
|
|
$this->getFilename()->shouldReturn('apple-box'); |
|
43
|
|
|
$this->getOriginalFilename()->shouldReturn('Apple Box'); |
|
44
|
|
|
$this->getOriginalFilenameSlugged()->shouldReturn('App..Box.jpeg'); |
|
45
|
|
|
$this->getDescription()->shouldReturn('The biggest image'); |
|
46
|
|
|
$this->getTitle()->shouldReturn('Apple Box Title'); |
|
47
|
|
|
$this->isVisible()->shouldReturn(true); |
|
48
|
|
|
$this->getCreatedAt()->shouldBeLike(new \DateTime('2011-05-19 20:46:21')); |
|
49
|
|
|
$this->getUpdatedAt()->shouldBeLike(new \DateTime('2016-01-11 00:00:00')); |
|
50
|
|
|
$this->getMime()->shouldReturn('image/jpeg'); |
|
51
|
|
|
$this->getType()->shouldReturn('image'); |
|
52
|
|
|
$this->getSize()->shouldReturn(11345); |
|
53
|
|
|
$this->getExtension()->shouldReturn('jpg'); |
|
54
|
|
|
$this->getCategoryIds()->shouldReturn([1, 2, 3]); |
|
55
|
|
|
$this->getLinkUrl()->shouldReturn('http://site.com/media/original/apple-box.jpg'); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|