You are here

public function TaxonomyVocabularyHierarchyUpdateTest::testTaxonomyUpdateParents in Drupal 8

Tests that the 'hierarchy' property is removed from vocabularies.

See also

taxonomy_post_update_remove_hierarchy_from_vocabularies()

taxonomy_update_8701()

File

core/modules/taxonomy/tests/src/Functional/Update/TaxonomyVocabularyHierarchyUpdateTest.php, line 34

Class

TaxonomyVocabularyHierarchyUpdateTest
Tests that the 'hierarchy' property is removed from vocabularies.

Namespace

Drupal\Tests\taxonomy\Functional\Update

Code

public function testTaxonomyUpdateParents() {
  $hierarchy = \Drupal::config('taxonomy.vocabulary.test_vocabulary')
    ->get('hierarchy');
  $this
    ->assertSame(1, $hierarchy);

  // We can not test whether an index on the 'bundle' column existed before
  // running the updates because the 'taxonomy_term__parent' table itself is
  // created by an update function.
  // Run updates.
  $this
    ->runUpdates();
  $hierarchy = \Drupal::config('taxonomy.vocabulary.test_vocabulary')
    ->get('hierarchy');
  $this
    ->assertNull($hierarchy);
  $this
    ->assertNoIndexOnColumns('taxonomy_term__parent', [
    'bundle',
  ]);
  $this
    ->assertIndexOnColumns('taxonomy_term__parent', [
    'bundle',
    'delta',
    'parent_target_id',
  ]);
}