Skip to content

Commit

Permalink
Some basic test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
colder committed Sep 7, 2011
1 parent 92c5417 commit 36049c0
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/weakmap_001.phpt
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
WeakMap: usage
--FILE--
<?php
$wm = new WeakMap();

$o = new StdClass;

class A {
public function __destruct() {
echo "Dead!\n";
}
}

$wm[$o] = new A;

var_dump(count($wm));
echo "Unsetting..\n";
unset($o);
echo "Done\n";
var_dump(count($wm));
?>
==END==
--EXPECTF--
int(1)
Unsetting..
Dead!
Done
int(0)
==END==

0 comments on commit 36049c0

Please sign in to comment.