Loading core/includes/update.inc +8 −1 Changes for core/includes/update.inc: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -397,7 +397,14 @@ function update_get_update_list() { if ($update > $schema_version) { // The description for an update comes from its Doxygen. $func = new ReflectionFunction($module . '_update_' . $update); $description = str_replace(["\n", '*', '/'], '', $func->getDocComment()); $patterns = [ '/^\s*[\/*]*/', '/(\n\s*\**)(.*)/', '/\/$/', '/^\s*/', ]; $replacements = ['', '$2', '', '']; $description = preg_replace($patterns, $replacements, $func->getDocComment()); $ret[$module]['pending'][$update] = "$update - $description"; if (!isset($ret[$module]['start'])) { $ret[$module]['start'] = $update; Loading core/modules/system/tests/modules/update_test_description/update_test_description.info.yml 0 → 100644 +5 −0 Changes for core/modules/system/tests/modules/update_test_description/update_test_description.info.yml: 5 added lines, 0 removed lines. Original line number Diff line number Diff line name: Update test description type: module description: Support module for update testing. package: Testing version: VERSION core/modules/system/tests/modules/update_test_description/update_test_description.install 0 → 100644 +19 −0 Changes for core/modules/system/tests/modules/update_test_description/update_test_description.install: 19 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @file * Install, update and uninstall functions for the update_test_descriptions module. */ /** * Update test of slash in description and/or. */ function update_test_description_update_8001() { } /** * Update test with multiline description, the quick brown fox jumped over the * lazy dog. */ function update_test_description_update_8002() { } core/modules/system/tests/src/Functional/UpdateSystem/UpdateDescriptionTest.php 0 → 100644 +70 −0 Changes for core/modules/system/tests/src/Functional/UpdateSystem/UpdateDescriptionTest.php: 70 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\system\Functional\UpdateSystem; use Drupal\Core\Database\Database; use Drupal\Core\Url; use Drupal\Tests\BrowserTestBase; /** * Tests the display of the description for hook_update(). * * @group Update */ class UpdateDescriptionTest extends BrowserTestBase { /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; /** * Tests displayed description. */ public function testDescription() { $user = $this->drupalCreateUser([ 'administer software updates', 'access site in maintenance mode', ]); $this->drupalLogin($user); $connection = Database::getConnection(); // Set the schema version. $connection->merge('key_value') ->condition('collection', 'system.schema') ->condition('name', 'update_test_description') ->fields([ 'collection' => 'system.schema', 'name' => 'update_test_description', 'value' => 'i:8000;', ]) ->execute(); // Update core.extension. $extensions = $connection->select('config') ->fields('config', ['data']) ->condition('collection', '') ->condition('name', 'core.extension') ->execute() ->fetchField(); $extensions = unserialize($extensions); $extensions['module']['update_test_description'] = 8000; $connection->update('config') ->fields([ 'data' => serialize($extensions), ]) ->condition('collection', '') ->condition('name', 'core.extension') ->execute(); // Go to the update page. $update_url = Url::fromRoute('system.db_update'); $this->drupalGet($update_url); $this->clickLink(t('Continue')); // Check that the description is displayed correctly. $this->assertSession()->responseContains('8001 - Update test of slash in description and/or.'); $this->assertSession()->responseContains('8002 - Update test with multiline description, the quick brown fox jumped over the lazy dog.'); } } core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php +2 −2 Changes for core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -76,8 +76,8 @@ public function testPostUpdate() { */ protected function doSelectionTest() { // First update, should not be run since this module's update hooks fail. $this->assertRaw('8001 - This update will fail.'); $this->assertRaw('8002 - A further update.'); $this->assertSession()->responseContains('8001 - This update will fail.'); $this->assertSession()->responseContains('8002 - A further update'); $this->assertSession()->assertEscaped("First update, should not be run since this module's update hooks fail."); } Loading Loading
core/includes/update.inc +8 −1 Changes for core/includes/update.inc: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -397,7 +397,14 @@ function update_get_update_list() { if ($update > $schema_version) { // The description for an update comes from its Doxygen. $func = new ReflectionFunction($module . '_update_' . $update); $description = str_replace(["\n", '*', '/'], '', $func->getDocComment()); $patterns = [ '/^\s*[\/*]*/', '/(\n\s*\**)(.*)/', '/\/$/', '/^\s*/', ]; $replacements = ['', '$2', '', '']; $description = preg_replace($patterns, $replacements, $func->getDocComment()); $ret[$module]['pending'][$update] = "$update - $description"; if (!isset($ret[$module]['start'])) { $ret[$module]['start'] = $update; Loading
core/modules/system/tests/modules/update_test_description/update_test_description.info.yml 0 → 100644 +5 −0 Changes for core/modules/system/tests/modules/update_test_description/update_test_description.info.yml: 5 added lines, 0 removed lines. Original line number Diff line number Diff line name: Update test description type: module description: Support module for update testing. package: Testing version: VERSION
core/modules/system/tests/modules/update_test_description/update_test_description.install 0 → 100644 +19 −0 Changes for core/modules/system/tests/modules/update_test_description/update_test_description.install: 19 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @file * Install, update and uninstall functions for the update_test_descriptions module. */ /** * Update test of slash in description and/or. */ function update_test_description_update_8001() { } /** * Update test with multiline description, the quick brown fox jumped over the * lazy dog. */ function update_test_description_update_8002() { }
core/modules/system/tests/src/Functional/UpdateSystem/UpdateDescriptionTest.php 0 → 100644 +70 −0 Changes for core/modules/system/tests/src/Functional/UpdateSystem/UpdateDescriptionTest.php: 70 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\system\Functional\UpdateSystem; use Drupal\Core\Database\Database; use Drupal\Core\Url; use Drupal\Tests\BrowserTestBase; /** * Tests the display of the description for hook_update(). * * @group Update */ class UpdateDescriptionTest extends BrowserTestBase { /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; /** * Tests displayed description. */ public function testDescription() { $user = $this->drupalCreateUser([ 'administer software updates', 'access site in maintenance mode', ]); $this->drupalLogin($user); $connection = Database::getConnection(); // Set the schema version. $connection->merge('key_value') ->condition('collection', 'system.schema') ->condition('name', 'update_test_description') ->fields([ 'collection' => 'system.schema', 'name' => 'update_test_description', 'value' => 'i:8000;', ]) ->execute(); // Update core.extension. $extensions = $connection->select('config') ->fields('config', ['data']) ->condition('collection', '') ->condition('name', 'core.extension') ->execute() ->fetchField(); $extensions = unserialize($extensions); $extensions['module']['update_test_description'] = 8000; $connection->update('config') ->fields([ 'data' => serialize($extensions), ]) ->condition('collection', '') ->condition('name', 'core.extension') ->execute(); // Go to the update page. $update_url = Url::fromRoute('system.db_update'); $this->drupalGet($update_url); $this->clickLink(t('Continue')); // Check that the description is displayed correctly. $this->assertSession()->responseContains('8001 - Update test of slash in description and/or.'); $this->assertSession()->responseContains('8002 - Update test with multiline description, the quick brown fox jumped over the lazy dog.'); } }
core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php +2 −2 Changes for core/modules/system/tests/src/Functional/UpdateSystem/UpdatePostUpdateFailingTest.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -76,8 +76,8 @@ public function testPostUpdate() { */ protected function doSelectionTest() { // First update, should not be run since this module's update hooks fail. $this->assertRaw('8001 - This update will fail.'); $this->assertRaw('8002 - A further update.'); $this->assertSession()->responseContains('8001 - This update will fail.'); $this->assertSession()->responseContains('8002 - A further update'); $this->assertSession()->assertEscaped("First update, should not be run since this module's update hooks fail."); } Loading