summaryrefslogtreecommitdiff
path: root/vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php')
-rw-r--r--vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php
new file mode 100644
index 0000000..5bcf06f
--- /dev/null
+++ b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Guzzle\Tests\Iterator;
+
+use Guzzle\Iterator\MethodProxyIterator;
+use Guzzle\Iterator\ChunkedIterator;
+
+/**
+ * @covers Guzzle\Iterator\MethodProxyIterator
+ */
+class MethodProxyIteratorTest extends \PHPUnit_Framework_TestCase
+{
+ public function testProxiesMagicCallsToInnermostIterator()
+ {
+ $i = new \ArrayIterator();
+ $proxy = new MethodProxyIterator(new MethodProxyIterator(new MethodProxyIterator($i)));
+ $proxy->append('a');
+ $proxy->append('b');
+ $this->assertEquals(array('a', 'b'), $i->getArrayCopy());
+ $this->assertEquals(array('a', 'b'), $proxy->getArrayCopy());
+ }
+
+ public function testUsesInnerIterator()
+ {
+ $i = new MethodProxyIterator(new ChunkedIterator(new \ArrayIterator(array(1, 2, 3, 4, 5)), 2));
+ $this->assertEquals(3, count(iterator_to_array($i, false)));
+ }
+}