You are here

public function MenuLinkContentUpdateTest::testMissingDataUpdateRequirementsCheck in Drupal 8

Test the update hook requirements check for revisionable menu links.

See also

menu_link_content_post_update_make_menu_link_content_revisionable()

menu_link_content_requirements()

File

core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php, line 160

Class

MenuLinkContentUpdateTest
Tests the upgrade path for custom menu links.

Namespace

Drupal\Tests\menu_link_content\Functional\Update

Code

public function testMissingDataUpdateRequirementsCheck() {

  // Insert invalid data for a non-existent menu link.
  Database::getConnection()
    ->insert('menu_link_content')
    ->fields([
    'id' => '3',
    'bundle' => 'menu_link_content',
    'uuid' => '15396f85-3c11-4f52-81af-44d2cb5e829f',
    '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_menu_link_content_revisionable database update cannot be run until the data has been fixed.');
}