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. 10 core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php \Drupal\Tests\mysql\Kernel\mysql\Console\DbDumpCommandTest::setUp()
  3. 11.x core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php \Drupal\Tests\mysql\Kernel\mysql\Console\DbDumpCommandTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php, line 25

Class

DbDumpCommandTest
Test that the DbDumpCommand works correctly.

Namespace

Drupal\Tests\system\Kernel\Scripts

Code

protected function setUp() {
    parent::setUp();
    // Determine what database backend is running, and set the skip flag.
    if (Database::getConnection()->databaseType() !== 'mysql') {
        $this->markTestSkipped("Skipping test since the DbDumpCommand is currently only compatible with MySQL");
    }
    // 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();
}

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