function MenuTreeStorageTest::doTestTable

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php \Drupal\KernelTests\Core\Menu\MenuTreeStorageTest::doTestTable()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php \Drupal\KernelTests\Core\Menu\MenuTreeStorageTest::doTestTable()
  3. 11.x core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php \Drupal\KernelTests\Core\Menu\MenuTreeStorageTest::doTestTable()

Ensures that table gets created on the fly.

1 call to MenuTreeStorageTest::doTestTable()
MenuTreeStorageTest::testBasicMethods in core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
Tests the tree storage when no tree was built yet.

File

core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php, line 65

Class

MenuTreeStorageTest
Tests the menu tree storage.

Namespace

Drupal\KernelTests\Core\Menu

Code

protected function doTestTable() {
    // Test that we can create a tree storage with an arbitrary table name and
    // that selecting from the storage creates the table.
    $tree_storage = new MenuTreeStorage($this->container
        ->get('database'), $this->container
        ->get('cache.menu'), $this->container
        ->get('cache_tags.invalidator'), 'test_menu_tree');
    $this->assertFalse($this->connection
        ->schema()
        ->tableExists('test_menu_tree'), 'Test table is not yet created');
    $tree_storage->countMenuLinks();
    $this->assertTrue($this->connection
        ->schema()
        ->tableExists('test_menu_tree'), 'Test table was created');
}

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