コード例 #1
0
ファイル: Client.php プロジェクト: clue/ami-react
 public function request(Action $message)
 {
     $deferred = new Deferred();
     if ($this->ending) {
         $deferred->reject(new Exception('Already ending'));
     } else {
         $out = $message->getMessageSerialized();
         //var_dump('out', $out);
         $this->stream->write($out);
         $this->pending[$message->getActionId()] = $deferred;
     }
     return $deferred->promise();
 }
コード例 #2
0
ファイル: ActionTest.php プロジェクト: clue/ami-react
 public function testOneFieldMultipleKeyValues()
 {
     $action = new Action(array('Variables' => array('first' => 'on', 'second' => 'off')));
     $this->assertEquals("Variables: first=on\r\nVariables: second=off\r\n\r\n", $action->getMessageSerialized());
     $this->assertEquals('first=on', $action->getFieldValue('Variables'));
     $this->assertEquals(array('first=on', 'second=off'), $action->getFieldValues('Variables'));
     $this->assertEquals(array('first' => 'on', 'second' => 'off'), $action->getFieldVariables('Variables'));
     $this->assertEquals(array(), $action->getFieldVariables('unknown'));
 }