You are here

function BiblioContributorTestCase::testDuplicateBiblioContributorsMd5 in Bibliography Module 7.3

Test preventing duplications in contributors' names.

File

tests/Contributor.test, line 108

Class

BiblioContributorTestCase
Test Biblio Contributors.

Code

function testDuplicateBiblioContributorsMd5() {

  // Attempt to create 2 contributors with the same name.
  $data = 'Harry J. K. de la Potter and Harry J. K. de la Potter';
  $biblio_contributors1 = BiblioContributorUtility::getBiblioContributorsFromNames($data);

  // The expected result: The duplication was prevented so the 2 contributors
  // have the same ID.
  $this
    ->assertEqual($biblio_contributors1[0]->cid, $biblio_contributors1[1]->cid, 'Biblio Contributor duplication was prevented.');

  // Attempt to create another contributor with the same name.
  $data = 'Harry J. K. de la Potter';
  $biblio_contributors2 = BiblioContributorUtility::getBiblioContributorsFromNames($data);

  // The expected result: The duplication was prevented so the 2 contributors
  // have the same ID.
  $this
    ->assertEqual($biblio_contributors1[0]->cid, $biblio_contributors2[0]->cid, 'Biblio Contributor duplication was prevented.');
}