You are here

function ABTWebTestCase::populateVocabularies in Access By Term 7

1 call to ABTWebTestCase::populateVocabularies()
ABTWebTestCase::setUpTaxonomy in ./abt.test

File

./abt.test, line 50

Class

ABTWebTestCase

Code

function populateVocabularies($vocs, $numberOfTerms = 3) {
  $terms = array();
  for ($i = 0; $i < count($vocs); $i++) {
    $parent = 0;
    for ($j = 0; $j < $numberOfTerms; $j++) {
      $term = (object) array(
        'vid' => $vocs[$i]->vid,
        'name' => $this
          ->randomName(),
        'parent' => $parent,
      );
      taxonomy_term_save($term);
      $parent = $term->tid;
      $terms[$i][$j] = $term;
    }
  }
  return $terms;
}