-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathContentInfoTaggerSpec.php
More file actions
62 lines (48 loc) · 1.65 KB
/
ContentInfoTaggerSpec.php
File metadata and controls
62 lines (48 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace spec\Ibexa\HttpCache\ResponseTagger\Value;
use FOS\HttpCache\ResponseTagger;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
use Ibexa\HttpCache\ResponseTagger\Value\ContentInfoTagger;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class ContentInfoTaggerSpec extends ObjectBehavior
{
public function let(ResponseTagger $tagHandler): void
{
$this->beConstructedWith($tagHandler);
$tagHandler->addTags(Argument::any())->willReturn($tagHandler);
}
public function it_is_initializable(): void
{
$this->shouldHaveType(ContentInfoTagger::class);
}
public function it_ignores_non_content_info(ResponseTagger $tagHandler): void
{
$this->tag(null);
$tagHandler->addTags()->shouldNotHaveBeenCalled();
}
public function it_tags_with_content_and_content_type_id(ResponseTagger $tagHandler): void
{
$value = new ContentInfo([
'id' => 123,
'mainLocationId' => 456,
'contentTypeId' => 987,
]);
$this->tag($value);
$tagHandler->addTags(['c123', 'ct987'])->shouldHaveBeenCalled();
}
public function it_tags_with_location_id_if_one_is_set(ResponseTagger $tagHandler): void
{
$value = new ContentInfo([
'id' => 123,
'mainLocationId' => 456,
'contentTypeId' => 987,
]);
$this->tag($value);
$tagHandler->addTags(['l456'])->shouldHaveBeenCalled();
}
}