You are here

protected function MenuTreeStorageTest::doTestTable in Drupal 9

Same name and namespace in other branches
  1. 8 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 61

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');
}