Commit 64af0dc8 authored by Jeremy Mikola's avatar Jeremy Mikola

Test for internal TypeMapArrayIterator class

This class was originally added in PHPLIB-112
parent 5a0b637c
<?php
namespace MongoDB\Tests;
use MongoDB\Model\TypeMapArrayIterator;
class TypeMapArrayIteratorTest extends TestCase
{
public function testCurrentAppliesTypeMap()
{
$document = [
'array' => [1, 2, 3],
'object' => ['foo' => 'bar'],
];
$typeMap = [
'root' => 'object',
'document' => 'object',
'array' => 'array',
];
$iterator = new TypeMapArrayIterator([$document], $typeMap);
$expectedDocument = (object) [
'array' => [1, 2, 3],
'object' => (object) ['foo' => 'bar'],
];
$iterator->rewind();
$this->assertEquals($expectedDocument, $iterator->current());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment