5 class backendUnitCase extends UnitUnishTestCase {
8 * Covers the following target responsibilities.
9 * - Insures that drush_invoke_process() called with fork backend set is able
10 * to invoke a non-blocking process.
12 function testBackendFork() {
13 if (self::is_windows()) {
14 $this->markTestSkipped('Fork tests not a priority on Windows.');
17 // Ensure that file that will be created by forked process does not exist
19 $test_file = UNISH_SANDBOX . '/fork_test.txt';
20 if (file_exists($test_file)) {
24 // Sleep for a millisecond, then create the file
25 $ev_php = "usleep(1000);fopen('$test_file','a');";
26 drush_invoke_process("@none", "ev", array($ev_php), array(), array("fork" => TRUE));
28 // Test file does not exist immediate after process forked
29 $this->assertEquals(file_exists($test_file), FALSE);
30 // Check every 100th of a second for up to 4 seconds to see if the file appeared
32 while (!file_exists($test_file) && ($repetitions > 0)) {
35 // Assert that the file did finally appear
36 $this->assertEquals(file_exists($test_file), TRUE);