From 6d52bc674c45d3fd2ab38ca9e6deef9e86f24fa7 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 10 Feb 2016 21:42:56 +0100 Subject: [PATCH] Add tests for TypeConverter --- .../MongoDbAdapter/TypeConverterTest.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/Alcaeus/MongoDbAdapter/TypeConverterTest.php diff --git a/tests/Alcaeus/MongoDbAdapter/TypeConverterTest.php b/tests/Alcaeus/MongoDbAdapter/TypeConverterTest.php new file mode 100644 index 00000000..f0536a56 --- /dev/null +++ b/tests/Alcaeus/MongoDbAdapter/TypeConverterTest.php @@ -0,0 +1,42 @@ +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'])] + ], + ]; + } +}