Skip to content

Commit

Permalink
some recursion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krakjoe committed May 19, 2024
1 parent e06dd43 commit 45626d0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/base/068.phpt
Original file line number Diff line number Diff line change
@@ -0,0 1,23 @@
--TEST--
parallel recursion in arrays
--SKIPIF--
<?php
if (!extension_loaded('parallel')) {
die("skip parallel not loaded");
}
?>
--FILE--
<?php
$array = [];
$array["self"] = &$array;

\parallel\run(function($array){
var_dump($array);
}, [$array]);
?>
--EXPECT--
array(1) {
["self"]=>
*RECURSION*
}

5 changes: 5 additions & 0 deletions tests/base/069-bootstrap.inc
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
<?php
class Foo {
public $foo;
}

26 changes: 26 additions & 0 deletions tests/base/069.phpt
Original file line number Diff line number Diff line change
@@ -0,0 1,26 @@
--TEST--
parallel recursion in objects
--SKIPIF--
<?php
if (!extension_loaded('parallel')) {
die("skip parallel not loaded");
}
?>
--FILE--
<?php
\parallel\bootstrap(sprintf("%s/069-bootstrap.inc", __DIR__));

include (sprintf("%s/069-bootstrap.inc", __DIR__));

$foo = new Foo;
$foo->foo = $foo;

\parallel\run(function(Foo $foo){
var_dump($foo);
}, [$foo]);
?>
--EXPECT--
object(Foo)#2 (1) {
["foo"]=>
*RECURSION*
}

0 comments on commit 45626d0

Please sign in to comment.