function BiblioKeywordUnitTest::testBiblioDeleteOrphanKeywords in Bibliography Module 7.2        
                          
                  
                        Same name and namespace in other branches
- 6.2 tests/keyword.test \BiblioKeywordUnitTest::testBiblioDeleteOrphanKeywords()
File
 
   - tests/keyword.test, line 114
- Tests for keyword functions.
Class
  
  - BiblioKeywordUnitTest 
- Unit tests for keyword functions.
Code
function testBiblioDeleteOrphanKeywords() {
  $this
    ->createKeyword();
  $this
    ->createKeyword();
  
  $num_records_before = db_query('SELECT COUNT(*) FROM {biblio_keyword_data} WHERE kid NOT IN (SELECT DISTINCT(kid) FROM {biblio_keyword})')
    ->fetchField();
  biblio_delete_orphan_keywords(TRUE);
  $num_records_after = db_query('SELECT COUNT(*) FROM {biblio_keyword_data} WHERE kid NOT IN (SELECT DISTINCT(kid) FROM {biblio_keyword})')
    ->fetchField();
  $this
    ->assertEqual($num_records_before, $num_records_after + $num_records_before, "Deleted {$num_records_before} orphan keywords");
}