Skip to content
Browse files

Catch errors, CS.

git-svn-id: http://svn.php.net/repository/pear/packages/SOAP_Interop/trunk@227890 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 4f2e3e0 commit ce42d4f23fff2d619d563747419af02eb3747ba6 Jan Schneider committed Jan 22, 2007
Showing with 14 additions and 9 deletions.
  1. +14 −9 interop_client_run.php
View
23 interop_client_run.php
@@ -53,6 +53,11 @@
#$_SERVER['argv'] = array('-r', "Round 3", '-s', "Local PEAR::SOAP");
$args = Console_Getopt::getopt($_SERVER['argv'], 'c:dehl:m:np:r:s:t:v:wq', array('help'));
+if (PEAR::isError($args)) {
+ echo "\n" . $args->getMessage() . "\n\n";
+ help();
+ exit;
+}
function help() {
print <<<END
@@ -88,15 +93,15 @@ function print_endpoint_names()
{
global $iop;
if (!$iop->getEndpoints($iop->currentTest)) {
- die("Unable to retrieve endpoints for $iop->currentTest");
+ die("Unable to retrieve endpoints for $iop->currentTest\n");
}
print "Interop Servers for $iop->currentTest:\n";
foreach ($iop->endpoints as $server) {
print " $server->name\n";
}
}
-foreach($args[0] as $arg) {
+foreach ($args[0] as $arg) {
switch($arg[0]) {
case 'c':
$iop->client_type = $arg[1];
@@ -124,14 +129,14 @@ function print_endpoint_names()
case 'p':
if ($arg[1] == 't') {
print_test_names();
- } else if ($arg[1] == 'e') {
+ } elseif ($arg[1] == 'e') {
if (!$iop->currentTest) {
- print "You need to specify a test with -t";
+ print "You need to specify a test with -t\n";
exit(0);
}
print_endpoint_names();
} else {
- die("invalid print argument");
+ die("invalid print argument\n");
}
exit(0);
break;
@@ -145,8 +150,9 @@ function print_endpoint_names()
$iop->currentTest = $arg[1];
break;
case 'v':
- if ($arg[1]!='php' && $arg[1]!='soapval')
- die('Incorrect value for argument v: '.$arg[1]);
+ if ($arg[1] != 'php' && $arg[1] != 'soapval') {
+ die('Incorrect value for argument v: ' . $arg[1] . "\n");
+ }
$iop->paramType = $arg[1];
break;
case 'w':
@@ -181,5 +187,4 @@ function print_endpoint_names()
#$iop->doGroupTests(); // run a group of tests set in $currentTest
$iop->doTests(); // run all tests, ignore above options
}
-echo "done";
-?>
+echo "done\n";

0 comments on commit ce42d4f

Please sign in to comment.
Something went wrong with that request. Please try again.