|
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
|
|
|
|