Passed
Push — master ( a53d55...43aca1 )
by Maximilian
03:50
created

ReinflateCommandTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 24
dl 0
loc 59
rs 10
c 1
b 0
f 1
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructorWithPreservedSequencers() 0 7 1
A testJsonSerializeWithPreservedSequencers() 0 9 1
A testConstructorWithDefaultParameters() 0 5 1
A testJsonSerializeWithSingleSequencer() 0 7 1
A testJsonSerializeWithNullValue() 0 7 1
A testJsonSerializeWithEmptyArray() 0 7 1
A testTypeConstant() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Test\Response\Directives\APL\StandardCommand;
6
7
use MaxBeckers\AmazonAlexa\Response\Directives\APL\StandardCommand\ReinflateCommand;
8
use PHPUnit\Framework\TestCase;
9
10
class ReinflateCommandTest extends TestCase
11
{
12
    public function testConstructorWithPreservedSequencers(): void
13
    {
14
        $preservedSequencers = ['sequencer1', 'sequencer2', 'sequencer3'];
15
16
        $command = new ReinflateCommand($preservedSequencers);
17
18
        $this->assertSame($preservedSequencers, $command->preservedSequencers);
19
    }
20
21
    public function testConstructorWithDefaultParameters(): void
22
    {
23
        $command = new ReinflateCommand();
24
25
        $this->assertNull($command->preservedSequencers);
26
    }
27
28
    public function testJsonSerializeWithPreservedSequencers(): void
29
    {
30
        $preservedSequencers = ['seq1', 'seq2'];
31
32
        $command = new ReinflateCommand($preservedSequencers);
33
        $result = $command->jsonSerialize();
34
35
        $this->assertSame(ReinflateCommand::TYPE, $result['type']);
36
        $this->assertSame($preservedSequencers, $result['preservedSequencers']);
37
    }
38
39
    public function testJsonSerializeWithEmptyArray(): void
40
    {
41
        $command = new ReinflateCommand([]);
42
        $result = $command->jsonSerialize();
43
44
        $this->assertSame(ReinflateCommand::TYPE, $result['type']);
45
        $this->assertArrayNotHasKey('preservedSequencers', $result);
46
    }
47
48
    public function testJsonSerializeWithNullValue(): void
49
    {
50
        $command = new ReinflateCommand();
51
        $result = $command->jsonSerialize();
52
53
        $this->assertSame(ReinflateCommand::TYPE, $result['type']);
54
        $this->assertArrayNotHasKey('preservedSequencers', $result);
55
    }
56
57
    public function testJsonSerializeWithSingleSequencer(): void
58
    {
59
        $command = new ReinflateCommand(['onlySequencer']);
60
        $result = $command->jsonSerialize();
61
62
        $this->assertSame(ReinflateCommand::TYPE, $result['type']);
63
        $this->assertSame(['onlySequencer'], $result['preservedSequencers']);
64
    }
65
66
    public function testTypeConstant(): void
67
    {
68
        $this->assertSame('Reinflate', ReinflateCommand::TYPE);
69
    }
70
}
71