Skip to content

Commit 6919b41

Browse files
committed
PHON-22: New test to verify standard authentication
Note that there is a bug in Mongo Orchestration preventing this test from working properly as the user cannot be created (no "localhost exception")
1 parent a07af2f commit 6919b41

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--TEST--
2+
MongoDB\Write\Batch: #001 Variety Batch
3+
--SKIPIF--
4+
<?php exit("skip FIXME: https://github.com/10gen/mongo-orchestration/issues/154"); ?>
5+
<?php require "tests/utils/basic-skipif.inc"?>
6+
--FILE--
7+
<?php
8+
require_once "tests/utils/basic.inc";
9+
10+
$username = "root";
11+
$password = "toor";
12+
$database = "admin";
13+
14+
$parsed = parse_url(MONGODB_STANDALONE_AUTH_URI);
15+
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
16+
var_dump($dsn);
17+
$mc = new MongoDB\Manager($dsn);
18+
19+
$batch = new MongoDB\WriteBatch;
20+
21+
$batch->insert(array("my" => "value"));
22+
$batch->insert(array("my" => "value", "foo" => "bar"));
23+
$batch->insert(array("my" => "value", "foo" => "bar"));
24+
25+
$batch->delete(array("my" => "value", "foo" => "bar"), array("limit" => 1));
26+
27+
$batch->update(array("foo" => "bar"), array('$set' => array("foo" => "baz")), array("limit" => 1, "upsert" => 0));
28+
29+
$retval = $mc->executeWriteBatch(NS, $batch);
30+
31+
printf("Inserted: %d\n", getInsertCount($retval));
32+
printf("Deleted: %d\n", getDeletedCount($retval));
33+
printf("Updated: %d\n", getModifiedCount($retval));
34+
printf("Upserted: %d\n", getUpsertedCount($retval));
35+
foreach(getWriteErrors($retval) as $error) {
36+
printf("WriteErrors: %", $error);
37+
}
38+
?>
39+
===DONE===
40+
<?php exit(0); ?>
41+
--EXPECT--
42+
Inserted: 3
43+
Deleted: 1
44+
Updated: 1
45+
Upserted: 0
46+
===DONE===

0 commit comments

Comments
 (0)