function TaxonomyWebTestCase::createVocabulary
7.x taxonomy.test | TaxonomyWebTestCase::createVocabulary() |
Returns a new vocabulary with random properties.
22 calls to TaxonomyWebTestCase::createVocabulary()
- RdfMappingDefinitionTestCase::testTaxonomyTermRdfaAttributes in drupal-7.x/
modules/ rdf/ rdf.test - Creates a random term and ensures the right RDFa markup is used.
- TaxonomyEFQTestCase::setUp in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Sets up a Drupal site for running functional and integration tests.
- TaxonomyEFQTestCase::testTaxonomyEFQ in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Tests that a basic taxonomy EntityFieldQuery works.
- TaxonomyHooksTestCase::testTaxonomyTermHooks in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Test that hooks are run correctly on creating, editing, viewing, and deleting a term.
- TaxonomyLoadMultipleTestCase::testTaxonomyTermMultipleLoad in drupal-7.x/
modules/ taxonomy/ taxonomy.test - Create a vocabulary and some taxonomy terms, ensuring they're loaded correctly using taxonomy_term_load_multiple().
File
- drupal-7.x/
modules/ taxonomy/ taxonomy.test, line 16 - Tests for taxonomy.module.
Class
- TaxonomyWebTestCase
- Provides common helper methods for Taxonomy module tests.
Code
function createVocabulary() {
// Create a vocabulary.
$vocabulary = new stdClass();
$vocabulary->name = $this->randomName();
$vocabulary->description = $this->randomName();
$vocabulary->machine_name = drupal_strtolower($this->randomName());
$vocabulary->help = '';
$vocabulary->nodes = array('article' => 'article');
$vocabulary->weight = mt_rand(0, 10);
taxonomy_vocabulary_save($vocabulary);
return $vocabulary;
}