1--TEST-- 2Test Stomp::getReadTimout() and Stomp::setReadTimeout() - tests functionnality and parameters 3--INI-- 4stomp.default_read_timeout_sec=5 5stomp.default_read_timeout_usec=5 6--SKIPIF-- 7<?php 8 if (!extension_loaded("stomp")) print "skip"; 9 if (!stomp_connect()) print "skip"; 10?> 11--FILE-- 12<?php 13$s = new Stomp(); 14 15// First test, read from ini variables, expected to return 5.5 16var_dump($s->getReadTimeout()); 17 18// Set read timout with an integer as seconds 19var_dump($s->setReadTimeout(10)); 20// Second test, read supposed to return 10.0 21var_dump($s->getReadTimeout()); 22 23// Set read timout with an integer as seconds 24var_dump($s->setReadTimeout(10, 5)); 25// Third test, read supposed to return 10.5 26var_dump($s->getReadTimeout()); 27 28// Set read timout with the first param as a string, supposed to trigger a warning 29var_dump($s->setReadTimeout('')); 30// Fourth test, read supposed to get the last value set : 10.5 31var_dump($s->getReadTimeout()); 32 33// Set read timout with the second param as a string, supposed to trigger a warning 34var_dump($s->setReadTimeout(10, '')); 35// Fourth test, read supposed to get the last value set : 10.5 36var_dump($s->getReadTimeout()); 37 38// Set read timout with the params as null 39var_dump($s->setReadTimeout(null, null)); 40// Fifth test, read supposed to get the last value set : 0.0 41var_dump($s->getReadTimeout()); 42 43 44unset($s); 45?> 46--EXPECTF-- 47array(2) { 48 ["sec"]=> 49 int(5) 50 ["usec"]=> 51 int(5) 52} 53NULL 54array(2) { 55 ["sec"]=> 56 int(10) 57 ["usec"]=> 58 int(0) 59} 60NULL 61array(2) { 62 ["sec"]=> 63 int(10) 64 ["usec"]=> 65 int(5) 66} 67 68Warning: Stomp::setReadTimeout() expects parameter 1 to be long, string given in %s on line %d 69NULL 70array(2) { 71 ["sec"]=> 72 int(10) 73 ["usec"]=> 74 int(5) 75} 76 77Warning: Stomp::setReadTimeout() expects parameter 2 to be long, string given in %s on line %d 78NULL 79array(2) { 80 ["sec"]=> 81 int(10) 82 ["usec"]=> 83 int(5) 84} 85NULL 86array(2) { 87 ["sec"]=> 88 int(0) 89 ["usec"]=> 90 int(0) 91} 92