You are here

protected function MenuTreeStorageTest::doTestTable in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php \Drupal\system\Tests\Menu\MenuTreeStorageTest::doTestTable()

Ensures that table gets created on the fly.

1 call to MenuTreeStorageTest::doTestTable()
MenuTreeStorageTest::testBasicMethods in core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php
Tests the tree storage when no tree was built yet.

File

core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php, line 73
Contains \Drupal\system\Tests\Menu\MenuTreeStorageTest.

Class

MenuTreeStorageTest
Tests the menu tree storage.

Namespace

Drupal\system\Tests\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');
}