comparison core/modules/taxonomy/tests/src/Kernel/TaxonomyLegacyTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
1 <?php
2
3 namespace Drupal\Tests\taxonomy\Kernel;
4
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\taxonomy\TermInterface;
7 use Drupal\taxonomy\VocabularyInterface;
8 use Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait;
9
10 /**
11 * Tests legacy user functionality.
12 *
13 * @group user
14 * @group legacy
15 */
16 class TaxonomyLegacyTest extends KernelTestBase {
17 use TaxonomyTestTrait;
18
19 /**
20 * Modules to enable.
21 *
22 * @var array
23 */
24 public static $modules = ['filter', 'taxonomy', 'text', 'user'];
25
26 /**
27 * {@inheritdoc}
28 */
29 protected function setUp() {
30 parent::setUp();
31 $this->installConfig(['filter']);
32 $this->installEntitySchema('taxonomy_term');
33 }
34
35 /**
36 * @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
37 * @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
38 * @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
39 * @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
40 */
41 public function testEntityLegacyCode() {
42 $this->assertCount(0, taxonomy_term_load_multiple());
43 $this->assertCount(0, taxonomy_vocabulary_load_multiple());
44 $this->createTerm($this->createVocabulary());
45 $this->assertCount(1, taxonomy_term_load_multiple());
46 $this->assertCount(1, taxonomy_vocabulary_load_multiple());
47 $vocab = $this->createVocabulary();
48 $this->createTerm($vocab);
49 $this->createTerm($vocab);
50 $this->assertCount(3, taxonomy_term_load_multiple());
51 $this->assertCount(2, taxonomy_vocabulary_load_multiple());
52
53 $this->assertNull(taxonomy_term_load(3000));
54 $this->assertInstanceOf(TermInterface::class, taxonomy_term_load(1));
55 $this->assertNull(taxonomy_vocabulary_load('not_a_vocab'));
56 $this->assertInstanceOf(VocabularyInterface::class, taxonomy_vocabulary_load($vocab->id()));
57 }
58
59 }