You are here

public function BiblioImportExportWebTestCase::testBiblioXMLFileImport in Bibliography Module 7

File

tests/BiblioImportExportWebTestCase.test, line 96

Class

BiblioImportExportWebTestCase
Web tests for import/export.

Code

public function testBiblioXMLFileImport() {
  $file = file_save_data($this
    ->getXMLString());
  $context = array();
  biblio_import($file, 'biblio_xml', 1, NULL, FALSE, NULL, $context);
  $nids = $context['results']['nids'];
  array_merge($this->nids, $nids);
  $this
    ->assertEqual(count($nids), 1, 'Imported 1 EndNote XML entry');
  file_delete($file);
  $node = $this
    ->createNode();
  $fields = array_filter(biblio_get_map('field_map', 'endnote8'));
  $fields += array(
    'title',
    'biblio_contributors',
    'biblio_keywords',
  );
  foreach ($nids as $nid) {
    $this->nids[] = $nid;
    $imported_node = node_load($nid);
    $this
      ->assertBiblioFields($node, $imported_node, $fields);
  }
}