|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | use Clue\React\Ami\Protocol\Action; |
| 4 | + |
4 | 5 | class ActionTest extends TestCase |
5 | 6 | { |
| 7 | + public function testIdDefaultsToNull() |
| 8 | + { |
| 9 | + $action = new Action('name'); |
| 10 | + |
| 11 | + $this->assertNull($action->getActionId()); |
| 12 | + } |
| 13 | + |
| 14 | + public function testIdCanBeSet() |
| 15 | + { |
| 16 | + $action = new Action('name', array('ActionID' => '123')); |
| 17 | + |
| 18 | + $this->assertEquals('123', $action->getActionId()); |
| 19 | + } |
| 20 | + |
6 | 21 | public function testSerializeSimple() |
7 | 22 | { |
8 | 23 | $action = new Action('name'); |
9 | | - $id = $action->getActionId(); |
10 | 24 |
|
11 | | - $this->assertEquals("Action: name\r\nActionID: $id\r\n\r\n", $action->getMessageSerialized()); |
| 25 | + $this->assertEquals("Action: name\r\n\r\n", $action->getMessageSerialized()); |
12 | 26 | } |
13 | 27 |
|
14 | 28 | public function testSerializeKeySingle() |
15 | 29 | { |
16 | 30 | $action = new Action('name', array('Key' => 'Value')); |
17 | | - $id = $action->getActionId(); |
18 | 31 |
|
19 | | - $this->assertEquals("Action: name\r\nKey: Value\r\nActionID: $id\r\n\r\n", $action->getMessageSerialized()); |
| 32 | + $this->assertEquals("Action: name\r\nKey: Value\r\n\r\n", $action->getMessageSerialized()); |
20 | 33 | } |
21 | 34 |
|
22 | 35 | public function testSerializeKeyMultipleValues() |
23 | 36 | { |
24 | 37 | $action = new Action('name', array('Key' => array('Value1', 'Value2'))); |
25 | | - $id = $action->getActionId(); |
26 | 38 |
|
27 | | - $this->assertEquals("Action: name\r\nKey: Value1\r\nKey: Value2\r\nActionID: $id\r\n\r\n", $action->getMessageSerialized()); |
| 39 | + $this->assertEquals("Action: name\r\nKey: Value1\r\nKey: Value2\r\n\r\n", $action->getMessageSerialized()); |
28 | 40 | } |
29 | 41 |
|
30 | 42 | public function testSerializeKeyMultipleKeyValues() |
31 | 43 | { |
32 | 44 | $action = new Action('name', array('Variables' => array('first' => 'on', 'second' => 'off'))); |
33 | | - $id = $action->getActionId(); |
34 | 45 |
|
35 | | - $this->assertEquals("Action: name\r\nVariables: first=on\r\nVariables: second=off\r\nActionID: $id\r\n\r\n", $action->getMessageSerialized()); |
| 46 | + $this->assertEquals("Action: name\r\nVariables: first=on\r\nVariables: second=off\r\n\r\n", $action->getMessageSerialized()); |
36 | 47 | } |
37 | 48 | } |
0 commit comments