You are here

public function BiblioImportExportWebTestCase::testBiblioRISFileImport in Bibliography Module 7

File

tests/BiblioImportExportWebTestCase.test, line 75

Class

BiblioImportExportWebTestCase
Web tests for import/export.

Code

public function testBiblioRISFileImport() {
  $file = file_save_data($this
    ->getRISString());
  $context = array();
  biblio_import($file, 'biblio_ris', 1, NULL, FALSE, NULL, $context);
  $nids = $context['results']['nids'];
  array_merge($this->nids, $nids);
  $this
    ->assertEqual(count($nids), 1, 'Imported 1 RIS entry');
  file_delete($file);
  $node = $this
    ->createNode();
  $fields = array_unique(array_filter(biblio_get_map('field_map', 'ris')));
  $fields += array(
    'title',
    'biblio_contributors',
  );
  foreach ($nids as $nid) {
    $this->nids[] = $nid;
    $imported_node = node_load($nid);
    $this
      ->assertBiblioFields($node, $imported_node, $fields);
  }
}