Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/__tests__/ExecFutureTestCase.php
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | public function testResolveTimeoutTestShouldRunLessThan1Sec() { | ||||
// We expect this to now force the time out / kill immediately. If we don't | // We expect this to now force the time out / kill immediately. If we don't | ||||
// do this, we'll hang when exiting until our subprocess exits (32000 | // do this, we'll hang when exiting until our subprocess exits (32000 | ||||
// seconds!) | // seconds!) | ||||
$future->setTimeout(0.01); | $future->setTimeout(0.01); | ||||
$future->resolve(); | $future->resolve(); | ||||
} | } | ||||
public function testTerminateWithoutStart() { | |||||
// We never start this future, but it should be fine to kill a future from | |||||
// any state. | |||||
$future = new ExecFuture('sleep 1'); | |||||
$future->resolveKill(); | |||||
$this->assertTrue(true); | |||||
} | |||||
public function testTimeoutTestShouldRunLessThan1Sec() { | public function testTimeoutTestShouldRunLessThan1Sec() { | ||||
// NOTE: This is partly testing that we choose appropriate select wait | // NOTE: This is partly testing that we choose appropriate select wait | ||||
// times; this test should run for significantly less than 1 second. | // times; this test should run for significantly less than 1 second. | ||||
$future = new ExecFuture('sleep 32000'); | $future = new ExecFuture('sleep 32000'); | ||||
list($err) = $future->setTimeout(0.01)->resolve(); | list($err) = $future->setTimeout(0.01)->resolve(); | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |