Amf3Test.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_Serializer
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2012 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. /**
  23. * @see Zend_Serializer_Adapter_Amf3
  24. */
  25. require_once 'Zend/Serializer/Adapter/Amf3.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Serializer
  29. * @subpackage UnitTests
  30. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. */
  33. class Zend_Serializer_Adapter_Amf3Test extends PHPUnit_Framework_TestCase
  34. {
  35. private $_adapter;
  36. public function setUp()
  37. {
  38. $this->_adapter = new Zend_Serializer_Adapter_Amf3();
  39. }
  40. public function tearDown()
  41. {
  42. $this->_adapter = null;
  43. }
  44. /**
  45. * Simple test to serialize a value using Zend_Amf_Parser_Amf3_Serializer
  46. * -> This only tests the usage of Zend_Amf @see Zend_Amf_AllTests
  47. */
  48. public function testSerialize()
  49. {
  50. $value = true;
  51. $expected = "\x03"; // Amf3 -> true
  52. $data = $this->_adapter->serialize($value);
  53. $this->assertEquals($expected, $data);
  54. }
  55. /**
  56. * Simple test to unserialize a value using Zend_Amf_Parser_Amf3_Deserializer
  57. * -> This only tests the usage of Zend_Amf @see Zend_Amf_AllTests
  58. */
  59. public function testUnserialize()
  60. {
  61. $expected = true;
  62. $value = "\x03"; // Amf3 -> true
  63. $data = $this->_adapter->unserialize($value);
  64. $this->assertEquals($expected, $data);
  65. }
  66. }