ImportPreventDuplicates.test in Bibliography Module 7.3
File
tests/ImportPreventDuplicates.test
View source
<?php
class BiblioImportPreventDuplicateTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Prevent duplication',
'description' => 'Test preventing duplication on import.',
'group' => 'Biblio',
);
}
function setUp() {
parent::setUp('biblio');
biblio_create_fields_by_bundle(array(
'book',
'journal',
));
}
function testMd5() {
$data = '
@Book{abramowitze+stegune,
author = "Hilton {Abramowitze} and Serene A. {Stegune}",
title = "Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables",
publisher = "Dover",
year = 1982,
address = "Los Angeles",
edition = "ninth Dover printing, tenth GPO printing"
}';
$biblio_style1 = biblio_get_class_from_style('bibtex');
$biblio_style1
->import($data);
$biblio_style2 = biblio_get_class_from_style('bibtex');
$biblios2 = $biblio_style2
->import($data);
$this
->assertTrue(empty($biblios2['new']) && !empty($biblios2['duplicate']), 'Biblio duplication was successfully prevented.');
}
}