function MenuLinkContentUpdateTest::assertMenuLinkTitle

Assert that a menu link label matches the expectation.

Parameters

string $id: The menu link ID.

string $expected_title: The expected menu link title.

1 call to MenuLinkContentUpdateTest::assertMenuLinkTitle()
MenuLinkContentUpdateTest::testConversionToRevisionable in core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php
Tests the conversion of custom menu links to be revisionable.

File

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

Class

MenuLinkContentUpdateTest
Tests the upgrade path for custom menu links.

Namespace

Drupal\Tests\menu_link_content\Functional\Update

Code

protected function assertMenuLinkTitle($id, $expected_title) {
    $database = \Drupal::database();
    $query = $database->select('menu_link_content_data', 'd');
    $query->join('menu_link_content', 'b', 'b.id = d.id AND d.default_langcode = 1');
    $title = $query->fields('d', [
        'title',
    ])
        ->condition('d.id', $id)
        ->execute()
        ->fetchField();
    $this->assertSame($expected_title, $title ?: '');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.