File: mongoclient-ctor-002.phpt

package info (click to toggle)
php-mongo 1.5.7-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,040 kB
  • ctags: 2,802
  • sloc: ansic: 17,632; xml: 2,195; php: 1,630; pascal: 330; makefile: 52; sh: 39
file content (65 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--TEST--
Mongo::__construct() and $options
--SKIPIF--
<?php require_once "tests/utils/replicaset.inc" ?>
<?php
if (ini_get("mongo.default_host") == hostname() && ini_get("mongo.default_port") == port()) {
    exit("SKIP This test is meaningless when connecting to localhost:27017");
}
?>
--FILE--
<?php
require_once "tests/utils/server.inc";

$host = hostname();
$port = port();
ini_set("mongo.default_host", $host);
ini_set("mongo.default_port", $port);

$opts = array(
    "replicaSet" => rsname(),
    "timeout"    => "42",
    "username"   => array("something"),
    "password"   => array("else"),
    "connect"    => "0",
);
$m = new MongoClient(null, $opts);
var_dump($opts, $m);
echo "All done\n";
?>
--EXPECTF--
%s: MongoClient::__construct(): The 'timeout' option is deprecated. Please use 'connectTimeoutMS' instead in %s on line %d

Notice: Array to string conversion in %smongoclient-ctor-002.php on line %d

Notice: Array to string conversion in %smongoclient-ctor-002.php on line %d
array(5) {
  ["replicaSet"]=>
  string(%d) "%s"
  ["timeout"]=>
  string(2) "42"
  ["username"]=>
  array(1) {
    [0]=>
    string(9) "something"
  }
  ["password"]=>
  array(1) {
    [0]=>
    string(4) "else"
  }
  ["connect"]=>
  string(1) "0"
}
object(MongoClient)#%d (4) {
  ["connected"]=>
  bool(false)
  ["status"]=>
  NULL
  ["server%S:protected%S]=>
  NULL
  ["persistent%S:protected%S]=>
  NULL
}
All done