Skip to content

Commit

Permalink
Merge pull request #64 from ahmadreza1383/tests
Browse files Browse the repository at this point in the history
Add a test to verify that child processes are isolated
  • Loading branch information
freekmurze authored Dec 9, 2024
2 parents b6f180a + eb9a66e commit 5bda3be
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 5bda3be

Please sign in to comment.