-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new tests and fix the error handling stuff with callback
- Loading branch information
Mikko Koppanen
committed
Sep 20, 2010
1 parent
81e3246
commit 1952427
Showing
6 changed files
with
101 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Test forcing connect | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
include dirname(__FILE__) . '/zeromq_test_helper.inc'; | ||
|
||
$socket = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_REQ); | ||
$socket->connect("tcp://127.0.0.1:5566"); | ||
$socket->connect("tcp://127.0.0.1:5566", true); | ||
$socket->connect("tcp://127.0.0.1:5566", true); | ||
$socket->connect("tcp://127.0.0.1:5566", true); | ||
$socket->connect("tcp://127.0.0.1:5566"); | ||
|
||
var_dump($socket->getEndpoints()); | ||
|
||
--EXPECTF-- | ||
array(2) { | ||
["connect"]=> | ||
array(1) { | ||
[0]=> | ||
string(20) "tcp://127.0.0.1:5566" | ||
} | ||
["bind"]=> | ||
array(0) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
Test throwing exception from callback | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
function this_throws($a, $b) | ||
{ | ||
throw new Exception("Hello there"); | ||
} | ||
|
||
try { | ||
$socket = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_REQ, 'persistent_socket', 'this_throws'); | ||
echo "Fail\n"; | ||
} catch (Exception $e) { | ||
echo $e->getMessage() . "\n"; | ||
} | ||
|
||
--EXPECTF-- | ||
Hello there | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--TEST-- | ||
Test warning in callback | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
function this_throws($a, $b) | ||
{ | ||
in_array(1, 1); | ||
} | ||
|
||
$socket = new ZMQSocket(new ZMQContext(), ZMQ::SOCKET_REQ, 'persistent_socket', 'this_throws'); | ||
|
||
--EXPECTF-- | ||
Warning: in_array() expects parameter 2 to be array, integer given in %s on line %d | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters