Skip to content

Commit 3aa60e5

Browse files
committed
Merge pull request #425
2 parents 5a0b637 + 64af0dc commit 3aa60e5

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
'array' => [1, 2, 3],
26+
'object' => (object) ['foo' => 'bar'],
27+
];
28+
29+
$iterator->rewind();
30+
31+
$this->assertEquals($expectedDocument, $iterator->current());
32+
}
33+
}

0 commit comments

Comments
 (0)