Skip to content
Snippets Groups Projects
Commit 4276e511 authored by Jess's avatar Jess
Browse files

Issue #3107472 by ravi.shankar, alexpott, kishor_kolekar, jibran:...

Issue #3107472 by ravi.shankar, alexpott, kishor_kolekar, jibran: DbDumpCommand should not hardcode the version string
parent 214fb25b
No related branches found
No related tags found
8 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage",!13Resolve #2903456
......@@ -93,6 +93,8 @@ protected function generateScript(Connection $connection, array $schema_only = [
$tables .= $this->getTableScript($table, $schema, $data);
}
$script = $this->getTemplate();
// Substitute in the version.
$script = str_replace('{{VERSION}}', \Drupal::VERSION, $script);
// Substitute in the tables.
$script = str_replace('{{TABLES}}', trim($tables), $script);
return trim($script);
......@@ -395,7 +397,7 @@ protected function getTemplate() {
* @file
* A database agnostic dump for testing purposes.
*
* This file was generated by the Drupal 8.0 db-tools.php script.
* This file was generated by the Drupal {{VERSION}} db-tools.php script.
*/
use Drupal\Core\Database\Database;
......
......@@ -13,7 +13,7 @@ class DbToolsApplication extends Application {
* {@inheritdoc}
*/
public function __construct() {
parent::__construct('Database Tools', '8.0.x');
parent::__construct('Database Tools', \Drupal::VERSION);
}
/**
......
......@@ -54,6 +54,8 @@ public function testDbDumpCommand() {
$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->assertStringContainsString("This file was generated by the Drupal {$version} db-tools.php script.", $output);
}
/**
......
......@@ -22,6 +22,7 @@ public function testDumpCommandRegistration() {
$application = new DbToolsApplication();
$command = $application->find('dump');
$this->assertInstanceOf('\Drupal\Core\Command\DbDumpCommand', $command);
$this->assertSame(\Drupal::VERSION, $application->getVersion());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment