@@ -50,6 +50,38 @@ public function testParsingCommandResponse()
5050 $ this ->assertEquals ("Testing: yes \nAnother Line \n--END COMMAND-- " , $ first ->getPart ('_ ' ));
5151 }
5252
53+ public function testParsingCommandResponseEmpty ()
54+ {
55+ $ parser = new Parser ();
56+ $ this ->assertEquals (array (), $ parser ->push ("Asterisk Call Manager/1.3 \r\n" ));
57+
58+ $ ret = $ parser ->push ("Response: Follows \r\n--END COMMAND-- \r\n\r\n" );
59+ $ this ->assertCount (1 , $ ret );
60+
61+ $ first = reset ($ ret );
62+ /* @var $first Clue\React\Ami\Protocol\Response */
63+
64+ $ this ->assertInstanceOf ('Clue\React\Ami\Protocol\Response ' , $ first );
65+ $ this ->assertEquals ('Follows ' , $ first ->getPart ('Response ' ));
66+ $ this ->assertEquals ("--END COMMAND-- " , $ first ->getPart ('_ ' ));
67+ }
68+
69+ public function testParsingResponseIsNotCommandResponse ()
70+ {
71+ $ parser = new Parser ();
72+ $ this ->assertEquals (array (), $ parser ->push ("Asterisk Call Manager/1.3 \r\n" ));
73+
74+ $ ret = $ parser ->push ("Response: Success \r\nMessage: Some message--END COMMAND-- \r\n\r\n" );
75+ $ this ->assertCount (1 , $ ret );
76+
77+ $ first = reset ($ ret );
78+ /* @var $first Clue\React\Ami\Protocol\Response */
79+
80+ $ this ->assertInstanceOf ('Clue\React\Ami\Protocol\Response ' , $ first );
81+ $ this ->assertEquals ('Success ' , $ first ->getPart ('Response ' ));
82+ $ this ->assertEquals ('Some message--END COMMAND-- ' , $ first ->getPart ('Message ' ));
83+ }
84+
5385 /**
5486 * @expectedException UnexpectedValueException
5587 */
0 commit comments