Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 7dd7ccf

Browse files
committed
Merged pull request #152
2 parents a806d47 + b9c29de commit 7dd7ccf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/json-serialize-regex-001.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ JsonSerializable: Regex
33
--FILE--
44
<?php
55
$doc = [
6-
'foo' => new MongoDB\BSON\Regex( "/foo/", "i" )
6+
'foo' => new MongoDB\BSON\Regex( "pattern", "i" )
77
];
88

99
echo MongoDB\BSON\toJSON( \MongoDB\BSON\fromPHP( $doc ) ), "\n";
@@ -13,13 +13,13 @@ echo $d, "\n";
1313
var_dump( \MongoDB\BSON\toPHP( \MongoDB\BSON\fromJSON( $d ) ) );
1414
?>
1515
--EXPECTF--
16-
{ "foo" : { "$regex" : "/foo/", "$options" : "i" } }
17-
{"foo":{"$regex":"\/foo\/","$options":"i"}}
16+
{ "foo" : { "$regex" : "pattern", "$options" : "i" } }
17+
{"foo":{"$regex":"pattern","$options":"i"}}
1818
object(stdClass)#%d (%d) {
1919
["foo"]=>
2020
object(MongoDB\BSON\Regex)#%d (%d) {
2121
["pattern"]=>
22-
string(%d) "/foo/"
22+
string(%d) "pattern"
2323
["flags"]=>
2424
string(%d) "i"
2525
}

tests/json-serialize-regex-002.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ JsonSerializable: Regex without flags
33
--FILE--
44
<?php
55
$doc = [
6-
'foo' => new MongoDB\BSON\Regex( "/foo/" )
6+
'foo' => new MongoDB\BSON\Regex( "pattern" )
77
];
88

99
echo MongoDB\BSON\toJSON( \MongoDB\BSON\fromPHP( $doc ) ), "\n";
@@ -13,13 +13,13 @@ echo $d, "\n";
1313
var_dump( \MongoDB\BSON\toPHP( \MongoDB\BSON\fromJSON( $d ) ) );
1414
?>
1515
--EXPECTF--
16-
{ "foo" : { "$regex" : "/foo/", "$options" : "" } }
17-
{"foo":{"$regex":"\/foo\/","$options":""}}
16+
{ "foo" : { "$regex" : "pattern", "$options" : "" } }
17+
{"foo":{"$regex":"pattern","$options":""}}
1818
object(stdClass)#%d (%d) {
1919
["foo"]=>
2020
object(MongoDB\BSON\Regex)#%d (%d) {
2121
["pattern"]=>
22-
string(%d) "/foo/"
22+
string(%d) "pattern"
2323
["flags"]=>
2424
string(%d) ""
2525
}

0 commit comments

Comments
 (0)