Skip to content

Commit 44ac5c4

Browse files
committed
Manager debug ouput tests should not depend on libmongoc tracing
These tests were fragile and could fail when using libmongoc as a system library where tracing may not be enabled.
1 parent 6ed6a34 commit 44ac5c4

File tree

2 files changed

+11
-29
lines changed

2 files changed

+11
-29
lines changed

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

0 commit comments

Comments
 (0)