/** * @see FunctionalDoiExportTest::cleanXml() */ protected function cleanXml($xml) { // Fix URLs. $xml = String::regexp_replace('#http://[^\\s]+/index.php/(test|index)#', 'http://example.com/index.php/test', $xml); // Fix sent date. $xml = String::regexp_replace('/<SentDate>[0-9]{12}<\\/SentDate>/', '<SentDate>201111082218</SentDate>', $xml); // Fix version. $xml = String::regexp_replace('/(<MessageNote>[^<]*)([0-9]\\.){4}(<\\/MessageNote>)/', '\\1x.x.x.x.\\3', $xml); return parent::cleanXml($xml); }
/** * @see FunctionalDoiExportTest::cleanXml() */ protected function cleanXml($xml) { // Fix missing translations. $xml = str_replace('##editor.issues.pages##', 'Pages', $xml); // Fix modified date. if (strpos($xml, '<date dateType="Updated">') !== false) { // We have to fix the modified date as it changes // too often (e.g. by using the test server manually) // to be controlled reliably. // Make sure we got the actual modified date but // replace it with the modified date in the sample data // so that our tests do not bail. $articleDao = DAORegistry::getDAO('ArticleDAO'); /* @var $articleDao ArticleDAO */ $article = $articleDao->getById(1); $modifiedDate = date('Y-m-d', strtotime($article->getLastModified())); $xml = str_replace('<date dateType="Updated">' . $modifiedDate, '<date dateType="Updated">2011-12-09', $xml); } return parent::cleanXml($xml); }