comparison core/modules/taxonomy/tests/src/Functional/TermTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
88 // Create two taxonomy terms. 88 // Create two taxonomy terms.
89 $term1 = $this->createTerm($this->vocabulary); 89 $term1 = $this->createTerm($this->vocabulary);
90 $term2 = $this->createTerm($this->vocabulary); 90 $term2 = $this->createTerm($this->vocabulary);
91 91
92 // Get the taxonomy storage. 92 // Get the taxonomy storage.
93 $taxonomy_storage = $this->container->get('entity.manager')->getStorage('taxonomy_term'); 93 /** @var \Drupal\taxonomy\TermStorageInterface $taxonomy_storage */
94 $taxonomy_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term');
94 95
95 // Check that hierarchy is flat. 96 // Check that hierarchy is flat.
96 $vocabulary = Vocabulary::load($this->vocabulary->id()); 97 $this->assertEquals(0, $taxonomy_storage->getVocabularyHierarchyType($this->vocabulary->id()), 'Vocabulary is flat.');
97 $this->assertEqual(0, $vocabulary->getHierarchy(), 'Vocabulary is flat.');
98 98
99 // Edit $term2, setting $term1 as parent. 99 // Edit $term2, setting $term1 as parent.
100 $edit = []; 100 $edit = [];
101 $edit['parent[]'] = [$term1->id()]; 101 $edit['parent[]'] = [$term1->id()];
102 $this->drupalPostForm('taxonomy/term/' . $term2->id() . '/edit', $edit, t('Save')); 102 $this->drupalPostForm('taxonomy/term/' . $term2->id() . '/edit', $edit, t('Save'));