function TaxonomyWebTestCase::createVocabulary in Drupal 7
Returns a new vocabulary with random properties.
23 calls to TaxonomyWebTestCase::createVocabulary()
- RdfMappingDefinitionTestCase::testTaxonomyTermRdfaAttributes in modules/
rdf/ rdf.test - Creates a random term and ensures the right RDFa markup is used.
- TaxonomyEFQTestCase::setUp in modules/
taxonomy/ taxonomy.test - Sets up a Drupal site for running functional and integration tests.
- TaxonomyEFQTestCase::testTaxonomyEFQ in modules/
taxonomy/ taxonomy.test - Tests that a basic taxonomy EntityFieldQuery works.
- TaxonomyHooksTestCase::testTaxonomyTermHooks in modules/
taxonomy/ taxonomy.test - Test that hooks are run correctly on creating, editing, viewing, and deleting a term.
- TaxonomyLoadMultipleTestCase::testTaxonomyTermMultipleLoad in modules/
taxonomy/ taxonomy.test - Create a vocabulary and some taxonomy terms, ensuring they're loaded correctly using taxonomy_term_load_multiple().
File
- 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;
}