Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103718566
PhageAgentTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Mar 4, 06:45
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Mar 6, 06:45 (2 d)
Engine
blob
Format
Raw Data
Handle
24647182
Attached To
rPHU libphutil
PhageAgentTestCase.php
View Options
<?php
final
class
PhageAgentTestCase
extends
PhutilTestCase
{
public
function
testPhagePHPAgent
()
{
return
$this
->
runBootloaderTests
(
new
PhagePHPAgentBootloader
());
}
private
function
runBootloaderTests
(
PhageAgentBootloader
$boot
)
{
$name
=
get_class
(
$boot
);
$exec
=
new
ExecFuture
(
'%C'
,
$boot
->
getBootCommand
());
$exec
->
write
(
$boot
->
getBootSequence
(),
$keep_open
=
true
);
$exec_channel
=
new
PhutilExecChannel
(
$exec
);
$agent
=
new
PhutilJSONProtocolChannel
(
$exec_channel
);
$agent
->
write
(
array
(
'type'
=>
'EXEC'
,
'key'
=>
1
,
'command'
=>
'echo phage'
,
));
$this
->
agentExpect
(
$agent
,
array
(
'type'
=>
'RSLV'
,
'key'
=>
1
,
'err'
=>
0
,
'stdout'
=>
"phage
\n
"
,
'stderr'
=>
''
,
),
"'echo phage' for {$name}"
);
$agent
->
write
(
array
(
'type'
=>
'EXIT'
,
));
}
private
function
agentExpect
(
PhutilChannel
$agent
,
$expect
,
$what
)
{
$message
=
$agent
->
waitForMessage
();
$this
->
assertEqual
(
$expect
,
$message
,
$what
);
}
}
Event Timeline
Log In to Comment