X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=test%2Ftestsuite.php;h=90c5844fc1421f1f84755e93e0c0a886380af1ee;hb=69540b3e399387c69628c88c1f4e63fd1b2138e8;hp=e11e97ee0ffcc0d5eafa1cf5d462cace61bcc97b;hpb=369fa296e015065bd5a64ab4c410751e2a5874a8;p=plcapi.git diff --git a/test/testsuite.php b/test/testsuite.php index e11e97e..90c5844 100644 --- a/test/testsuite.php +++ b/test/testsuite.php @@ -1,5 +1,4 @@ "; + "last but not least weird names: G�nter, El�ne, and an xml comment closing tag: -->"; $f=new xmlrpcmsg('examples.stringecho', array( new xmlrpcval($sendstring, 'string') )); @@ -460,6 +459,19 @@ And turned it into nylon'; } } + function testCatchExceptions() + { + global $URI; + $f = new xmlrpcmsg('examples.raiseException', array( + new xmlrpcval('whatever', 'string') + )); + $v = $this->send($f, $GLOBALS['xmlrpcerr']['server_error']); + $this->client->path = $URI.'?EXCEPTION_HANDLING=1'; + $v = $this->send($f, 1); + $this->client->path = $URI.'?EXCEPTION_HANDLING=2'; + $v = $this->send($f, $GLOBALS['xmlrpcerr']['invalid_return']); + } + function testZeroParams() { $f = new xmlrpcmsg('system.listMethods'); @@ -617,7 +629,7 @@ And turned it into nylon'; global $failed_tests; foreach(get_class_methods('LocalhostTests') as $meth) { - if(strpos($meth, 'test') === 0 && $meth != 'testHttps') + if(strpos($meth, 'test') === 0 && $meth != 'testHttps' && $meth != 'testCatchExceptions') { if (!isset($failed_tests[$meth])) $this->$meth(); @@ -819,13 +831,13 @@ And turned it into nylon'; } function testUnicodeInMemberName(){ - $v = array('Günter, Elène' => new xmlrpcval(1)); + $v = array('G�nter, El�ne' => new xmlrpcval(1)); $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); $r = $r->serialize(); $m = new xmlrpcmsg('dummy'); $r = $m->parseResponse($r); $v = $r->value(); - $this->assertEquals($v->structmemexists('Günter, Elène'), true); + $this->assertEquals($v->structmemexists('G�nter, El�ne'), true); } function testUnicodeInErrorString() @@ -835,7 +847,7 @@ And turned it into nylon'; - + @@ -846,7 +858,7 @@ And turned it into nylon'; faultString -àüèàüè +���àüè @@ -855,7 +867,7 @@ And turned it into nylon'; $m=new xmlrpcmsg('dummy'); $r=$m->parseResponse($response); $v=$r->faultString(); - $this->assertEquals('àüèàüè', $v); + $this->assertEquals('������', $v); } function testValidNumbers() @@ -1203,19 +1215,19 @@ and there they were.postid7414222userid311127 -dateCreated20011126T09:17:52content'.utf8_encode('àüèàüè').'postid7414222 +dateCreated20011126T09:17:52content'.utf8_encode('������').'postid7414222 '; $r = $s->parseResponse($f, false, 'phpvals'); $v = $r->value(); $v = $v['content']; - $this->assertEquals("àüèàüè", $v); + $this->assertEquals("������", $v); $f = 'userid311127 -dateCreated20011126T09:17:52content'.utf8_encode('àüèàüè').'postid7414222 +dateCreated20011126T09:17:52content'.utf8_encode('������').'postid7414222 '; $r = $s->parseResponse($f, false, 'phpvals'); $v = $r->value(); $v = $v['content']; - $this->assertEquals("àüèàüè", $v); + $this->assertEquals("������", $v); } function testUTF8IntString() @@ -1347,7 +1359,6 @@ $f = 'client->send($f, 5, 'http11'); $ro = $r->value(); -var_dump($r); $this->assertEquals('hello', $ro->scalarVal()); } } @@ -1366,6 +1377,7 @@ var_dump($r); $suite->addTest(new LocalhostTests('testClientMulticall2')); $suite->addTest(new LocalhostTests('testClientMulticall3')); $suite->addTest(new LocalhostTests('testCatchWarnings')); + $suite->addTest(new LocalhostTests('testCatchExceptions')); $suite->addTest(new LocalhostTests('testZeroParams')); $suite->addTest(new LocalhostTests('testCodeInjectionServerSide')); $suite->addTest(new LocalhostTests('testAutoRegisteredFunction'));