ValueTest.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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_XmlRpc
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2009 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. // Call Zend_XmlRpc_ValueTest::main() if this source file is executed directly.
  23. if (!defined("PHPUnit_MAIN_METHOD")) {
  24. require_once dirname(__FILE__) . '/../../TestHelper.php';
  25. define("PHPUnit_MAIN_METHOD", "Zend_XmlRpc_ValueTest::main");
  26. }
  27. require_once "PHPUnit/Framework/TestCase.php";
  28. require_once "PHPUnit/Framework/TestSuite.php";
  29. require_once 'Zend/XmlRpc/Value.php';
  30. require_once 'Zend/XmlRpc/Value/Scalar.php';
  31. require_once 'Zend/XmlRpc/Value/Collection.php';
  32. require_once 'Zend/XmlRpc/Value/Array.php';
  33. require_once 'Zend/XmlRpc/Value/Base64.php';
  34. require_once 'Zend/XmlRpc/Value/Boolean.php';
  35. require_once 'Zend/XmlRpc/Value/DateTime.php';
  36. require_once 'Zend/XmlRpc/Value/Double.php';
  37. require_once 'Zend/XmlRpc/Value/Integer.php';
  38. require_once 'Zend/XmlRpc/Value/String.php';
  39. require_once 'Zend/XmlRpc/Value/Nil.php';
  40. require_once 'Zend/XmlRpc/Value/Struct.php';
  41. /**
  42. * Test case for Zend_XmlRpc_Value
  43. *
  44. * @category Zend
  45. * @package Zend_XmlRpc
  46. * @subpackage UnitTests
  47. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  48. * @license http://framework.zend.com/license/new-bsd New BSD License
  49. * @group Zend_XmlRpc
  50. */
  51. class Zend_XmlRpc_ValueTest extends PHPUnit_Framework_TestCase
  52. {
  53. /**
  54. * Runs the test methods of this class.
  55. *
  56. * @return void
  57. */
  58. public static function main()
  59. {
  60. require_once "PHPUnit/TextUI/TestRunner.php";
  61. $suite = new PHPUnit_Framework_TestSuite("Zend_XmlRpc_ValueTest");
  62. $result = PHPUnit_TextUI_TestRunner::run($suite);
  63. }
  64. // Boolean
  65. public function testFactoryAutodetectsBoolean()
  66. {
  67. foreach (array(true, false) as $native) {
  68. $val = Zend_XmlRpc_Value::getXmlRpcValue($native);
  69. $this->assertXmlRpcType('boolean', $val);
  70. }
  71. }
  72. public function testMarshalBooleanFromNative()
  73. {
  74. $native = true;
  75. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  76. Zend_XmlRpc_Value::XMLRPC_TYPE_BOOLEAN);
  77. $this->assertXmlRpcType('boolean', $val);
  78. $this->assertSame($native, $val->getValue());
  79. }
  80. public function testMarshalBooleanFromXmlRpc()
  81. {
  82. $xml = '<value><boolean>1</boolean></value>';
  83. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  84. Zend_XmlRpc_Value::XML_STRING);
  85. $this->assertXmlRpcType('boolean', $val);
  86. $this->assertEquals('boolean', $val->getType());
  87. $this->assertSame(true, $val->getValue());
  88. $this->assertType('DomElement', $val->getAsDOM());
  89. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  90. }
  91. // Integer
  92. public function testFactoryAutodetectsInteger()
  93. {
  94. $val = Zend_XmlRpc_Value::getXmlRpcValue(1);
  95. $this->assertXmlRpcType('integer', $val);
  96. }
  97. public function testMarshalIntegerFromNative()
  98. {
  99. $native = 1;
  100. $types = array(Zend_XmlRpc_Value::XMLRPC_TYPE_I4,
  101. Zend_XmlRpc_Value::XMLRPC_TYPE_INTEGER);
  102. foreach ($types as $type) {
  103. $val = Zend_XmlRpc_Value::getXmlRpcValue($native, $type);
  104. $this->assertXmlRpcType('integer', $val);
  105. $this->assertSame($native, $val->getValue());
  106. }
  107. }
  108. public function testMarshalIntegerFromXmlRpc()
  109. {
  110. $native = 1;
  111. $xmls = array("<value><int>$native</int></value>",
  112. "<value><i4>$native</i4></value>");
  113. foreach ($xmls as $xml) {
  114. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  115. Zend_XmlRpc_Value::XML_STRING);
  116. $this->assertXmlRpcType('integer', $val);
  117. $this->assertEquals('int', $val->getType());
  118. $this->assertSame($native, $val->getValue());
  119. $this->assertType('DomElement', $val->getAsDOM());
  120. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  121. }
  122. }
  123. /**
  124. * @group ZF-3310
  125. */
  126. public function testMarshalI4FromOverlongNativeThrowsException()
  127. {
  128. $this->setExpectedException('Zend_XmlRpc_Value_Exception', 'Overlong integer given');
  129. Zend_XmlRpc_Value::getXmlRpcValue(PHP_INT_MAX + 1, Zend_XmlRpc_Value::XMLRPC_TYPE_I4);
  130. }
  131. /**
  132. * @group ZF-3310
  133. */
  134. public function testMarshalIntegerFromOverlongNativeThrowsException()
  135. {
  136. $this->setExpectedException('Zend_XmlRpc_Value_Exception', 'Overlong integer given');
  137. Zend_XmlRpc_Value::getXmlRpcValue(PHP_INT_MAX + 1, Zend_XmlRpc_Value::XMLRPC_TYPE_INTEGER);
  138. }
  139. // Double
  140. public function testFactoryAutodetectsFloat()
  141. {
  142. $val = Zend_XmlRpc_Value::getXmlRpcValue((float)1);
  143. $this->assertXmlRpcType('double', $val);
  144. }
  145. public function testMarshalDoubleFromNative()
  146. {
  147. $native = 1.1;
  148. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  149. Zend_XmlRpc_Value::XMLRPC_TYPE_DOUBLE);
  150. $this->assertXmlRpcType('double', $val);
  151. $this->assertSame($native, $val->getValue());
  152. }
  153. public function testMarshalDoubleFromXmlRpc()
  154. {
  155. $native = 1.1;
  156. $xml = "<value><double>$native</double></value>";
  157. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  158. Zend_XmlRpc_Value::XML_STRING);
  159. $this->assertXmlRpcType('double', $val);
  160. $this->assertEquals('double', $val->getType());
  161. $this->assertSame($native, $val->getValue());
  162. $this->assertType('DomElement', $val->getAsDOM());
  163. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  164. }
  165. // String
  166. public function testFactoryAutodetectsString()
  167. {
  168. $val = Zend_XmlRpc_Value::getXmlRpcValue('');
  169. $this->assertXmlRpcType('string', $val);
  170. }
  171. public function testMarshalStringFromNative()
  172. {
  173. $native = 'foo';
  174. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  175. Zend_XmlRpc_Value::XMLRPC_TYPE_STRING);
  176. $this->assertXmlRpcType('string', $val);
  177. $this->assertSame($native, $val->getValue());
  178. }
  179. public function testMarshalStringFromXmlRpc()
  180. {
  181. $native = 'foo';
  182. $xml = "<value><string>$native</string></value>";
  183. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  184. Zend_XmlRpc_Value::XML_STRING);
  185. $this->assertXmlRpcType('string', $val);
  186. $this->assertEquals('string', $val->getType());
  187. $this->assertSame($native, $val->getValue());
  188. $this->assertType('DomElement', $val->getAsDOM());
  189. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  190. }
  191. public function testMarshalStringFromDefault()
  192. {
  193. $native = 'foo';
  194. $xml = "<string>$native</string>";
  195. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  196. Zend_XmlRpc_Value::XML_STRING);
  197. $this->assertXmlRpcType('string', $val);
  198. $this->assertEquals('string', $val->getType());
  199. $this->assertSame($native, $val->getValue());
  200. $this->assertType('DomElement', $val->getAsDOM());
  201. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  202. }
  203. //Nil
  204. public function testFactoryAutodetectsNil()
  205. {
  206. $val = Zend_XmlRpc_Value::getXmlRpcValue(NULL);
  207. $this->assertXmlRpcType('nil', $val);
  208. }
  209. public function testMarshalNilFromNative()
  210. {
  211. $native = NULL;
  212. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  213. Zend_XmlRpc_Value::XMLRPC_TYPE_NIL);
  214. $this->assertXmlRpcType('nil', $val);
  215. $this->assertSame($native, $val->getValue());
  216. }
  217. public function testMarshalNilFromXmlRpc()
  218. {
  219. $xml = '<value><nil/></value>';
  220. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  221. Zend_XmlRpc_Value::XML_STRING);
  222. $this->assertXmlRpcType('nil', $val);
  223. $this->assertEquals('nil', $val->getType());
  224. $this->assertSame(NULL, $val->getValue());
  225. $this->assertType('DomElement', $val->getAsDOM());
  226. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  227. }
  228. // Array
  229. public function testFactoryAutodetectsArray()
  230. {
  231. $val = Zend_XmlRpc_Value::getXmlRpcValue(array(0, 'foo'));
  232. $this->assertXmlRpcType('array', $val);
  233. }
  234. public function testMarshalArrayFromNative()
  235. {
  236. $native = array(0,1);
  237. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  238. Zend_XmlRpc_Value::XMLRPC_TYPE_ARRAY);
  239. $this->assertXmlRpcType('array', $val);
  240. $this->assertSame($native, $val->getValue());
  241. }
  242. public function testMarshalArrayFromXmlRpc()
  243. {
  244. $native = array(0,1);
  245. $xml = '<value><array><data><value><int>0</int></value>'
  246. . '<value><int>1</int></value></data></array></value>';
  247. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  248. Zend_XmlRpc_Value::XML_STRING);
  249. $this->assertXmlRpcType('array', $val);
  250. $this->assertEquals('array', $val->getType());
  251. $this->assertSame($native, $val->getValue());
  252. $this->assertType('DomElement', $val->getAsDOM());
  253. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  254. }
  255. public function testEmptyXmlRpcArrayResultsInEmptyArray()
  256. {
  257. $native = array();
  258. $xml = '<value><array><data/></array></value>';
  259. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  260. Zend_XmlRpc_Value::XML_STRING);
  261. $this->assertXmlRpcType('array', $val);
  262. $this->assertEquals('array', $val->getType());
  263. $this->assertSame($native, $val->getValue());
  264. $value = Zend_XmlRpc_Value::getXmlRpcValue($xml, Zend_XmlRpc_Value::XML_STRING);
  265. $this->assertXmlRpcType('array', $value);
  266. $this->assertEquals('array', $value->getType());
  267. $this->assertSame($native, $value->getValue());
  268. }
  269. public function testArrayMustContainDataElement()
  270. {
  271. $native = array();
  272. $xml = '<value><array/></value>';
  273. $this->setExpectedException('Zend_XmlRpc_Value_Exception',
  274. 'Invalid XML for XML-RPC native array type: ARRAY tag must contain DATA tag');
  275. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  276. Zend_XmlRpc_Value::XML_STRING);
  277. }
  278. /**
  279. * @group ZF-5405
  280. */
  281. public function testMarshalNilInStructWrappedInArray()
  282. {
  283. $expected = array(array('id' => '1', 'name' => 'vertebra, caudal', 'description' => null));
  284. $xml = '<value>'
  285. . '<array><data><value><struct><member><name>id</name><value><string>1</string></value></member>'
  286. . '<member><name>name</name><value><string>vertebra, caudal</string></value></member>'
  287. . '<member><name>description</name><value><nil/></value></member></struct></value></data></array>'
  288. . '</value>';
  289. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml, Zend_XmlRpc_Value::XML_STRING);
  290. $this->assertSame($expected, $val->getValue());
  291. }
  292. // Struct
  293. public function testFactoryAutodetectsStruct()
  294. {
  295. $val = Zend_XmlRpc_Value::getXmlRpcValue(array('foo' => 0));
  296. $this->assertXmlRpcType('struct', $val);
  297. }
  298. public function testFactoryAutodetectsStructFromObject()
  299. {
  300. $val = Zend_XmlRpc_Value::getXmlRpcValue((object)array('foo' => 0));
  301. $this->assertXmlRpcType('struct', $val);
  302. }
  303. public function testMarshalStructFromNative()
  304. {
  305. $native = array('foo' => 0);
  306. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  307. Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT);
  308. $this->assertXmlRpcType('struct', $val);
  309. $this->assertSame($native, $val->getValue());
  310. }
  311. public function testMarshalStructFromXmlRpc()
  312. {
  313. $native = array('foo' => 0);
  314. $xml = '<value><struct><member><name>foo</name><value><int>0</int>'
  315. . '</value></member></struct></value>';
  316. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  317. Zend_XmlRpc_Value::XML_STRING);
  318. $this->assertXmlRpcType('struct', $val);
  319. $this->assertEquals('struct', $val->getType());
  320. $this->assertSame($native, $val->getValue());
  321. $this->assertType('DomElement', $val->getAsDOM());
  322. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  323. }
  324. public function testMarshallingStructWithMemberWithoutValue()
  325. {
  326. $native = array('foo' => 0, 'bar' => 1);
  327. $xml = '<value><struct>'
  328. . '<member><name>foo</name><value><int>0</int></value></member>'
  329. . '<member><name>foo</name><bar/></member>'
  330. . '<member><name>bar</name><value><int>1</int></value></member>'
  331. . '</struct></value>';
  332. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  333. Zend_XmlRpc_Value::XML_STRING);
  334. $this->assertXmlRpcType('struct', $val);
  335. $this->assertEquals('struct', $val->getType());
  336. $this->assertSame($native, $val->getValue());
  337. $this->assertType('DomElement', $val->getAsDOM());
  338. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  339. }
  340. public function testMarshallingStructWithMemberWithoutName()
  341. {
  342. $native = array('foo' => 0, 'bar' => 1);
  343. $xml = '<value><struct>'
  344. . '<member><name>foo</name><value><int>0</int></value></member>'
  345. . '<member><value><string>foo</string></value></member>'
  346. . '<member><name>bar</name><value><int>1</int></value></member>'
  347. . '</struct></value>';
  348. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  349. Zend_XmlRpc_Value::XML_STRING);
  350. $this->assertXmlRpcType('struct', $val);
  351. $this->assertEquals('struct', $val->getType());
  352. $this->assertSame($native, $val->getValue());
  353. $this->assertType('DomElement', $val->getAsDOM());
  354. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  355. }
  356. /**
  357. * @group ZF-7639
  358. */
  359. public function testMarshalStructFromXmlRpcWithEntities()
  360. {
  361. $native = array('&nbsp;' => 0);
  362. $xml = '<value><struct><member><name>&amp;nbsp;</name><value><int>0</int>'
  363. . '</value></member></struct></value>';
  364. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml, Zend_XmlRpc_Value::XML_STRING);
  365. $this->assertXmlRpcType('struct', $val);
  366. $this->assertSame($native, $val->getValue());
  367. $this->assertSame($this->wrapXml($xml), $val->saveXML());
  368. }
  369. /**
  370. * @group ZF-3947
  371. */
  372. public function testMarshallingStructsWithEmptyValueFromXmlRpcShouldRetainKeys()
  373. {
  374. $native = array('foo' => '');
  375. $xml = '<value><struct><member><name>foo</name>'
  376. . '<value/></member></struct></value>';
  377. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  378. Zend_XmlRpc_Value::XML_STRING);
  379. $this->assertXmlRpcType('struct', $val);
  380. $this->assertEquals('struct', $val->getType());
  381. $this->assertSame($native, $val->getValue());
  382. $this->assertType('DomElement', $val->getAsDOM());
  383. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  384. }
  385. // DateTime
  386. public function testMarshalDateTimeFromNativeString()
  387. {
  388. $native = '1997-07-16T19:20+01:00';
  389. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  390. Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME);
  391. $this->assertXmlRpcType('dateTime', $val);
  392. $expected = '1997-07-16T19:20+01:00';
  393. $this->assertSame(strtotime($native), strtotime($val->getValue()));
  394. }
  395. public function testMarshalDateTimeFromNativeStringProducesIsoOutput()
  396. {
  397. $native = '1997-07-16T19:20+01:00';
  398. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  399. Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME);
  400. $this->assertXmlRpcType('dateTime', $val);
  401. $expected = date('c', strtotime($native));
  402. $expected = substr($expected, 0, strlen($expected) - 6);
  403. $expected = str_replace('-', '', $expected);
  404. $received = $val->getValue();
  405. $this->assertEquals($expected, $received);
  406. }
  407. public function testMarshalDateTimeFromInvalidString()
  408. {
  409. $this->setExpectedException('Zend_XmlRpc_Value_Exception',
  410. "Cannot convert given value 'foobarbaz' to a timestamp");
  411. Zend_XmlRpc_Value::getXmlRpcValue('foobarbaz', Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME);
  412. }
  413. public function testMarshalDateTimeFromNativeInteger()
  414. {
  415. $native = strtotime('1997-07-16T19:20+01:00');
  416. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  417. Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME);
  418. $this->assertXmlRpcType('dateTime', $val);
  419. $this->assertSame($native, strtotime($val->getValue()));
  420. }
  421. public function testMarshalDateTimeFromXmlRpc()
  422. {
  423. $iso8601 = '1997-07-16T19:20+01:00';
  424. $xml = "<value><dateTime.iso8601>$iso8601</dateTime.iso8601></value>";
  425. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  426. Zend_XmlRpc_Value::XML_STRING);
  427. $this->assertXmlRpcType('dateTime', $val);
  428. $this->assertEquals('dateTime.iso8601', $val->getType());
  429. $this->assertSame(strtotime($iso8601), strtotime($val->getValue()));
  430. $this->assertType('DomElement', $val->getAsDOM());
  431. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  432. }
  433. // Base64
  434. public function testMarshalBase64FromString()
  435. {
  436. $native = 'foo';
  437. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  438. Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64);
  439. $this->assertXmlRpcType('base64', $val);
  440. $this->assertSame($native, $val->getValue());
  441. }
  442. public function testMarshalBase64FromXmlRpc()
  443. {
  444. $native = 'foo';
  445. $xml = '<value><base64>' .base64_encode($native). '</base64></value>';
  446. $val = Zend_XmlRpc_Value::getXmlRpcValue($xml,
  447. Zend_XmlRpc_Value::XML_STRING);
  448. $this->assertXmlRpcType('base64', $val);
  449. $this->assertEquals('base64', $val->getType());
  450. $this->assertSame($native, $val->getValue());
  451. $this->assertType('DomElement', $val->getAsDOM());
  452. $this->assertEquals($this->wrapXml($xml), $val->saveXML());
  453. }
  454. public function testXmlRpcValueBase64GeneratedXmlContainsBase64EncodedText()
  455. {
  456. $native = 'foo';
  457. $val = Zend_XmlRpc_Value::getXmlRpcValue($native,
  458. Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64);
  459. $this->assertXmlRpcType('base64', $val);
  460. $xml = $val->saveXML();
  461. $encoded = base64_encode($native);
  462. $this->assertContains($encoded, $xml);
  463. }
  464. // Exceptions
  465. public function testFactoryThrowsWhenInvalidTypeSpecified()
  466. {
  467. try {
  468. Zend_XmlRpc_Value::getXmlRpcValue('', 'bad type here');
  469. $this->fail();
  470. } catch (Exception $e) {
  471. $this->assertRegexp('/given type is not/i', $e->getMessage());
  472. }
  473. }
  474. // Custom Assertions and Helper Methods
  475. public function assertXmlRpcType($type, $object)
  476. {
  477. $type = 'Zend_XmlRpc_Value_' . ucfirst($type);
  478. $this->assertType($type, $object);
  479. }
  480. public function wrapXml($xml)
  481. {
  482. return "<?xml version=\"1.0\"?>\n$xml\n";
  483. }
  484. }
  485. // Call Zend_XmlRpc_ValueTest::main() if this source file is executed directly.
  486. if (PHPUnit_MAIN_METHOD == "Zend_XmlRpc_ValueTest::main") {
  487. Zend_XmlRpc_ValueTest::main();
  488. }