File: 001.phpt

package info (click to toggle)
php-stomp 2.0.2%2B1.0.9-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 568 kB
  • sloc: ansic: 3,350; xml: 820; php: 119; makefile: 1
file content (91 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (7)
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
--TEST--
Test Stomp::getReadTimout() and Stomp::setReadTimeout() - tests functionnality and parameters
--INI--
stomp.default_read_timeout_sec=5
stomp.default_read_timeout_usec=5
--SKIPIF--
<?php
    if (!extension_loaded("stomp")) print "skip"; 
    if (!stomp_connect()) print "skip";
?>
--FILE--
<?php 
$s = new Stomp();

// First test, read from ini variables,  expected to return 5.5
var_dump($s->getReadTimeout());

// Set read timout with an integer as seconds
var_dump($s->setReadTimeout(10));
// Second test, read supposed to return 10.0
var_dump($s->getReadTimeout());

// Set read timout with an integer as seconds
var_dump($s->setReadTimeout(10, 5));
// Third test, read supposed to return 10.5
var_dump($s->getReadTimeout());

// Set read timout with the first param as a string, supposed to trigger a warning
var_dump($s->setReadTimeout(''));
// Fourth test, read supposed to get the last value set : 10.5
var_dump($s->getReadTimeout());

// Set read timout with the second param as a string, supposed to trigger a warning
var_dump($s->setReadTimeout(10, ''));
// Fourth test, read supposed to get the last value set : 10.5
var_dump($s->getReadTimeout());

// Set read timout with the params as null
var_dump($s->setReadTimeout(null, null));
// Fifth test, read supposed to get the last value set : 0.0
var_dump($s->getReadTimeout());


unset($s);
?>
--EXPECTF--
array(2) {
  ["sec"]=>
  int(5)
  ["usec"]=>
  int(5)
}
NULL
array(2) {
  ["sec"]=>
  int(10)
  ["usec"]=>
  int(0)
}
NULL
array(2) {
  ["sec"]=>
  int(10)
  ["usec"]=>
  int(5)
}

Warning: Stomp::setReadTimeout() expects parameter 1 to be long, string given in %s on line %d
NULL
array(2) {
  ["sec"]=>
  int(10)
  ["usec"]=>
  int(5)
}

Warning: Stomp::setReadTimeout() expects parameter 2 to be long, string given in %s on line %d
NULL
array(2) {
  ["sec"]=>
  int(10)
  ["usec"]=>
  int(5)
}
NULL
array(2) {
  ["sec"]=>
  int(0)
  ["usec"]=>
  int(0)
}