You are here

public function BiblioWebTestCase::assertBiblioFields in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 tests/biblio.test \BiblioWebTestCase::assertBiblioFields()
  2. 7.2 tests/biblio.test \BiblioWebTestCase::assertBiblioFields()
4 calls to BiblioWebTestCase::assertBiblioFields()
BiblioImportExportWebTestCase::testBiblioBibtexFileImport in tests/BiblioImportExportWebTestCase.test
BiblioImportExportWebTestCase::testBiblioRISFileImport in tests/BiblioImportExportWebTestCase.test
BiblioImportExportWebTestCase::testBiblioTaggedFileImport in tests/BiblioImportExportWebTestCase.test
BiblioImportExportWebTestCase::testBiblioXMLFileImport in tests/BiblioImportExportWebTestCase.test

File

tests/BiblioWebTestCase.test, line 149

Class

BiblioWebTestCase
Base class used by other tests.

Code

public function assertBiblioFields($node1, $node2, $fields = array()) {
  $count = 0;
  foreach ($fields as $field) {
    if ($field == 'biblio_contributors') {
      foreach ($node1->{$field} as $key => $auth) {
        unset($node1->{$field}[$key]['nid']);
        unset($node1->{$field}[$key]['vid']);
      }
      foreach ($node2->{$field} as $key => $auth) {
        unset($node2->{$field}[$key]['nid']);
        unset($node2->{$field}[$key]['vid']);
      }
    }
    if ($node1->{$field} != $node2->{$field}) {
      $this
        ->assertIdentical($node1->{$field}, $node2->{$field});
      $count++;
    }
  }
  $this
    ->assertEqual($count, 0, "There were {$count} differences between the two nodes");
}