You are here

public function TaxonomyTermUpdatePathTest::testMissingDataUpdateRequirementsCheck in Drupal 8

Test the update hook requirements check for revisionable terms.

See also

taxonomy_post_update_make_taxonomy_term_revisionable()

taxonomy_requirements()

File

core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php, line 265

Class

TaxonomyTermUpdatePathTest
Tests the upgrade path for taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Functional\Update

Code

public function testMissingDataUpdateRequirementsCheck() {

  // Insert invalid data for a non-existent taxonomy term.
  Database::getConnection()
    ->insert('taxonomy_term_data')
    ->fields([
    'tid' => '6',
    'vid' => 'tags',
    'uuid' => 'd5fd282b-df66-4d50-b0d1-76bf9eede9c5',
    'langcode' => 'en',
  ])
    ->execute();
  $this
    ->writeSettings([
    'settings' => [
      'update_free_access' => (object) [
        'value' => TRUE,
        'required' => TRUE,
      ],
    ],
  ]);
  $this
    ->drupalGet($this->updateUrl);
  $this
    ->assertSession()
    ->pageTextContains('Errors found');
  $this
    ->assertSession()
    ->elementTextContains('css', '.system-status-report__entry--error', 'The make_taxonomy_term_revisionable database update cannot be run until the data has been fixed.');
}