function TaxonomyTestBase::createVocabulary

Returns a new vocabulary with random properties.

22 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.
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().
RssTest::setUp in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php
Sets up a Drupal site for running functional and integration tests.
TaxonomyAttributesTest::testTaxonomyTermRdfaAttributes in drupal/core/modules/rdf/lib/Drupal/rdf/Tests/TaxonomyAttributesTest.php
Creates a random term and ensures the RDF output is correct.

... See full list

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTestBase.php, line 37
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(),
    'vid' => drupal_strtolower($this
      ->randomName()),
    'langcode' => Language::LANGCODE_NOT_SPECIFIED,
    'weight' => mt_rand(0, 10),
  ));
  $vocabulary
    ->save();
  return $vocabulary;
}