File: public-props-read-only.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 (183 lines) | stat: -rw-r--r-- 3,356 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
--TEST--
Public Properties should be Read Only
--SKIPIF--
<?php require_once "tests/utils/standalone.inc" ?>
--FILE--
<?php
require_once "tests/utils/server.inc";

$d = new MongoDate("1263513600");
$d->sec = 123;
$d->usec = 400;
var_dump($d);

$b = new MongoBinData("binary", 0);
$b->type = 123;
$b->bin = 42;
var_dump($b);


$code = new MongoCode("some code", array("a" => "scope"));
$code->code = "stuff";
$code->scope = new stdclass;
var_dump($code);


$id = new MongoId("51927cff44415ea9024c732f");
$id->{'$id'} = "123";
var_dump($id);


$int32 = new MongoInt32("22");
$int32->value = 42;
var_dump($int32);


$int64 = new MongoInt64("22");
$int64->value = 42;
var_dump($int64);


$regex = new MongoRegex("/asdf/");
$regex->regex = "regex";
$regex->flags = 42;
var_dump($regex);


$ts = new MongoTimestamp(1368554677);
$ts->sec = 42;
$ts->inc = 123;
var_dump($ts);



$dsn = MongoShellServer::getStandaloneInfo();
$m = new MongoClient($dsn);

$db = $m->selectDb(dbname());
$db->w = 42;
$db->wtimeout = 42;
var_dump($db);

$collection = $db->readonly;
/* FIXME: This two are super difficult to deprecate since GridFS extends Collection */
$collection->w = 42;
$collection->wtimeout = 42;
var_dump($collection);

$gridfs = $db->getGridFS();
$gridfs->chunks = "chunks";
$gridfs->w = 42;
var_dump($gridfs);


?>
===DONE==
<?php exit(0); ?>
--EXPECTF--
%s: The 'sec' property is read-only in %s on line %d

%s: The 'usec' property is read-only in %s on line %d
object(MongoDate)#%d (2) {
  ["sec"]=>
  int(1263513600)
  ["usec"]=>
  int(0)
}

%s: The 'type' property is read-only in %s on line %d

%s: The 'bin' property is read-only in %s on line %d
object(MongoBinData)#%d (2) {
  ["bin"]=>
  string(6) "binary"
  ["type"]=>
  int(0)
}

%s: The 'code' property is read-only in %s on line %d

%s: The 'scope' property is read-only in %s on line %d
object(MongoCode)#%d (2) {
  ["code"]=>
  string(9) "some code"
  ["scope"]=>
  array(1) {
    ["a"]=>
    string(5) "scope"
  }
}

%s: The '$id' property is read-only in %s on line %d
object(MongoId)#%d (1) {
  ["$id"]=>
  string(24) "51927cff44415ea9024c732f"
}

%s: The 'value' property is read-only in %s on line %d
object(MongoInt32)#%d (1) {
  ["value"]=>
  string(2) "22"
}

%s: The 'value' property is read-only in %s on line %d
object(MongoInt64)#%d (1) {
  ["value"]=>
  string(2) "22"
}

%s: The 'regex' property is read-only in %s on line %d

%s: The 'flags' property is read-only in %s on line %d
object(MongoRegex)#%d (2) {
  ["regex"]=>
  string(4) "asdf"
  ["flags"]=>
  string(0) ""
}

%s: The 'sec' property is read-only in %s on line %d

%s: The 'inc' property is read-only in %s on line %d
object(MongoTimestamp)#%d (2) {
  ["sec"]=>
  int(1368554677)
  ["inc"]=>
  int(0)
}

%s: The 'w' property is read-only in %s on line %d

%s: The 'wtimeout' property is read-only in %s on line %d
object(MongoDB)#%d (2) {
  ["w"]=>
  int(1)
  ["wtimeout"]=>
  int(10000)
}
object(MongoCollection)#%d (2) {
  ["w"]=>
  int(42)
  ["wtimeout"]=>
  int(42)
}

%s: The 'chunks' property is read-only in %s on line %d
object(MongoGridFS)#%d (5) {
  ["w"]=>
  int(42)
  ["wtimeout"]=>
  int(10000)
  ["chunks"]=>
  object(MongoCollection)#13 (2) {
    ["w"]=>
    int(1)
    ["wtimeout"]=>
    int(10000)
  }
  ["filesName%s]=>
  string(8) "fs.files"
  ["chunksName%s]=>
  string(9) "fs.chunks"
}
===DONE==