X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FDbUpdatesTrait.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FDbUpdatesTrait.php;h=55f3a04a5ad4775a196df477f38fa9c2481adbaf;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/system/tests/src/Functional/Update/DbUpdatesTrait.php b/web/core/modules/system/tests/src/Functional/Update/DbUpdatesTrait.php new file mode 100644 index 000000000..55f3a04a5 --- /dev/null +++ b/web/core/modules/system/tests/src/Functional/Update/DbUpdatesTrait.php @@ -0,0 +1,56 @@ +container->get('state')->set($module . '.db_updates.' . $group, $index); + } + + /** + * Applies any pending DB updates through the Update UI. + */ + protected function applyUpdates() { + $this->drupalGet(Url::fromRoute('system.db_update')); + $this->clickLink($this->t('Continue')); + $this->clickLink($this->t('Apply pending updates')); + $this->checkForMetaRefresh(); + } + + /** + * Conditionally load Update API functions for the specified group. + * + * @param string $module + * The name of the module defining the update functions. + * @param string $group + * A name identifying the group of update functions to enable. + */ + public static function includeUpdates($module, $group) { + if ($index = \Drupal::state()->get($module . '.db_updates.' . $group)) { + module_load_include('inc', $module, 'update/' . $group . '_' . $index); + } + } + +}