trait DbUpdatesTrait in Drupal 8
Same name in this branch
- 8 core/modules/system/src/Tests/Update/DbUpdatesTrait.php \Drupal\system\Tests\Update\DbUpdatesTrait
- 8 core/modules/system/tests/src/Functional/Update/DbUpdatesTrait.php \Drupal\Tests\system\Functional\Update\DbUpdatesTrait
Provides methods to conditionally enable db update functions and apply pending db updates through the Update UI.
This should be used only by classes extending \Drupal\Tests\BrowserTestBase.
Hierarchy
- trait \Drupal\Tests\system\Functional\Update\DbUpdatesTrait uses StringTranslationTrait, RequirementsPageTrait
1 file declares its use of DbUpdatesTrait
- UpdateApiEntityDefinitionUpdateTest.php in core/
modules/ system/ tests/ src/ Functional/ Entity/ Update/ UpdateApiEntityDefinitionUpdateTest.php
File
- core/
modules/ system/ tests/ src/ Functional/ Update/ DbUpdatesTrait.php, line 15
Namespace
Drupal\Tests\system\Functional\UpdateView source
trait DbUpdatesTrait {
use StringTranslationTrait;
use RequirementsPageTrait;
/**
* Enables db updates until the specified index.
*
* @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.
* @param $index
* The index of the last update function to run.
*/
protected function enableUpdates($module, $group, $index) {
$this->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
->updateRequirementsProblem();
$this
->clickLink($this
->t('Continue'));
$this
->clickLink($this
->t('Apply pending updates'));
$this
->checkForMetaRefresh();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DbUpdatesTrait:: |
protected | function | Applies any pending DB updates through the Update UI. | |
DbUpdatesTrait:: |
protected | function | Enables db updates until the specified index. | |
RequirementsPageTrait:: |
protected | function | Assert the given warning summaries are present on the page. | |
RequirementsPageTrait:: |
protected | function | Continues installation when the expected warnings are found. | |
RequirementsPageTrait:: |
protected | function | Handles the update requirements page. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |