public function BiblioImportExportWebTestCase::testBiblioBibtexFileImport in Bibliography Module 7
File
- tests/
BiblioImportExportWebTestCase.test, line 138
Class
- BiblioImportExportWebTestCase
- Web tests for import/export.
Code
public function testBiblioBibtexFileImport() {
$file = file_save_data($this
->getBibTexString());
$context = array();
biblio_import($file, 'biblio_bibtex', 1, NULL, FALSE, NULL, $context);
$nids = $context['results']['nids'];
array_merge($this->nids, $nids);
$this
->assertEqual(count($nids), 1, 'Imported 1 BibTeX entry');
file_delete($file);
$node = $this
->createNode();
$fields = array_filter(biblio_get_map('field_map', 'bibtex'));
$fields += array(
'title',
'biblio_contributors',
);
foreach ($nids as $nid) {
$this->nids[] = $nid;
$imported_node = node_load($nid);
$this
->assertBiblioFields($node, $imported_node, $fields);
}
}