ClientTest.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Soap
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. if (!defined('PHPUnit_MAIN_METHOD')) {
  23. define('PHPUnit_MAIN_METHOD', 'Zend_Soap_ClientTest::main');
  24. }
  25. /** Zend_Soap_Server */
  26. require_once 'Zend/Soap/Server.php';
  27. /** Zend_Soap_Client */
  28. require_once 'Zend/Soap/Client.php';
  29. require_once 'Zend/Config.php';
  30. /**
  31. * @category Zend
  32. * @package Zend_Soap
  33. * @subpackage UnitTests
  34. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. * @group Zend_Soap
  37. */
  38. class Zend_Soap_ClientTest extends PHPUnit_Framework_TestCase
  39. {
  40. /**
  41. * Runs this test suite
  42. *
  43. * @return void
  44. */
  45. public static function main()
  46. {
  47. $suite = new PHPUnit_Framework_TestSuite(__CLASS__);
  48. $result = PHPUnit_TextUI_TestRunner::run($suite);
  49. }
  50. public function setUp()
  51. {
  52. if (!extension_loaded('soap')) {
  53. $this->markTestSkipped('SOAP Extension is not loaded');
  54. }
  55. }
  56. public function testSetOptions()
  57. {
  58. /*************************************************************
  59. * ------ Test WSDL mode options -----------------------------
  60. *************************************************************/
  61. $client = new Zend_Soap_Client();
  62. $this->assertTrue($client->getOptions() == array('encoding' => 'UTF-8', 'soap_version' => SOAP_1_2));
  63. $ctx = stream_context_create();
  64. $nonWsdlOptions = array('soap_version' => SOAP_1_1,
  65. 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1',
  66. 'TestData2' => 'Zend_Soap_Client_TestData2',),
  67. 'encoding' => 'ISO-8859-1',
  68. 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php',
  69. 'location' => 'http://framework.zend.com/Zend_Soap_ServerTest.php',
  70. 'use' => SOAP_ENCODED,
  71. 'style' => SOAP_RPC,
  72. 'login' => 'http_login',
  73. 'password' => 'http_password',
  74. 'proxy_host' => 'proxy.somehost.com',
  75. 'proxy_port' => 8080,
  76. 'proxy_login' => 'proxy_login',
  77. 'proxy_password' => 'proxy_password',
  78. 'local_cert' => dirname(__FILE__).'/_files/cert_file',
  79. 'passphrase' => 'some pass phrase',
  80. 'stream_context' => $ctx,
  81. 'cache_wsdl' => 8,
  82. 'features' => 4,
  83. 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5);
  84. $client->setOptions($nonWsdlOptions);
  85. $this->assertTrue($client->getOptions() == $nonWsdlOptions);
  86. /*************************************************************
  87. * ------ Test non-WSDL mode options -----------------------------
  88. *************************************************************/
  89. $client1 = new Zend_Soap_Client();
  90. $this->assertTrue($client1->getOptions() == array('encoding' => 'UTF-8', 'soap_version' => SOAP_1_2));
  91. $wsdlOptions = array('soap_version' => SOAP_1_1,
  92. 'wsdl' => dirname(__FILE__).'/_files/wsdl_example.wsdl',
  93. 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1',
  94. 'TestData2' => 'Zend_Soap_Client_TestData2',),
  95. 'encoding' => 'ISO-8859-1',
  96. 'login' => 'http_login',
  97. 'password' => 'http_password',
  98. 'proxy_host' => 'proxy.somehost.com',
  99. 'proxy_port' => 8080,
  100. 'proxy_login' => 'proxy_login',
  101. 'proxy_password' => 'proxy_password',
  102. 'local_cert' => dirname(__FILE__).'/_files/cert_file',
  103. 'passphrase' => 'some pass phrase',
  104. 'stream_context' => $ctx,
  105. 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5);
  106. $client1->setOptions($wsdlOptions);
  107. $this->assertTrue($client1->getOptions() == $wsdlOptions);
  108. }
  109. public function testGetOptions()
  110. {
  111. $client = new Zend_Soap_Client();
  112. $this->assertTrue($client->getOptions() == array('encoding' => 'UTF-8', 'soap_version' => SOAP_1_2));
  113. $options = array('soap_version' => SOAP_1_1,
  114. 'wsdl' => dirname(__FILE__).'/_files/wsdl_example.wsdl',
  115. 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1',
  116. 'TestData2' => 'Zend_Soap_Client_TestData2',),
  117. 'encoding' => 'ISO-8859-1',
  118. 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php',
  119. 'location' => 'http://framework.zend.com/Zend_Soap_ServerTest.php',
  120. 'use' => SOAP_ENCODED,
  121. 'style' => SOAP_RPC,
  122. 'login' => 'http_login',
  123. 'password' => 'http_password',
  124. 'proxy_host' => 'proxy.somehost.com',
  125. 'proxy_port' => 8080,
  126. 'proxy_login' => 'proxy_login',
  127. 'proxy_password' => 'proxy_password',
  128. 'local_cert' => dirname(__FILE__).'/_files/cert_file',
  129. 'passphrase' => 'some pass phrase',
  130. 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5);
  131. $client->setOptions($options);
  132. $this->assertTrue($client->getOptions() == $options);
  133. }
  134. /**
  135. * @group ZF-8053
  136. */
  137. public function testGetAndSetUserAgentOption()
  138. {
  139. $client = new Zend_Soap_Client();
  140. $this->assertNull($client->getUserAgent());
  141. $client->setUserAgent('agent1');
  142. $this->assertEquals('agent1', $client->getUserAgent());
  143. $client->setOptions(array(
  144. 'user_agent' => 'agent2'
  145. ));
  146. $this->assertEquals('agent2', $client->getUserAgent());
  147. $client->setOptions(array(
  148. 'useragent' => 'agent3'
  149. ));
  150. $this->assertEquals('agent3', $client->getUserAgent());
  151. $client->setOptions(array(
  152. 'userAgent' => 'agent4'
  153. ));
  154. $this->assertEquals('agent4', $client->getUserAgent());
  155. $options = $client->getOptions();
  156. $this->assertEquals('agent4', $options['user_agent']);
  157. }
  158. /**
  159. * @group ZF-6954
  160. */
  161. public function testUserAgentAllowsEmptyString()
  162. {
  163. $client = new Zend_Soap_Client();
  164. $this->assertNull($client->getUserAgent());
  165. $options = $client->getOptions();
  166. $this->assertArrayNotHasKey('user_agent', $options);
  167. $client->setUserAgent('');
  168. $this->assertEquals('', $client->getUserAgent());
  169. $options = $client->getOptions();
  170. $this->assertEquals('', $options['user_agent']);
  171. $client->setUserAgent(null);
  172. $this->assertNull($client->getUserAgent());
  173. $options = $client->getOptions();
  174. $this->assertArrayNotHasKey('user_agent', $options);
  175. }
  176. /**
  177. * @group ZF-10542
  178. */
  179. public function testAllowNumericZeroAsValueForCacheWsdlOption()
  180. {
  181. $client = new Zend_Soap_Client();
  182. $this->assertNull($client->getWsdlCache());
  183. $options = $client->getOptions();
  184. $this->assertArrayNotHasKey('cache_wsdl', $options);
  185. $client->setWsdlCache(WSDL_CACHE_NONE);
  186. $this->assertSame(WSDL_CACHE_NONE, $client->getWsdlCache());
  187. $options = $client->getOptions();
  188. $this->assertSame(WSDL_CACHE_NONE, $options['cache_wsdl']);
  189. $client->setWsdlCache(null);
  190. $this->assertNull($client->getWsdlCache());
  191. $options = $client->getOptions();
  192. $this->assertArrayNotHasKey('cache_wsdl', $options);
  193. }
  194. /**
  195. * @group ZF-10542
  196. */
  197. public function testAllowNumericZeroAsValueForCompressionOptions()
  198. {
  199. $client = new Zend_Soap_Client();
  200. $this->assertNull($client->getCompressionOptions());
  201. $options = $client->getOptions();
  202. $this->assertArrayNotHasKey('compression', $options);
  203. $client->setCompressionOptions(SOAP_COMPRESSION_GZIP);
  204. $this->assertSame(SOAP_COMPRESSION_GZIP, $client->getCompressionOptions());
  205. $options = $client->getOptions();
  206. $this->assertSame(SOAP_COMPRESSION_GZIP, $options['compression']);
  207. $client->setCompressionOptions(null);
  208. $this->assertNull($client->getCompressionOptions());
  209. $options = $client->getOptions();
  210. $this->assertArrayNotHasKey('compression', $options);
  211. }
  212. /**
  213. * @group GH-32
  214. */
  215. public function testGetAndSetExceptionsOption()
  216. {
  217. $client = new Zend_Soap_Client();
  218. $this->assertNull($client->getExceptions());
  219. $this->assertEquals(
  220. array(
  221. 'encoding' => 'UTF-8',
  222. 'soap_version' => 2,
  223. ),
  224. $client->getOptions()
  225. );
  226. $client->setExceptions(true);
  227. $this->assertTrue($client->getExceptions());
  228. $client->setExceptions(false);
  229. $this->assertFalse($client->getExceptions());
  230. $client->setOptions(array('exceptions' => true));
  231. $this->assertTrue($client->getExceptions());
  232. $client = new Zend_Soap_Client(null, array('exceptions' => false));
  233. $this->assertFalse($client->getExceptions());
  234. $this->assertEquals(
  235. array(
  236. 'encoding' => 'UTF-8',
  237. 'soap_version' => 2,
  238. 'exceptions' => false,
  239. ),
  240. $client->getOptions()
  241. );
  242. }
  243. public function testGetFunctions()
  244. {
  245. $server = new Zend_Soap_Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  246. $server->setClass('Zend_Soap_Client_TestClass');
  247. $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  248. $this->assertTrue($client->getFunctions() == array('string testFunc1()',
  249. 'string testFunc2(string $who)',
  250. 'string testFunc3(string $who, int $when)',
  251. 'string testFunc4()'));
  252. }
  253. /**
  254. * @todo Implement testGetTypes().
  255. */
  256. public function testGetTypes()
  257. {
  258. // Remove the following line when you implement this test.
  259. $this->markTestIncomplete(
  260. "This test has not been implemented yet."
  261. );
  262. }
  263. public function testGetLastRequest()
  264. {
  265. if (headers_sent()) {
  266. $this->markTestSkipped('Cannot run testGetLastRequest() when headers have already been sent; enable output buffering to run this test');
  267. return;
  268. }
  269. $server = new Zend_Soap_Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  270. $server->setClass('Zend_Soap_Client_TestClass');
  271. $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  272. // Perform request
  273. $client->testFunc2('World');
  274. $expectedRequest = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
  275. . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" '
  276. . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
  277. . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
  278. . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">'
  279. . '<env:Body>'
  280. . '<env:testFunc2 env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">'
  281. . '<who xsi:type="xsd:string">World</who>'
  282. . '</env:testFunc2>'
  283. . '</env:Body>'
  284. . '</env:Envelope>' . "\n";
  285. $this->assertEquals($client->getLastRequest(), $expectedRequest);
  286. }
  287. public function testGetLastResponse()
  288. {
  289. if (headers_sent()) {
  290. $this->markTestSkipped('Cannot run testGetLastResponse() when headers have already been sent; enable output buffering to run this test');
  291. return;
  292. }
  293. $server = new Zend_Soap_Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  294. $server->setClass('Zend_Soap_Client_TestClass');
  295. $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  296. // Perform request
  297. $client->testFunc2('World');
  298. $expectedResponse = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
  299. . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" '
  300. . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
  301. . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
  302. . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">'
  303. . '<env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">'
  304. . '<env:testFunc2Response env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">'
  305. . '<rpc:result>testFunc2Return</rpc:result>'
  306. . '<testFunc2Return xsi:type="xsd:string">Hello World!</testFunc2Return>'
  307. . '</env:testFunc2Response>'
  308. . '</env:Body>'
  309. . '</env:Envelope>' . "\n";
  310. $this->assertEquals($client->getLastResponse(), $expectedResponse);
  311. }
  312. public function testCallInvoke()
  313. {
  314. if (headers_sent()) {
  315. $this->markTestSkipped('Cannot run testCallInvoke() when headers have already been sent; enable output buffering to run this test');
  316. return;
  317. }
  318. $server = new Zend_Soap_Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  319. $server->setClass('Zend_Soap_Client_TestClass');
  320. $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  321. $this->assertEquals($client->testFunc2('World'), 'Hello World!');
  322. }
  323. public function testSetOptionsWithZendConfig()
  324. {
  325. $ctx = stream_context_create();
  326. $nonWsdlOptions = array('soap_version' => SOAP_1_1,
  327. 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1',
  328. 'TestData2' => 'Zend_Soap_Client_TestData2',),
  329. 'encoding' => 'ISO-8859-1',
  330. 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php',
  331. 'location' => 'http://framework.zend.com/Zend_Soap_ServerTest.php',
  332. 'use' => SOAP_ENCODED,
  333. 'style' => SOAP_RPC,
  334. 'login' => 'http_login',
  335. 'password' => 'http_password',
  336. 'proxy_host' => 'proxy.somehost.com',
  337. 'proxy_port' => 8080,
  338. 'proxy_login' => 'proxy_login',
  339. 'proxy_password' => 'proxy_password',
  340. 'local_cert' => dirname(__FILE__).'/_files/cert_file',
  341. 'passphrase' => 'some pass phrase',
  342. 'stream_context' => $ctx,
  343. 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5
  344. );
  345. $config = new Zend_Config($nonWsdlOptions);
  346. $client = new Zend_Soap_Client(null, $config);
  347. $this->assertEquals($nonWsdlOptions, $client->getOptions());
  348. }
  349. public function testSetInputHeaders()
  350. {
  351. if (headers_sent()) {
  352. $this->markTestSkipped('Cannot run testSetInputHeaders() when headers have already been sent; enable output buffering to run this test');
  353. return;
  354. }
  355. $server = new Zend_Soap_Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  356. $server->setClass('Zend_Soap_Client_TestClass');
  357. $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl');
  358. // Add request header
  359. $client->addSoapInputHeader(new SoapHeader('http://www.example.com/namespace', 'MyHeader1', 'SOAP header content 1'));
  360. // Add permanent request header
  361. $client->addSoapInputHeader(new SoapHeader('http://www.example.com/namespace', 'MyHeader2', 'SOAP header content 2'), true);
  362. // Perform request
  363. $client->testFunc2('World');
  364. $expectedRequest = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
  365. . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" '
  366. . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
  367. . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
  368. . 'xmlns:ns1="http://www.example.com/namespace" '
  369. . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">'
  370. . '<env:Header>'
  371. . '<ns1:MyHeader2>SOAP header content 2</ns1:MyHeader2>'
  372. . '<ns1:MyHeader1>SOAP header content 1</ns1:MyHeader1>'
  373. . '</env:Header>'
  374. . '<env:Body>'
  375. . '<env:testFunc2 env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">'
  376. . '<who xsi:type="xsd:string">World</who>'
  377. . '</env:testFunc2>'
  378. . '</env:Body>'
  379. . '</env:Envelope>' . "\n";
  380. $this->assertEquals($client->getLastRequest(), $expectedRequest);
  381. // Add request header
  382. $client->addSoapInputHeader(new SoapHeader('http://www.example.com/namespace', 'MyHeader3', 'SOAP header content 3'));
  383. // Perform request
  384. $client->testFunc2('World');
  385. $expectedRequest = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
  386. . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" '
  387. . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
  388. . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
  389. . 'xmlns:ns1="http://www.example.com/namespace" '
  390. . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">'
  391. . '<env:Header>'
  392. . '<ns1:MyHeader2>SOAP header content 2</ns1:MyHeader2>'
  393. . '<ns1:MyHeader3>SOAP header content 3</ns1:MyHeader3>'
  394. . '</env:Header>'
  395. . '<env:Body>'
  396. . '<env:testFunc2 env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">'
  397. . '<who xsi:type="xsd:string">World</who>'
  398. . '</env:testFunc2>'
  399. . '</env:Body>'
  400. . '</env:Envelope>' . "\n";
  401. $this->assertEquals($client->getLastRequest(), $expectedRequest);
  402. $client->resetSoapInputHeaders();
  403. // Add request header
  404. $client->addSoapInputHeader(new SoapHeader('http://www.example.com/namespace', 'MyHeader4', 'SOAP header content 4'));
  405. // Perform request
  406. $client->testFunc2('World');
  407. $expectedRequest = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
  408. . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" '
  409. . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
  410. . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
  411. . 'xmlns:ns1="http://www.example.com/namespace" '
  412. . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">'
  413. . '<env:Header>'
  414. . '<ns1:MyHeader4>SOAP header content 4</ns1:MyHeader4>'
  415. . '</env:Header>'
  416. . '<env:Body>'
  417. . '<env:testFunc2 env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">'
  418. . '<who xsi:type="xsd:string">World</who>'
  419. . '</env:testFunc2>'
  420. . '</env:Body>'
  421. . '</env:Envelope>' . "\n";
  422. $this->assertEquals($client->getLastRequest(), $expectedRequest);
  423. }
  424. /**
  425. * @group ZF-6955
  426. */
  427. public function testSetCookieIsDelegatedToSoapClient()
  428. {
  429. $fixtureCookieKey = "foo";
  430. $fixtureCookieValue = "bar";
  431. $clientMock = $this->getMock('SoapClient', array('__setCookie'), array(null, array('uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com')));
  432. $clientMock->expects($this->once())
  433. ->method('__setCookie')
  434. ->with($fixtureCookieKey, $fixtureCookieValue);
  435. $soap = new Zend_Soap_Client();
  436. $soap->setSoapClient($clientMock);
  437. $soap->setCookie($fixtureCookieKey, $fixtureCookieValue);
  438. }
  439. public function testSetSoapClient()
  440. {
  441. $clientMock = $this->getMock('SoapClient', array('__setCookie'), array(null, array('uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com')));
  442. $soap = new Zend_Soap_Client();
  443. $soap->setSoapClient($clientMock);
  444. $this->assertSame($clientMock, $soap->getSoapClient());
  445. }
  446. }
  447. /** Test Class */
  448. class Zend_Soap_Client_TestClass {
  449. /**
  450. * Test Function 1
  451. *
  452. * @return string
  453. */
  454. function testFunc1()
  455. {
  456. return "Hello World";
  457. }
  458. /**
  459. * Test Function 2
  460. *
  461. * @param string $who Some Arg
  462. * @return string
  463. */
  464. function testFunc2($who)
  465. {
  466. return "Hello $who!";
  467. }
  468. /**
  469. * Test Function 3
  470. *
  471. * @param string $who Some Arg
  472. * @param int $when Some
  473. * @return string
  474. */
  475. function testFunc3($who, $when)
  476. {
  477. return "Hello $who, How are you $when";
  478. }
  479. /**
  480. * Test Function 4
  481. *
  482. * @return string
  483. */
  484. static function testFunc4()
  485. {
  486. return "I'm Static!";
  487. }
  488. }
  489. /** Test class 2 */
  490. class Zend_Soap_Client_TestData1 {
  491. /**
  492. * Property1
  493. *
  494. * @var string
  495. */
  496. public $property1;
  497. /**
  498. * Property2
  499. *
  500. * @var float
  501. */
  502. public $property2;
  503. }
  504. /** Test class 2 */
  505. class Zend_Soap_Client_TestData2 {
  506. /**
  507. * Property1
  508. *
  509. * @var integer
  510. */
  511. public $property1;
  512. /**
  513. * Property1
  514. *
  515. * @var float
  516. */
  517. public $property2;
  518. }
  519. /* Test Functions */
  520. /**
  521. * Test Function
  522. *
  523. * @param string $arg
  524. * @return string
  525. */
  526. function Zend_Soap_Client_TestFunc1($who)
  527. {
  528. return "Hello $who";
  529. }
  530. /**
  531. * Test Function 2
  532. */
  533. function Zend_Soap_Client_TestFunc2()
  534. {
  535. return "Hello World";
  536. }
  537. /**
  538. * Return false
  539. *
  540. * @return bool
  541. */
  542. function Zend_Soap_Client_TestFunc3()
  543. {
  544. return false;
  545. }
  546. /**
  547. * Return true
  548. *
  549. * @return bool
  550. */
  551. function Zend_Soap_Client_TestFunc4()
  552. {
  553. return true;
  554. }
  555. /**
  556. * Return integer
  557. *
  558. * @return int
  559. */
  560. function Zend_Soap_Client_TestFunc5()
  561. {
  562. return 123;
  563. }
  564. /**
  565. * Return string
  566. *
  567. * @return string
  568. */
  569. function Zend_Soap_Client_TestFunc6()
  570. {
  571. return "string";
  572. }
  573. if (PHPUnit_MAIN_METHOD == 'Zend_Soap_ClientTest::main') {
  574. Zend_Soap_ClientTest::main();
  575. }