Skip to content

Commit c224e6d

Browse files
committed
PHPC-381: Print whether profile commands were successful
1 parent 88307b4 commit c224e6d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/server/server-executeCommand-002.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ $command = new MongoDB\Driver\Command(array('profile' => 2));
1515
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
1616
$result = current($cursor->toArray());
1717

18-
if (empty($result->ok)) {
19-
exit("Could not set profile level\n");
20-
}
18+
printf("Set profile level to 2 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
2119

2220
$command = new MongoDB\Driver\Command(array(
2321
'aggregate' => COLLECTION_NAME,
@@ -44,14 +42,13 @@ $command = new MongoDB\Driver\Command(array('profile' => 0));
4442
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
4543
$result = current($cursor->toArray());
4644

47-
if (empty($result->ok)) {
48-
exit("Could not set profile level\n");
49-
}
45+
printf("Set profile level to 0 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
5046

5147
?>
5248
===DONE===
5349
<?php exit(0); ?>
5450
--EXPECTF--
51+
Set profile level to 2 successfully: yes
5552
object(stdClass)#%d (%d) {
5653
["aggregate"]=>
5754
string(32) "server_server_executeCommand_002"
@@ -75,4 +72,5 @@ object(stdClass)#%d (%d) {
7572
}
7673
}
7774
}
75+
Set profile level to 0 successfully: yes
7876
===DONE===

tests/server/server-executeQuery-005.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ $command = new MongoDB\Driver\Command(array('profile' => 2));
1515
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
1616
$result = current($cursor->toArray());
1717

18+
printf("Set profile level to 2 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
19+
1820
if (empty($result->ok)) {
1921
exit("Could not set profile level\n");
2022
}
@@ -40,14 +42,13 @@ $command = new MongoDB\Driver\Command(array('profile' => 0));
4042
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
4143
$result = current($cursor->toArray());
4244

43-
if (empty($result->ok)) {
44-
exit("Could not set profile level\n");
45-
}
45+
printf("Set profile level to 0 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
4646

4747
?>
4848
===DONE===
4949
<?php exit(0); ?>
5050
--EXPECTF--
51+
Set profile level to 2 successfully: yes
5152
object(stdClass)#%d (%d) {
5253
["$query"]=>
5354
object(stdClass)#%d (%d) {
@@ -63,4 +64,5 @@ object(stdClass)#%d (%d) {
6364
}
6465
}
6566
}
67+
Set profile level to 0 successfully: yes
6668
===DONE===

0 commit comments

Comments
 (0)