function DbDumpCommandTest::testInsertCount

Same name in other branches
  1. 10 core/modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php \Drupal\Tests\mysql\Kernel\mysql\Console\DbDumpCommandTest::testInsertCount()

Tests insert count option.

File

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

Class

DbDumpCommandTest
Test that the DbDumpCommand works correctly.

Namespace

Drupal\Tests\mysql\Kernel\mysql\Console

Code

public function testInsertCount() : void {
    $command = new DbDumpCommand();
    $command_tester = new CommandTester($command);
    $command_tester->execute([
        '--insert-count' => '1',
    ]);
    $router_row_count = (int) $this->container
        ->get('database')
        ->select('router')
        ->countQuery()
        ->execute()
        ->fetchField();
    $output = $command_tester->getDisplay();
    $this->assertSame($router_row_count, substr_count($output, "insert('router"));
    $this->assertGreaterThan(1, $router_row_count);
}

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