Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 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'));
 }