Skip to content

Commit

Permalink
Add a test to verify that child processes are isolated
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadreza1383 committed Nov 25, 2024
1 parent b6f180a commit eb9a66e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/ForkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,30 @@ function () {
expect($value)->toEqual(2);
});

test('events of child processes are isolated from each other', function () {
$value = 2;
Fork::new()
->before(function () use(&$value) {
$value++;
global $x;
$x=1;
})
->after(function () use(&$value) {
$value++;
global $x;
expect($x)->toEqual(2);
})
->run(function () {
global $x;
$x++;
}, function () {
global $x;
$x++;
});

expect($value)->toEqual(2);
});

it('will not hang by truncating the result when large output is returned')
->expect(
Fork::new()->run(
Expand Down

0 comments on commit eb9a66e

Please sign in to comment.