* @author Chuck Burgess */ require_once 'XML/Serializer.php'; /** * Unit Tests for serializing arrays * * @package XML_Serializer * @subpackage tests * @author Stephan Schmidt * @author Chuck Burgess */ class XML_Serializer_Arrays_TestCase extends PHPUnit_Framework_TestCase { private $options = array( XML_SERIALIZER_OPTION_INDENT => '', XML_SERIALIZER_OPTION_LINEBREAKS => '', ); /** * Test serializing a numbered array */ public function testNumberedArray() { $s = new XML_Serializer($this->options); $s->serialize(array('one', 'two', 'three')); $this->assertEquals( 'onetwothree' , $s->getSerializedData() ); } /** * Test serializing an assoc array */ public function testAssocArray() { $s = new XML_Serializer($this->options); $s->serialize(array('one' => 'foo', 'two' => 'bar')); $this->assertEquals( 'foobar' , $s->getSerializedData() ); } /** * Test serializing an mixed array */ public function testMixedArray() { $s = new XML_Serializer($this->options); $s->serialize(array('one' => 'foo', 'two' => 'bar', 'three')); $this->assertEquals( 'foobarthree' , $s->getSerializedData() ); } } ?>