Skip to content

Commit a07af2f

Browse files
committed
PHON-23: Add test for connecting to SSL server
1 parent abaed98 commit a07af2f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--TEST--
2+
MongoDB\Write\Batch: #001 Variety Batch
3+
--SKIPIF--
4+
<?php require "tests/utils/basic-skipif.inc"?>
5+
--FILE--
6+
<?php
7+
require_once "tests/utils/basic.inc";
8+
9+
$dsn = sprintf("%s/?ssl=true", MONGODB_STANDALONE_SSL_URI);
10+
11+
$mc = new MongoDB\Manager($dsn);
12+
13+
$batch = new MongoDB\WriteBatch;
14+
15+
$batch->insert(array("my" => "value"));
16+
$batch->insert(array("my" => "value", "foo" => "bar"));
17+
$batch->insert(array("my" => "value", "foo" => "bar"));
18+
19+
$batch->delete(array("my" => "value", "foo" => "bar"), array("limit" => 1));
20+
21+
$batch->update(array("foo" => "bar"), array('$set' => array("foo" => "baz")), array("limit" => 1, "upsert" => 0));
22+
23+
$retval = $mc->executeWriteBatch(NS, $batch);
24+
25+
printf("Inserted: %d\n", getInsertCount($retval));
26+
printf("Deleted: %d\n", getDeletedCount($retval));
27+
printf("Updated: %d\n", getModifiedCount($retval));
28+
printf("Upserted: %d\n", getUpsertedCount($retval));
29+
foreach(getWriteErrors($retval) as $error) {
30+
printf("WriteErrors: %", $error);
31+
}
32+
?>
33+
===DONE===
34+
<?php exit(0); ?>
35+
--EXPECT--
36+
Inserted: 3
37+
Deleted: 1
38+
Updated: 1
39+
Upserted: 0
40+
===DONE===

0 commit comments

Comments
 (0)