function TaxonomyTestBase::createVocabulary

Returns a new vocabulary with random properties.

23 calls to TaxonomyTestBase::createVocabulary()
EfqTest::setUp in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php
Sets up a Drupal site for running functional and integration tests.
EfqTest::testTaxonomyEfq in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/EfqTest.php
Tests that a basic taxonomy entity query works.
HooksTest::testTaxonomyTermHooks in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/HooksTest.php
Test hooks on CRUD of terms.
LoadMultipleTest::testTaxonomyTermMultipleLoad in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php
Create a vocabulary and some taxonomy terms, ensuring they're loaded correctly using taxonomy_term_load_multiple().
MappingDefinitionTest::testTaxonomyTermRdfaAttributes in drupal/core/modules/rdf/lib/Drupal/rdf/Tests/MappingDefinitionTest.php
Creates a random term and ensures the right RDFa markup is used.

... See full list

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php, line 36
Definition of Drupal\taxonomy\Tests\TaxonomyTestBase.

Class

TaxonomyTestBase
Provides common helper methods for Taxonomy module tests.

Namespace

Drupal\taxonomy\Tests

Code

function createVocabulary() {

  // Create a vocabulary.
  $vocabulary = entity_create('taxonomy_vocabulary', array(
    'name' => $this
      ->randomName(),
    'description' => $this
      ->randomName(),
    'machine_name' => drupal_strtolower($this
      ->randomName()),
    'langcode' => LANGUAGE_NOT_SPECIFIED,
    'help' => '',
    'nodes' => array(
      'article' => 'article',
    ),
    'weight' => mt_rand(0, 10),
  ));
  taxonomy_vocabulary_save($vocabulary);
  return $vocabulary;
}