You are here

function ModuleTestBase::assertTableCount in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Module/ModuleTestBase.php \Drupal\system\Tests\Module\ModuleTestBase::assertTableCount()

Assert there are tables that begin with the specified base table name.

Parameters

$base_table: Beginning of table name to look for.

$count: (optional) Whether or not to assert that there are tables that match the specified base table. Defaults to TRUE.

1 call to ModuleTestBase::assertTableCount()
DependencyTest::testEnableWithoutDependency in core/modules/system/src/Tests/Module/DependencyTest.php
Attempts to enable the Content Translation module without Language enabled.

File

core/modules/system/src/Tests/Module/ModuleTestBase.php, line 46
Contains \Drupal\system\Tests\Module\ModuleTestBase.

Class

ModuleTestBase
Helper class for module test cases.

Namespace

Drupal\system\Tests\Module

Code

function assertTableCount($base_table, $count = TRUE) {
  $tables = db_find_tables(Database::getConnection()
    ->prefixTables('{' . $base_table . '}') . '%');
  if ($count) {
    return $this
      ->assertTrue($tables, format_string('Tables matching "@base_table" found.', array(
      '@base_table' => $base_table,
    )));
  }
  return $this
    ->assertFalse($tables, format_string('Tables matching "@base_table" not found.', array(
    '@base_table' => $base_table,
  )));
}