Skip to content

Commit 1dd5484

Browse files
committed
PHPLIB-1147: Create Int64 instances directly
1 parent 53052b6 commit 1dd5484

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/SpecTests/DocumentsMatchConstraintTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use MongoDB\BSON\Binary;
66
use MongoDB\BSON\Decimal128;
7+
use MongoDB\BSON\Int64;
78
use MongoDB\BSON\Javascript;
89
use MongoDB\BSON\MaxKey;
910
use MongoDB\BSON\MinKey;
@@ -18,7 +19,6 @@
1819

1920
use function MongoDB\BSON\fromJSON;
2021
use function MongoDB\BSON\toPHP;
21-
use function unserialize;
2222

2323
use const PHP_INT_SIZE;
2424

@@ -85,8 +85,8 @@ public function provideBSONTypes()
8585
$undefined = toPHP(fromJSON('{ "x": {"$undefined": true} }'))->x;
8686
$symbol = toPHP(fromJSON('{ "x": {"$symbol": "test"} }'))->x;
8787
$dbPointer = toPHP(fromJSON('{ "x": {"$dbPointer": {"$ref": "db.coll", "$id" : { "$oid" : "5a2e78accd485d55b405ac12" } }} }'))->x;
88-
$int64 = unserialize('C:18:"MongoDB\BSON\Int64":28:{a:1:{s:7:"integer";s:1:"1";}}');
89-
$long = PHP_INT_SIZE == 4 ? unserialize('C:18:"MongoDB\BSON\Int64":38:{a:1:{s:7:"integer";s:10:"4294967296";}}') : 4294967296;
88+
$int64 = new Int64(1);
89+
$long = PHP_INT_SIZE == 4 ? new Int64('4294967296') : 4294967296;
9090

9191
return [
9292
'double' => ['double', 1.4],

tests/UnifiedSpecTests/Constraint/IsBsonTypeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use MongoDB\BSON\Binary;
66
use MongoDB\BSON\Decimal128;
7+
use MongoDB\BSON\Int64;
78
use MongoDB\BSON\Javascript;
89
use MongoDB\BSON\MaxKey;
910
use MongoDB\BSON\MinKey;
@@ -22,7 +23,6 @@
2223
use function fopen;
2324
use function MongoDB\BSON\fromJSON;
2425
use function MongoDB\BSON\toPHP;
25-
use function unserialize;
2626

2727
use const PHP_INT_SIZE;
2828

@@ -39,8 +39,8 @@ public function provideTypes()
3939
$undefined = toPHP(fromJSON('{ "x": {"$undefined": true} }'))->x;
4040
$symbol = toPHP(fromJSON('{ "x": {"$symbol": "test"} }'))->x;
4141
$dbPointer = toPHP(fromJSON('{ "x": {"$dbPointer": {"$ref": "db.coll", "$id" : { "$oid" : "5a2e78accd485d55b405ac12" } }} }'))->x;
42-
$int64 = unserialize('C:18:"MongoDB\BSON\Int64":28:{a:1:{s:7:"integer";s:1:"1";}}');
43-
$long = PHP_INT_SIZE == 4 ? unserialize('C:18:"MongoDB\BSON\Int64":38:{a:1:{s:7:"integer";s:10:"4294967296";}}') : 4294967296;
42+
$int64 = new Int64(1);
43+
$long = PHP_INT_SIZE == 4 ? new Int64('4294967296') : 4294967296;
4444

4545
return [
4646
'double' => ['double', 1.4],

0 commit comments

Comments
 (0)