public function BiblioKeywordWebTestCase::testBiblioDeleteOrphanKeywords in Bibliography Module 7
File
- tests/
BiblioKeywordWebTestCase.test, line 131
Class
- BiblioKeywordWebTestCase
- Biblio keyword web tests.
Code
public function testBiblioDeleteOrphanKeywords() {
$this
->createKeyword();
$this
->createKeyword();
// $count = count($this->kids);.
$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");
}