function TaxonomyLegacyTest::testEntityLegacyCode

@expectedDeprecation taxonomy_term_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\taxonomy\Entity\Term::loadMultiple(). See https://www.drupal.org/node/2266845 @expectedDeprecation taxonomy_vocabulary_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\taxonomy\Entity\Vocabulary::loadMultiple(). See https://www.drupal.org/node/2266845 @expectedDeprecation taxonomy_term_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\taxonomy\Entity\Term::load(). See https://www.drupal.org/node/2266845 @expectedDeprecation taxonomy_vocabulary_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\taxonomy\Entity\Vocabulary::load(). See https://www.drupal.org/node/2266845

File

core/modules/taxonomy/tests/src/Kernel/TaxonomyLegacyTest.php, line 41

Class

TaxonomyLegacyTest
Tests legacy user functionality.

Namespace

Drupal\Tests\taxonomy\Kernel

Code

public function testEntityLegacyCode() {
    $this->assertCount(0, taxonomy_term_load_multiple());
    $this->assertCount(0, taxonomy_vocabulary_load_multiple());
    $this->createTerm($this->createVocabulary());
    $this->assertCount(1, taxonomy_term_load_multiple());
    $this->assertCount(1, taxonomy_vocabulary_load_multiple());
    $vocab = $this->createVocabulary();
    $this->createTerm($vocab);
    $this->createTerm($vocab);
    $this->assertCount(3, taxonomy_term_load_multiple());
    $this->assertCount(2, taxonomy_vocabulary_load_multiple());
    $this->assertNull(taxonomy_term_load(3000));
    $this->assertInstanceOf(TermInterface::class, taxonomy_term_load(1));
    $this->assertNull(taxonomy_vocabulary_load('not_a_vocab'));
    $this->assertInstanceOf(VocabularyInterface::class, taxonomy_vocabulary_load($vocab->id()));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.