public function DbDumpCommandTest::testDbDumpCommand in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/tests/src/Kernel/Scripts/DbDumpCommandTest.php \Drupal\Tests\system\Kernel\Scripts\DbDumpCommandTest::testDbDumpCommand()
Test the command directly.
File
- core/
modules/ system/ tests/ src/ Kernel/ Scripts/ DbDumpCommandTest.php, line 44
Class
- DbDumpCommandTest
- Test that the DbDumpCommand works correctly.
Namespace
Drupal\Tests\system\Kernel\ScriptsCode
public function testDbDumpCommand() {
$command = new DbDumpCommand();
$command_tester = new CommandTester($command);
$command_tester
->execute([]);
// Assert that insert exists and that some expected fields exist.
$output = $command_tester
->getDisplay();
$this
->assertStringContainsString("createTable('router", $output, 'Table router found');
$this
->assertStringContainsString("insert('router", $output, 'Insert found');
$this
->assertStringContainsString("'name' => 'test", $output, 'Insert name field found');
$this
->assertStringContainsString("'path' => 'test", $output, 'Insert path field found');
$this
->assertStringContainsString("'pattern_outline' => 'test", $output, 'Insert pattern_outline field found');
$this
->assertStringContainsString("// @codingStandardsIgnoreFile", $output);
$version = \Drupal::VERSION;
$this
->assertContains("This file was generated by the Drupal {$version} db-tools.php script.", $output);
}