Skip to content

Commit ab2e2b8

Browse files
committed
Merge pull request #526
2 parents 31b8693 + 59dc7c7 commit ab2e2b8

13 files changed

+26
-283
lines changed

tests/bson/bson-decode-001.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ $tests = array(
1010
array((object)array("hello" => "world")),
1111
array(null),
1212
array(123),
13-
14-
array(4.23),
13+
array(4.125),
1514
array(true),
1615
array(false),
1716
array("string"),
@@ -60,7 +59,7 @@ Test#2 { "0" : null }
6059
OK
6160
Test#3 { "0" : 123 }
6261
OK
63-
Test#4 { "0" : 4.23 }
62+
Test#4 { "0" : 4.125 }
6463
OK
6564
Test#5 { "0" : true }
6665
OK

tests/bson/bson-encode-001.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $tests = array(
1515
array(array("0" => 1, "1" => 2, "2" => 3, "3" => 4, "4" => 5, "5" => 6, "6" => 7, "7" => 8, "8" => 9)),
1616
array(null),
1717
array(123),
18-
array(4.23),
18+
array(4.125),
1919
array(true),
2020
array(false),
2121
array("string"),
@@ -74,8 +74,8 @@ Test#7 { "0" : null }
7474
0 : 08 00 00 00 0a 30 00 00 [.....0..]
7575
Test#8 { "0" : 123 }
7676
0 : 0c 00 00 00 10 30 00 7b 00 00 00 00 [.....0.{....]
77-
Test#9 { "0" : 4.23 }
78-
0 : 10 00 00 00 01 30 00 ec 51 b8 1e 85 eb 10 40 00 [.....0..Q.....@.]
77+
Test#9 { "0" : 4.125 }
78+
0 : 10 00 00 00 01 30 00 00 00 00 00 00 80 10 40 00 [.....0........@.]
7979
Test#10 { "0" : true }
8080
0 : 09 00 00 00 08 30 00 01 00 [.....0...]
8181
Test#11 { "0" : false }

tests/bson/bson-fromJSON_error-001.phpt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ MongoDB\BSON\fromJSON(): invalid JSON
55

66
require_once __DIR__ . '/../utils/tools.php';
77

8-
echo throws(function() {
8+
throws(function() {
99
fromJSON('foo');
10-
}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n";
10+
}, 'MongoDB\Driver\Exception\UnexpectedValueException');
1111

1212
?>
1313
===DONE===
1414
<?php exit(0); ?>
1515
--EXPECT--
1616
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
17-
lexical error: invalid string in json text.
18-
foo
19-
(right here) ------^
20-
2117
===DONE===

tests/bson/bson-javascript-jsonserialize-003.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ var_dump(toPHP(fromJSON($json)));
2020
{"foo":{"$code":"function foo(bar) { return bar; }"}}
2121
object(stdClass)#%d (%d) {
2222
["foo"]=>
23-
object(stdClass)#%d (%d) {
24-
["$code"]=>
23+
object(%r(stdClass|MongoDB\\BSON\\Javascript)%r)#%d (%d) {
24+
["%r(\$?)%rcode"]=>
2525
string(33) "function foo(bar) { return bar; }"
26-
}
26+
%A}
2727
}
2828
===DONE===

tests/bson/bson-javascript-jsonserialize-004.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ var_dump(toPHP(fromJSON($json)));
2020
{"foo":{"$code":"function foo(bar) { return bar; }","$scope":{"foo":42}}}
2121
object(stdClass)#%d (%d) {
2222
["foo"]=>
23-
object(stdClass)#%d (%d) {
24-
["$code"]=>
23+
object(%r(stdClass|MongoDB\\BSON\\Javascript)%r)#%d (%d) {
24+
["%r(\$?)%rcode"]=>
2525
string(33) "function foo(bar) { return bar; }"
26-
["$scope"]=>
26+
["%r(\$?)%rscope"]=>
2727
object(stdClass)#%d (%d) {
2828
["foo"]=>
2929
int(42)

tests/functional/phpinfo-1.phpt

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
--TEST--
2-
phpinfo()
2+
phpinfo() reports mongodb.debug (no value)
33
--SKIPIF--
44
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
5-
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
65
--FILE--
76
<?php
8-
require_once __DIR__ . "/../utils/basic.inc";
97

108
phpinfo();
119

@@ -14,22 +12,6 @@ phpinfo();
1412
<?php exit(0); ?>
1513
--EXPECTF--
1614
%a
17-
mongodb
18-
19-
MongoDB support => enabled
20-
MongoDB extension version => 1.%d.%d%S
21-
MongoDB extension stability => %s
22-
libbson bundled version => 1.%d.%d%S
23-
libmongoc bundled version => 1.%d.%d%S
24-
libmongoc SSL => enabled
25-
libmongoc SSL library => %s
26-
libmongoc crypto => enabled
27-
libmongoc crypto library => %s
28-
libmongoc crypto system profile => %s
29-
libmongoc SASL => enabled
30-
31-
Directive => Local Value => Master Value
3215
mongodb.debug => no value => no value
33-
3416
%a
3517
===DONE===

tests/functional/phpinfo-2.phpt

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
--TEST--
2-
phpinfo()
2+
phpinfo() reports mongodb.debug (default and overridden)
33
--INI--
44
mongodb.debug=stderr
55
--SKIPIF--
66
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
7-
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
87
--FILE--
98
<?php
10-
require_once __DIR__ . "/../utils/basic.inc";
119

1210
ini_set("mongodb.debug", "stdout");
1311
phpinfo();
@@ -17,22 +15,6 @@ phpinfo();
1715
<?php exit(0); ?>
1816
--EXPECTF--
1917
%a
20-
mongodb
21-
22-
MongoDB support => enabled
23-
MongoDB extension version => 1.%d.%d%S
24-
MongoDB extension stability => %s
25-
libbson bundled version => 1.%d.%d%S
26-
libmongoc bundled version => 1.%d.%d%S
27-
libmongoc SSL => enabled
28-
libmongoc SSL library => %s
29-
libmongoc crypto => enabled
30-
libmongoc crypto library => %s
31-
libmongoc crypto system profile => %s
32-
libmongoc SASL => enabled
33-
34-
Directive => Local Value => Master Value
3518
mongodb.debug => stdout => stderr
36-
3719
%a
3820
===DONE===

tests/manager/manager-debug-001.phpt

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,27 @@
22
MongoDB\Driver\Manager: Writing debug log files
33
--SKIPIF--
44
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
5-
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
65
--FILE--
76
<?php
8-
require_once __DIR__ . "/../utils/basic.inc";
97

108
$name = tempnam(sys_get_temp_dir(), "PHONGO");
119
unlink($name);
1210
mkdir($name);
11+
1312
ini_set('mongodb.debug', $name);
14-
$manager = new MongoDB\Driver\Manager(STANDALONE);
15-
$bulk = new MongoDB\Driver\BulkWrite();
16-
$bulk->insert(array('_id' => 1, 'x' => 1));
17-
$result = $manager->executeBulkWrite(NS, $bulk);
13+
$manager = new MongoDB\Driver\Manager;
1814
ini_set('mongodb.debug', 'off');
19-
foreach(glob($name."/*") as $file);
20-
$content = file($file);
21-
unlink($file);
22-
rmdir($name);
2315

24-
echo $content[0], $content[1];
25-
foreach($content as $line) {
26-
if (strpos($line, "mongoc_bulk_operation_execute")) {
27-
echo $line;
28-
}
16+
foreach (glob($name."/*") as $file) {
17+
echo file_get_contents($file);
18+
unlink($file);
2919
}
20+
rmdir($name);
3021

3122
?>
3223
===DONE===
3324
<?php exit(0); ?>
3425
--EXPECTF--
35-
[%s] PHONGO: DEBUG > Connection string: '%s'
26+
%A[%s] PHONGO: DEBUG > Connection string: '%s'
3627
[%s] PHONGO: DEBUG > Creating Manager, phongo-1.%d.%d%S[%s] - mongoc-1.%s(%s), libbson-1.%s(%s), php-%s
37-
[%s] mongoc: TRACE > ENTRY: mongoc_bulk_operation_execute():%d
38-
[%s] mongoc: TRACE > EXIT: mongoc_bulk_operation_execute():%d
39-
===DONE===
28+
%A===DONE===%A

tests/manager/manager-debug-002.phpt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,17 @@
22
MongoDB\Driver\Manager: mongodb.debug=stderr
33
--SKIPIF--
44
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
5-
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
65
--INI--
76
mongodb.debug=stderr
87
--FILE--
98
<?php
10-
require_once __DIR__ . "/../utils/basic.inc";
119

12-
$manager = new MongoDB\Driver\Manager(STANDALONE);
13-
$bulk = new MongoDB\Driver\BulkWrite();
14-
$bulk->insert(array('_id' => 1, 'x' => 1));
15-
$result = $manager->executeBulkWrite(NS, $bulk);
10+
$manager = new MongoDB\Driver\Manager;
1611

1712
?>
1813
===DONE===
1914
<?php exit(0); ?>
2015
--EXPECTF--
21-
%a
16+
%A[%s] PHONGO: DEBUG > Connection string: '%s'
2217
[%s] PHONGO: DEBUG > Creating Manager, phongo-1.%d.%d%S[%s] - mongoc-1.%s(%s), libbson-1.%s(%s), php-%s
23-
%a
24-
===DONE===
25-
%a
18+
%A===DONE===%A

tests/manager/manager-executeBulkWrite_error-005.phpt

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)