public function getObjectAsXmlAction()
 {
     $entity = new RestApiBundleTestClass();
     $entity->setA('A');
     $entity->setB(1234);
     $entity->setC(false);
     return $entity;
 }
    public function testBuildSuccessfulXmlResponse()
    {
        $entity = new RestApiBundleTestClass();
        $entity->setA('A');
        $entity->setB(1234);
        $entity->setC(false);
        $response1 = $this->factory->buildSuccessfulResponse('xml', $entity);
        $this->assertEquals(200, $response1->getStatusCode());
        $expectedXml1 = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <a><![CDATA[A]]></a>
  <b>1234</b>
  <c>false</c>
</result>

EOF;
        $this->assertEquals($expectedXml1, $response1->getContent());
        $response2 = $this->factory->buildSuccessfulResponse('xml', null);
        $this->assertEquals(200, $response2->getStatusCode());
        $expectedXml2 = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>

EOF;
        $this->assertEquals($expectedXml2, $response2->getContent());
        $response3 = $this->factory->buildSuccessfulResponse('xml', true);
        $this->assertEquals(200, $response3->getStatusCode());
        $expectedXml3 = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<result>true</result>

EOF;
        $this->assertEquals($expectedXml3, $response3->getContent());
        $response4 = $this->factory->buildSuccessfulResponse('xml', array(1, 2, 3));
        $this->assertEquals(200, $response4->getStatusCode());
        $expectedXml4 = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <entry>1</entry>
  <entry>2</entry>
  <entry>3</entry>
</result>

EOF;
        $this->assertEquals($expectedXml4, $response4->getContent());
    }