OnlineTest.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. require_once dirname(__FILE__)."/../../../TestHelper.php";
  3. require_once dirname(__FILE__)."/../_files/commontypes.php";
  4. /** Zend_Soap_Server */
  5. require_once 'Zend/Soap/Client.php';
  6. class Zend_Soap_AutoDiscover_OnlineTest extends PHPUnit_Framework_TestCase
  7. {
  8. protected $baseuri;
  9. public function setUp()
  10. {
  11. if(!defined('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI') || constant('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI') == false) {
  12. $this->markTestSkipped('The constant TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI has to be defined to allow the Online test to work.');
  13. }
  14. $this->baseuri = TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI;
  15. }
  16. public function testNestedObjectArrayResponse()
  17. {
  18. $wsdl = $this->baseuri."/server1.php?wsdl";
  19. $b = new Zend_Soap_Wsdl_ComplexTypeB();
  20. $b->bar = "test";
  21. $b->foo = "test";
  22. $client = new Zend_Soap_Client($wsdl);
  23. $ret = $client->request($b);
  24. $this->assertTrue( is_array($ret) );
  25. $this->assertEquals(1, count($ret) );
  26. $this->assertTrue( is_array($ret[0]->baz) );
  27. $this->assertEquals(3, count($ret[0]->baz) );
  28. $baz = $ret[0]->baz;
  29. $this->assertEquals("bar", $baz[0]->bar);
  30. $this->assertEquals("bar", $baz[0]->foo);
  31. $this->assertEquals("foo", $baz[1]->bar);
  32. $this->assertEquals("foo", $baz[1]->foo);
  33. $this->assertEquals("test", $baz[2]->bar);
  34. $this->assertEquals("test", $baz[2]->foo);
  35. }
  36. public function testObjectResponse()
  37. {
  38. $wsdl = $this->baseuri."/server2.php?wsdl";
  39. $client = new Zend_Soap_Client($wsdl);
  40. $ret = $client->request("test", "test");
  41. $this->assertTrue( ($ret instanceof stdClass) );
  42. $this->assertEquals("test", $ret->foo);
  43. $this->assertEquals("test", $ret->bar);
  44. }
  45. }