Skip to content

Commit

Permalink
make this test a bit more tolerant when checking sleep time
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Sep 12, 2014
1 parent 99fb5d0 commit 4db2181
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/pdo_pgsql/tests/getnotify.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@ var_dump($db->pgsqlGetNotify());
// Test second parameter, should wait 2 seconds because no notify is queued
$t = microtime(1);
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 1000);
var_dump((microtime(1) - $t) >= 1);
$diff = microtime(1) - $t;
var_dump($diff >= 1 || 1 - abs($diff) < .01);
var_dump($notify);

// Test second parameter, should return immediately because a notify is queued
$db->exec("NOTIFY notifies_phpt");
$t = microtime(1);
$notify = $db->pgsqlGetNotify(PDO::FETCH_ASSOC, 5000);
var_dump((microtime(1) - $t) < 1);
$diff = microtime(1) - $t;
var_dump($diff < 1 || abs(1 - abs($diff)) < .01);
var_dump(count($notify));

?>
Expand Down

0 comments on commit 4db2181

Please sign in to comment.