function DbDumpCommandTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php \Drupal\Tests\system\Kernel\Scripts\DbDumpCommandTest::setUp()
  2. 8.9.x core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php \Drupal\Tests\system\Kernel\Scripts\DbDumpCommandTest::setUp()
  3. 11.x core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php \Drupal\Tests\mysql\Kernel\mysql\Console\DbDumpCommandTest::setUp()

Overrides DriverSpecificKernelTestBase::setUp

File

core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php, line 26

Class

DbDumpCommandTest
Test that the DbDumpCommand works correctly.

Namespace

Drupal\Tests\mysql\Kernel\mysql\Console

Code

protected function setUp() : void {
  parent::setUp();
  // Rebuild the router to ensure a routing table.
  \Drupal::service('router.builder')->rebuild();
  /** @var \Drupal\Core\Database\Connection $connection */
  $connection = $this->container
    ->get('database');
  $connection->insert('router')
    ->fields([
    'name',
    'path',
    'pattern_outline',
  ])
    ->values([
    'test',
    'test',
    'test',
  ])
    ->execute();
  // Create a table with a field type not defined in
  // \Drupal\Core\Database\Schema::getFieldTypeMap.
  $table_name = $connection->getPrefix() . 'foo';
  $sql = "create table if not exists `{$table_name}` (`test` datetime NOT NULL);";
  $connection->query($sql)
    ->execute();
}

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