File: bug0851-001.phpt

package info (click to toggle)
php-mongodb 1.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,776 kB
  • sloc: ansic: 78,913; xml: 2,277; php: 990; sh: 107; python: 47; pascal: 21; makefile: 2
file content (55 lines) | stat: -rw-r--r-- 1,000 bytes parent folder | download | duplicates (10)
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
--TEST--
PHPC-851: Manager constructor should not modify options argument
--FILE--
<?php

$options = [
    'readPreference' => 'secondaryPreferred',
    'readPreferenceTags' => [
        ['dc' => 'ny'],
        [],
    ],
];

$manager = new MongoDB\Driver\Manager(null, $options);
var_dump($options);

/* Dump the Manager's ReadPreference to ensure that each element in the
 * readPreferenceTags option was converted to an object. */
var_dump($manager->getReadPreference());

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
array(2) {
  ["readPreference"]=>
  string(18) "secondaryPreferred"
  ["readPreferenceTags"]=>
  array(2) {
    [0]=>
    array(1) {
      ["dc"]=>
      string(2) "ny"
    }
    [1]=>
    array(0) {
    }
  }
}
object(MongoDB\Driver\ReadPreference)#%d (%d) {
  ["mode"]=>
  string(18) "secondaryPreferred"
  ["tags"]=>
  array(2) {
    [0]=>
    object(stdClass)#%d (%d) {
      ["dc"]=>
      string(2) "ny"
    }
    [1]=>
    object(stdClass)#%d (%d) {
    }
  }
}
===DONE===