@@ -6,14 +6,15 @@ MongoDB\BSON\toJSON(): Encoding extended JSON types
66require_once __DIR__ . '/../utils/tools.php ' ;
77
88$ tests = [
9- ['_id ' => new MongoDB \BSON \ObjectId ('56315a7c6118fd1b920270b1 ' )],
10- ['binary ' => new MongoDB \BSON \Binary ('foo ' , MongoDB \BSON \Binary::TYPE_GENERIC )],
11- ['date ' => new MongoDB \BSON \UTCDateTime (1445990400000 )],
12- ['timestamp ' => new MongoDB \BSON \Timestamp (MongoDB \BSON \Binary::TYPE_GENERIC , 1446084619 )],
13- ['regex ' => new MongoDB \BSON \Regex ('pattern ' , 'i ' )],
14- ['minkey ' => new MongoDB \BSON \MinKey ],
15- ['maxkey ' => new MongoDB \BSON \MaxKey ],
16- ['long ' => 1234 ],
9+ [ '_id ' => new MongoDB \BSON \ObjectId ('56315a7c6118fd1b920270b1 ' ) ],
10+ [ 'binary ' => new MongoDB \BSON \Binary ('foo ' , MongoDB \BSON \Binary::TYPE_GENERIC ) ],
11+ [ 'date ' => new MongoDB \BSON \UTCDateTime (1445990400000 ) ],
12+ [ 'timestamp ' => new MongoDB \BSON \Timestamp (1234 , 5678 ) ],
13+ [ 'regex ' => new MongoDB \BSON \Regex ('pattern ' , 'i ' ) ],
14+ [ 'code ' => new MongoDB \BSON \Javascript ('function() { return 1; } ' ) ],
15+ [ 'code_ws ' => new MongoDB \BSON \Javascript ('function() { return a; } ' , ['a ' => 1 ]) ],
16+ [ 'minkey ' => new MongoDB \BSON \MinKey ],
17+ [ 'maxkey ' => new MongoDB \BSON \MaxKey ],
1718];
1819
1920foreach ($ tests as $ value ) {
@@ -28,9 +29,10 @@ foreach ($tests as $value) {
2829{ "_id" : { "$oid" : "56315a7c6118fd1b920270b1" } }
2930{ "binary" : { "$binary" : "Zm9v", "$type" : "00" } }
3031{ "date" : { "$date" : 1445990400000 } }
31- { "timestamp" : { "$timestamp" : { "t" : 1446084619 , "i" : 0 } } }
32+ { "timestamp" : { "$timestamp" : { "t" : 5678 , "i" : 1234 } } }
3233{ "regex" : { "$regex" : "pattern", "$options" : "i" } }
34+ { "code" : { "$code" : "function() { return 1; }" } }
35+ { "code_ws" : { "$code" : "function() { return a; }", "$scope" : { "a" : 1 } } }
3336{ "minkey" : { "$minKey" : 1 } }
3437{ "maxkey" : { "$maxKey" : 1 } }
35- { "long" : 1234 }
3638===DONE===
0 commit comments