// Generate the script.
$application =
new DbDumpApplication();
$command =
$application->
find('dump-database-d8-mysql'
);
$command_tester =
new CommandTester($command);
$command_tester->
execute([]);
$script =
$command_tester->
getDisplay();
// Store original schemas and drop tables to avoid errors.
$connection = Database::
getConnection();
$schema =
$connection->
schema();
foreach ($this->tables
as $table) { $this->originalTableSchemas
[$table] =
$this->
getTableSchema($table);
$this->originalTableIndexes
[$table] =
$this->
getTableIndexes($table);
$schema->
dropTable($table);
} // This will load the data.
$file =
sys_get_temp_dir() . '/' .
$this->
randomMachineName();
file_put_contents($file,
$script);
require_once $file;
// The tables should now exist and the schemas should match the originals.
foreach ($this->tables
as $table) {