Passed
Push — master ( 4b2c1a...a53d55 )
by Maximilian
02:53
created

TemplateTest::testSerializeAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 23
rs 9.6333
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Test\Response\Directives\Display;
6
7
use ArrayObject;
8
use MaxBeckers\AmazonAlexa\Response\Directives\Display\Image;
9
use MaxBeckers\AmazonAlexa\Response\Directives\Display\ListItem;
10
use MaxBeckers\AmazonAlexa\Response\Directives\Display\Template;
11
use MaxBeckers\AmazonAlexa\Response\Directives\Display\TextContent;
12
use PHPUnit\Framework\TestCase;
13
14
class TemplateTest extends TestCase
15
{
16
    public function testSerializeTypeAndToken(): void
17
    {
18
        $type = 'BodyTemplate1';
19
        $token = 'token';
20
21
        $template = Template::create($type, $token);
22
23
        $this->assertEquals(new ArrayObject([
24
            'type' => $type,
25
            'token' => $token,
26
            'backButton' => Template::BACK_BUTTON_MODE_VISIBLE,
27
        ]), $template->jsonSerialize());
28
    }
29
30
    public function testSerializeAll(): void
31
    {
32
        $type = 'BodyTemplate1';
33
        $token = 'token';
34
        $backButton = Template::BACK_BUTTON_MODE_VISIBLE;
35
        $backgroundImage = Image::create();
36
        $title = 'title';
37
        $textContent = TextContent::create();
38
        $image = Image::create();
39
        $listItems = [ListItem::create()];
40
41
        $template = Template::create($type, $token, $backButton, $backgroundImage, $title, $textContent, $image, $listItems);
42
43
        $this->assertEquals(new ArrayObject([
44
            'type' => $type,
45
            'token' => $token,
46
            'backButton' => $backButton,
47
            'backgroundImage' => $backgroundImage,
48
            'title' => $title,
49
            'textContent' => $textContent,
50
            'image' => $image,
51
            'listItems' => $listItems,
52
        ]), $template->jsonSerialize());
53
    }
54
}
55