diff --git a/tests/Alcaeus/MongoDbAdapter/TypeConverterTest.php b/tests/Alcaeus/MongoDbAdapter/TypeConverterTest.php new file mode 100644 index 00000000..38fcad7b --- /dev/null +++ b/tests/Alcaeus/MongoDbAdapter/TypeConverterTest.php @@ -0,0 +1,43 @@ +skipTestIf(extension_loaded('mongo')); + $this->assertEquals($modernValue, TypeConverter::fromLegacy($legacyValue)); + } + + public static function converterData() + { + $id = str_repeat('0123', 6); + + return [ + 'objectId' => [ + new \MongoId($id), new BSON\ObjectID($id) + ], + 'numericArray' => [ + ['foo', 'bar'], ['foo', 'bar'] + ], + 'hashWithNumericKeys' => [ + (object) ['foo', 'bar'], new BSONDocument(['foo', 'bar']) + ], + 'hash' => [ + ['foo' => 'bar'], new BSONDocument(['foo' => 'bar']) + ], + 'nestedArrays' => [ + [['foo' => 'bar']], [new BSONDocument(['foo' => 'bar'])] + ], + ]; + } +}