File: bug01099-3.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 (114 lines) | stat: -rw-r--r-- 3,606 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
--TEST--
Test for PHP-1099: socketTimeoutMS=-1 doesn't work (default socketTimeoutMS)
--SKIPIF--
<?php require_once "tests/utils/standalone.inc" ?>
<?php if (!version_compare(phpversion(), "5.3", '>=')) echo "skip >= PHP 5.3 needed\n"; ?>
<?php if (!MONGO_STREAMS) { echo "skip This test requires streams support"; } ?>
--FILE--
<?php
require_once "tests/utils/server.inc";

printLogs(MongoLog::CON, MongoLog::FINE, "/timeout/");

// This should have no effect on socketTimeoutMS
MongoCursor::$timeout = -2;

$host = MongoShellServer::getStandaloneInfo();
$dsn = "mongodb://$host/";
$mc = new MongoClient($dsn);
echo "Connected\n";

$db = $mc->selectDb(dbname());
$collection = $mc->selectCollection(dbname(), collname(__FILE__));
$collection->drop();
echo "Dropped\n";

$cursor = $collection->findOne();
echo "findOne done\n";

echo "\n\nTimeout 20\n";
$cursor = $collection->find();
$cursor->timeout(20);
iterator_to_array($cursor);

echo "\n\nTimeout 43\n";
MongoCursor::$timeout = 43;
$cursor = $collection->find();
iterator_to_array($cursor);

echo "\n\nTimeout -1\n";
$cursor = $collection->find();
$cursor->timeout(-1);
iterator_to_array($cursor);

echo "\n\nTimeout 42\n";
$cursor = $collection->find();
$cursor->timeout(42);
iterator_to_array($cursor);

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Connecting to tcp://%s:%d (%s:%d;-;.;%d) with connection timeout: 60.000000
Setting stream timeout to 30.000000
Setting the stream timeout to 60.000000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 60.000000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 60.000000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 60.000000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 60.000000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 60.000000
Now setting stream timeout back to 30.000000
Connected
Initializing cursor timeout to 30000 (from connection options)
No timeout changes for %s:%d;-;.;%d
No timeout changes for %s:%d;-;.;%d
Dropped
Initializing cursor timeout to 30000 (from connection options)
No timeout changes for %s:%d;-;.;%d
No timeout changes for %s:%d;-;.;%d
findOne done


Timeout 20
Initializing cursor timeout to 30000 (from connection options)
Setting the stream timeout to 0.020000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 0.020000
Now setting stream timeout back to 30.000000


Timeout 43

%s: The 'MongoCursor::$timeout' static property is deprecated, please call MongoCursor->timeout() instead in %s on line %d
Initializing cursor timeout to 43 (from deprecated static property)
Setting the stream timeout to 0.043000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 0.043000
Now setting stream timeout back to 30.000000


Timeout -1

%s: The 'MongoCursor::$timeout' static property is deprecated, please call MongoCursor->timeout() instead in %s on line %d
Initializing cursor timeout to 43 (from deprecated static property)
Setting the stream timeout to -1.000000
Now setting stream timeout back to 30.000000
Setting the stream timeout to -1.000000
Now setting stream timeout back to 30.000000


Timeout 42

%s: The 'MongoCursor::$timeout' static property is deprecated, please call MongoCursor->timeout() instead in %s on line %d
Initializing cursor timeout to 43 (from deprecated static property)
Setting the stream timeout to 0.042000
Now setting stream timeout back to 30.000000
Setting the stream timeout to 0.042000
Now setting stream timeout back to 30.000000
===DONE===