Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isIdleTimeout example
public
function
testIdleTimeout
(
)
{
$process
=
$this
->
getProcessForCode
(
'sleep(34);'
)
;
$process
->
setTimeout
(
60
)
;
$process
->
setIdleTimeout
(
0.1
)
;
try
{
$process
->
run
(
)
;
$this
->
fail
(
'A timeout exception was expected.'
)
;
}
catch
(
ProcessTimedOutException
$e
)
{
$this
->
assertTrue
(
$e
->
isIdleTimeout
(
)
)
;
$this
->
assertFalse
(
$e
->
isGeneralTimeout
(
)
)
;
$this
->
assertEquals
(
0.1,
$e
->
getExceededTimeout
(
)
)
;
}
}
public
function
testIdleTimeoutNotExceededWhenOutputIsSent
(
)
{
$process
=
$this
->
getProcessForCode
(
'while (true) {echo \'foo \'; usleep(1000);}'
)
;
$process
->
setTimeout
(
1
)
;
$process
->
start
(
)
;