Changeset View
Changeset View
Standalone View
Standalone View
src/phage/__tests__/PhageAgentTestCase.php
Show All 14 Lines | private function runBootloaderTests(PhageAgentBootloader $boot) { | ||||
$exec_channel = new PhutilExecChannel($exec); | $exec_channel = new PhutilExecChannel($exec); | ||||
$agent = new PhutilJSONProtocolChannel($exec_channel); | $agent = new PhutilJSONProtocolChannel($exec_channel); | ||||
$agent->write( | $agent->write( | ||||
array( | array( | ||||
'type' => 'EXEC', | 'type' => 'EXEC', | ||||
'key' => 1, | 'key' => 1, | ||||
'command' => 'echo phage', | 'command' => 'echo phage', | ||||
'timeout' => null, | |||||
)); | )); | ||||
$this->agentExpect( | $this->agentExpect( | ||||
$agent, | $agent, | ||||
array( | array( | ||||
'type' => 'RSLV', | 'type' => 'RSLV', | ||||
'key' => 1, | 'key' => 1, | ||||
'err' => 0, | 'err' => 0, | ||||
'stdout' => "phage\n", | 'stdout' => "phage\n", | ||||
'stderr' => '', | 'stderr' => '', | ||||
'timeout' => false, | |||||
), | ), | ||||
pht("'%s' for %s", 'echo phage', $name)); | pht("'%s' for %s", 'echo phage', $name)); | ||||
$agent->write( | $agent->write( | ||||
array( | array( | ||||
'type' => 'EXIT', | 'type' => 'EXIT', | ||||
)); | )); | ||||
} | } | ||||
private function agentExpect(PhutilChannel $agent, $expect, $what) { | private function agentExpect(PhutilChannel $agent, $expect, $what) { | ||||
$message = $agent->waitForMessage(); | $message = $agent->waitForMessage(); | ||||
$this->assertEqual($expect, $message, $what); | $this->assertEqual($expect, $message, $what); | ||||
} | } | ||||
} | } |