Doctrine\Tests\OXM\Marshaller\CollectionsTest::collectionWrapsXmlText PHP Method

collectionWrapsXmlText() public method

    public function collectionWrapsXmlText()
    {
        $wrapper = new Wrapper();
        $wrapper->list = array('red', 'green', 'blue');
        $wrapper->enum = array('one', 'two', 'three', 'four');
        $xml = $this->marshaller->marshalToString($wrapper);
        $this->assertXmlStringEqualsXmlString('<wrapper xmlns:prfx="http://www.foo.bar.baz.com/schema">
            <foo>
                <list>red</list>
                <list>green</list>
                <list>blue</list>
            </foo>
            <prfx:bar>
                <prfx:enum>one</prfx:enum>
                <prfx:enum>two</prfx:enum>
                <prfx:enum>three</prfx:enum>
                <prfx:enum>four</prfx:enum>
            </prfx:bar>
        </wrapper>', $xml);
        $otherWrapper = $this->marshaller->unmarshalFromString($xml);
        $this->assertEquals(3, count($otherWrapper->list));
        $this->assertContains('red', $otherWrapper->list);
        $this->assertContains('green', $otherWrapper->list);
        $this->assertContains('blue', $otherWrapper->list);
        $this->assertEquals(4, count($otherWrapper->enum));
        $this->assertContains('one', $otherWrapper->enum);
        $this->assertContains('two', $otherWrapper->enum);
        $this->assertContains('three', $otherWrapper->enum);
        $this->assertContains('four', $otherWrapper->enum);
    }