objFromFixture('XMLDataFormatterTest_DataObject', 'test-do');
$xml = new SimpleXMLElement('' . $formatter->convertDataObjectWithoutHeader($obj));
$this->assertEquals(
Director::absoluteBaseURL() . sprintf('api/v1/XMLDataFormatterTest_DataObject/%d.xml', $obj->ID),
(string) $xml['href']
);
$this->assertEquals('Test DataObject', (string) $xml->Name);
$this->assertEquals('Test Company', (string) $xml->Company);
$this->assertEquals($obj->ID, (int) $xml->ID);
$this->assertEquals(
'mysite.com is a link in this HTML content. ]]>',
$xml->Content->asXML()
);
$this->assertEquals(
'mysite.com is a link in this HTML content. ',
(string) $xml->Content
);
}
}
class XMLDataFormatterTest_DataObject extends DataObject implements TestOnly {
public static $db = array(
'Name' => 'Varchar(50)',
'Company' => 'Varchar(50)',
'Content' => 'HTMLText'
);
}