From e8334afd7f2920b706a3d28250a3e2b6dbd49538 Mon Sep 17 00:00:00 2001 From: valmat Date: Tue, 18 Mar 2014 15:18:11 +0600 Subject: Unit tests. For description see https://github.com/CopernicaMarketingSoftware/PHP-CPP/pull/25#issuecomment-37882236 --- tests/php/include/valueiterator/1.php | 76 +++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 tests/php/include/valueiterator/1.php (limited to 'tests/php/include/valueiterator/1.php') diff --git a/tests/php/include/valueiterator/1.php b/tests/php/include/valueiterator/1.php new file mode 100644 index 0000000..984a77f --- /dev/null +++ b/tests/php/include/valueiterator/1.php @@ -0,0 +1,76 @@ +position = 0; + } + + function rewind() { + $this->position = 0; + } + + function current() { + return $this->array[$this->position]; + } + + function key() { + return 'key_' . $this->position; + } + + function next() { + ++$this->position; + } + + function valid() { + return isset($this->array[$this->position]); + } + + function __destruct() { + echo "~impIterator\n"; + } +} + +class impIterAggr1 implements IteratorAggregate { + public function getIterator() { + return new ArrayIterator(new SimpleClass); + } + function __destruct() { + echo "~impIterAggr1\n"; + } +} + +class impIterAggr2 implements IteratorAggregate { + public function getIterator() { + return new impIterator(); + } + function __destruct() { + echo "~impIterAggr2\n"; + } +} + + + + + + + + + + + + + -- cgit v1.2.3