We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5a0b637 + 64af0dc commit 3aa60e5Copy full SHA for 3aa60e5
tests/Model/TypeMapArrayIteratorTest.php
@@ -0,0 +1,33 @@
1
+<?php
2
+
3
+namespace MongoDB\Tests;
4
5
+use MongoDB\Model\TypeMapArrayIterator;
6
7
+class TypeMapArrayIteratorTest extends TestCase
8
+{
9
+ public function testCurrentAppliesTypeMap()
10
+ {
11
+ $document = [
12
+ 'array' => [1, 2, 3],
13
+ 'object' => ['foo' => 'bar'],
14
+ ];
15
16
+ $typeMap = [
17
+ 'root' => 'object',
18
+ 'document' => 'object',
19
+ 'array' => 'array',
20
21
22
+ $iterator = new TypeMapArrayIterator([$document], $typeMap);
23
24
+ $expectedDocument = (object) [
25
26
+ 'object' => (object) ['foo' => 'bar'],
27
28
29
+ $iterator->rewind();
30
31
+ $this->assertEquals($expectedDocument, $iterator->current());
32
+ }
33
+}
0 commit comments