class ReadinessValidationTest in Automatic Updates 8.2
Tests readiness validation.
@group automatic_updates
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses FunctionalTestSetupTrait, TestSetupTrait, AssertLegacyTrait, BlockCreationTrait, ConfigTestTrait, ContentTypeCreationTrait, NodeCreationTrait, PhpunitCompatibilityTrait, RandomGeneratorTrait, TestRequirementsTrait, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\automatic_updates\Functional\AutomaticUpdatesFunctionalTestBase
- class \Drupal\Tests\automatic_updates\Functional\ReadinessValidationTest uses StringTranslationTrait, ValidationTestTrait, CronRunTrait
- class \Drupal\Tests\automatic_updates\Functional\AutomaticUpdatesFunctionalTestBase
Expanded class hierarchy of ReadinessValidationTest
File
- tests/
src/ Functional/ ReadinessValidationTest.php, line 18
Namespace
Drupal\Tests\automatic_updates\FunctionalView source
class ReadinessValidationTest extends AutomaticUpdatesFunctionalTestBase {
use StringTranslationTrait;
use CronRunTrait;
use ValidationTestTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* A user who can view the status report.
*
* @var \Drupal\user\Entity\User
*/
protected $reportViewerUser;
/**
* A user who can view the status report and run readiness checkers.
*
* @var \Drupal\user\Entity\User
*/
protected $checkerRunnerUser;
/**
* The test checker.
*
* @var \Drupal\automatic_updates_test\ReadinessChecker\TestChecker1
*/
protected $testChecker;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this
->setReleaseMetadata(__DIR__ . '/../../fixtures/release-history/drupal.9.8.1.xml');
$this
->setCoreVersion('9.8.1');
$this->reportViewerUser = $this
->createUser([
'administer site configuration',
'access administration pages',
]);
$this->checkerRunnerUser = $this
->createUser([
'administer site configuration',
'administer software updates',
'access administration pages',
]);
$this
->createTestValidationResults();
$this
->drupalLogin($this->reportViewerUser);
}
/**
* Tests readiness checkers on status report page.
*/
public function testReadinessChecksStatusReport() : void {
$assert = $this
->assertSession();
// Ensure automated_cron is disabled before installing automatic_updates. This
// ensures we are testing that automatic_updates runs the checkers when the
// module itself is installed and they weren't run on cron.
$this
->assertFalse($this->container
->get('module_handler')
->moduleExists('automated_cron'));
$this->container
->get('module_installer')
->install([
'automatic_updates',
'automatic_updates_test',
]);
// If the site is ready for updates, the users will see the same output
// regardless of whether the user has permission to run updates.
$this
->drupalLogin($this->reportViewerUser);
$this
->checkForUpdates();
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates.', 'checked', FALSE);
$this
->drupalLogin($this->checkerRunnerUser);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates. Run readiness checks now.', 'checked', FALSE);
// Confirm a user without the permission to run readiness checks does not
// have a link to run the checks when the checks need to be run again.
// @todo Change this to fake the request time in
// https://www.drupal.org/node/3113971.
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value */
$key_value = $this->container
->get('keyvalue.expirable')
->get('automatic_updates');
$key_value
->delete('readiness_validation_last_run');
$this
->drupalLogin($this->reportViewerUser);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates.', 'checked', FALSE);
$this
->drupalLogin($this->checkerRunnerUser);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates. Run readiness checks now.', 'checked', FALSE);
// Confirm a user with the permission to run readiness checks does have a
// link to run the checks when the checks need to be run again.
$this
->drupalLogin($this->reportViewerUser);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates.', 'checked', FALSE);
$this
->drupalLogin($this->checkerRunnerUser);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates. Run readiness checks now.', 'checked', FALSE);
/** @var \Drupal\automatic_updates\Validation\ValidationResult[] $expected_results */
$expected_results = $this->testResults['checker_1']['1 error'];
TestChecker1::setTestResult($expected_results);
// Run the readiness checks.
$this
->clickLink('Run readiness checks');
$assert
->statusCodeEquals(200);
// Confirm redirect back to status report page.
$assert
->addressEquals('/admin/reports/status');
// Assert that when the runners are run manually the message that updates
// will not be performed because of errors is displayed on the top of the
// page in message.
$assert
->pageTextMatchesCount(2, '/' . preg_quote(static::$errorsExplanation) . '/');
$this
->assertReadinessReportMatches($expected_results[0]
->getMessages()[0] . 'Run readiness checks now.', 'error', static::$errorsExplanation);
// @todo Should we always show when the checks were last run and a link to
// run when there is an error?
// Confirm a user without permission to run the checks sees the same error.
$this
->drupalLogin($this->reportViewerUser);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches($expected_results[0]
->getMessages()[0], 'error', static::$errorsExplanation);
$expected_results = $this->testResults['checker_1']['1 error 1 warning'];
TestChecker1::setTestResult($expected_results);
$key_value
->delete('readiness_validation_last_run');
// Confirm a new message is displayed if the stored messages are deleted.
$this
->drupalGet('admin/reports/status');
// Confirm that on the status page if there is only 1 warning or error the
// the summaries will not be displayed.
$this
->assertReadinessReportMatches($expected_results['1:error']
->getMessages()[0], 'error', static::$errorsExplanation);
$this
->assertReadinessReportMatches($expected_results['1:warning']
->getMessages()[0], 'warning', static::$warningsExplanation);
$assert
->pageTextNotContains($expected_results['1:error']
->getSummary());
$assert
->pageTextNotContains($expected_results['1:warning']
->getSummary());
$key_value
->delete('readiness_validation_last_run');
$expected_results = $this->testResults['checker_1']['2 errors 2 warnings'];
TestChecker1::setTestResult($expected_results);
$this
->drupalGet('admin/reports/status');
// Confirm that both messages and summaries will be displayed on status
// report when there multiple messages.
$this
->assertReadinessReportMatches($expected_results['1:errors']
->getSummary() . ' ' . implode('', $expected_results['1:errors']
->getMessages()), 'error', static::$errorsExplanation);
$this
->assertReadinessReportMatches($expected_results['1:warnings']
->getSummary() . ' ' . implode('', $expected_results['1:warnings']
->getMessages()), 'warning', static::$warningsExplanation);
$key_value
->delete('readiness_validation_last_run');
$expected_results = $this->testResults['checker_1']['2 warnings'];
TestChecker1::setTestResult($expected_results);
$this
->drupalGet('admin/reports/status');
$assert
->pageTextContainsOnce('Update readiness checks');
// Confirm that warnings will display on the status report if there are no
// errors.
$this
->assertReadinessReportMatches($expected_results[0]
->getSummary() . ' ' . implode('', $expected_results[0]
->getMessages()), 'warning', static::$warningsExplanation);
$key_value
->delete('readiness_validation_last_run');
$expected_results = $this->testResults['checker_1']['1 warning'];
TestChecker1::setTestResult($expected_results);
$this
->drupalGet('admin/reports/status');
$assert
->pageTextContainsOnce('Update readiness checks');
$this
->assertReadinessReportMatches($expected_results[0]
->getMessages()[0], 'warning', static::$warningsExplanation);
}
/**
* Tests readiness checkers results on admin pages..
*/
public function testReadinessChecksAdminPages() : void {
$assert = $this
->assertSession();
$messages_section_selector = '[data-drupal-messages]';
// Ensure automated_cron is disabled before installing automatic_updates. This
// ensures we are testing that automatic_updates runs the checkers when the
// module itself is installed and they weren't run on cron.
$this
->assertFalse($this->container
->get('module_handler')
->moduleExists('automated_cron'));
$this->container
->get('module_installer')
->install([
'automatic_updates',
'automatic_updates_test',
]);
// If site is ready for updates no message will be displayed on admin pages.
$this
->drupalLogin($this->reportViewerUser);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates.', 'checked', FALSE);
$this
->drupalGet('admin/structure');
$assert
->elementNotExists('css', $messages_section_selector);
// Confirm a user without the permission to run readiness checks does not
// have a link to run the checks when the checks need to be run again.
$expected_results = $this->testResults['checker_1']['1 error'];
TestChecker1::setTestResult($expected_results);
// @todo Change this to use ::delayRequestTime() to simulate running cron
// after a 24 wait instead of directly deleting 'readiness_validation_last_run'
// https://www.drupal.org/node/3113971.
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value */
$key_value = $this->container
->get('keyvalue.expirable')
->get('automatic_updates');
$key_value
->delete('readiness_validation_last_run');
// A user without the permission to run the checkers will not see a message
// on other pages if the checkers need to be run again.
$this
->drupalGet('admin/structure');
$assert
->elementNotExists('css', $messages_section_selector);
// Confirm that a user with the correct permission can also run the checkers
// on another admin page.
$this
->drupalLogin($this->checkerRunnerUser);
$this
->drupalGet('admin/structure');
$assert
->elementExists('css', $messages_section_selector);
$assert
->pageTextContainsOnce('Your site has not recently run an update readiness check. Run readiness checks now.');
$this
->clickLink('Run readiness checks now.');
$assert
->addressEquals('admin/structure');
$assert
->pageTextContainsOnce($expected_results[0]
->getMessages()[0]);
$expected_results = $this->testResults['checker_1']['1 error 1 warning'];
TestChecker1::setTestResult($expected_results);
// Confirm a new message is displayed if the cron is run after an hour.
$this
->delayRequestTime();
$this
->cronRun();
$this
->drupalGet('admin/structure');
$assert
->pageTextContainsOnce(static::$errorsExplanation);
// Confirm on admin pages that a single error will be displayed instead of a
// summary.
$this
->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['1:error']
->getSeverity());
$assert
->pageTextContainsOnce($expected_results['1:error']
->getMessages()[0]);
$assert
->pageTextNotContains($expected_results['1:error']
->getSummary());
// Warnings are not displayed on admin pages if there are any errors.
$this
->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results['1:warning']
->getSeverity());
$assert
->pageTextNotContains($expected_results['1:warning']
->getMessages()[0]);
$assert
->pageTextNotContains($expected_results['1:warning']
->getSummary());
// Confirm that if cron runs less than hour after it previously ran it will
// not run the checkers again.
$unexpected_results = $this->testResults['checker_1']['2 errors 2 warnings'];
TestChecker1::setTestResult($unexpected_results);
$this
->delayRequestTime(30);
$this
->cronRun();
$this
->drupalGet('admin/structure');
$assert
->pageTextNotContains($unexpected_results['1:errors']
->getSummary());
$assert
->pageTextContainsOnce($expected_results['1:error']
->getMessages()[0]);
$assert
->pageTextNotContains($unexpected_results['1:warnings']
->getSummary());
$assert
->pageTextNotContains($expected_results['1:warning']
->getMessages()[0]);
// Confirm that is if cron is run over an hour after the checkers were
// previously run the checkers will be run again.
$this
->delayRequestTime(31);
$this
->cronRun();
$expected_results = $unexpected_results;
$this
->drupalGet('admin/structure');
// Confirm on admin pages only the error summary will be displayed if there
// is more than 1 error.
$this
->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['1:errors']
->getSeverity());
$assert
->pageTextNotContains($expected_results['1:errors']
->getMessages()[0]);
$assert
->pageTextNotContains($expected_results['1:errors']
->getMessages()[1]);
$assert
->pageTextContainsOnce($expected_results['1:errors']
->getSummary());
$assert
->pageTextContainsOnce(static::$errorsExplanation);
// Warnings are not displayed on admin pages if there are any errors.
$this
->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results['1:warnings']
->getSeverity());
$assert
->pageTextNotContains($expected_results['1:warnings']
->getMessages()[0]);
$assert
->pageTextNotContains($expected_results['1:warnings']
->getMessages()[1]);
$assert
->pageTextNotContains($expected_results['1:warnings']
->getSummary());
$expected_results = $this->testResults['checker_1']['2 warnings'];
TestChecker1::setTestResult($expected_results);
$this
->delayRequestTime();
$this
->cronRun();
$this
->drupalGet('admin/structure');
// Confirm that the warnings summary is displayed on admin pages if there
// are no errors.
$assert
->pageTextNotContains(static::$errorsExplanation);
$this
->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results[0]
->getSeverity());
$assert
->pageTextNotContains($expected_results[0]
->getMessages()[0]);
$assert
->pageTextNotContains($expected_results[0]
->getMessages()[1]);
$assert
->pageTextContainsOnce(static::$warningsExplanation);
$assert
->pageTextContainsOnce($expected_results[0]
->getSummary());
$expected_results = $this->testResults['checker_1']['1 warning'];
TestChecker1::setTestResult($expected_results);
$this
->delayRequestTime();
$this
->cronRun();
$this
->drupalGet('admin/structure');
$assert
->pageTextNotContains(static::$errorsExplanation);
// Confirm that a single warning is displayed and not the summary on admin
// pages if there is only 1 warning and there are no errors.
$this
->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results[0]
->getSeverity());
$assert
->pageTextContainsOnce(static::$warningsExplanation);
$assert
->pageTextContainsOnce($expected_results[0]
->getMessages()[0]);
$assert
->pageTextNotContains($expected_results[0]
->getSummary());
}
/**
* Tests installing a module with a checker before installing automatic_updates.
*/
public function testReadinessCheckAfterInstall() : void {
$assert = $this
->assertSession();
$this
->drupalLogin($this->checkerRunnerUser);
$this
->drupalGet('admin/reports/status');
$assert
->pageTextNotContains('Update readiness checks');
// We have to install the automatic_updates_test module because it provides
// the functionality to retrieve our fake release history metadata.
$this->container
->get('module_installer')
->install([
'automatic_updates',
'automatic_updates_test',
]);
$this
->drupalGet('admin/reports/status');
$this
->assertReadinessReportMatches('Your site is ready for automatic updates. Run readiness checks now.', 'checked');
$expected_results = $this->testResults['checker_1']['1 error'];
TestChecker2::setTestResult($expected_results);
$this->container
->get('module_installer')
->install([
'automatic_updates_test2',
]);
$this
->drupalGet('admin/structure');
$assert
->pageTextContainsOnce($expected_results[0]
->getMessages()[0]);
// Confirm that installing a module that does not provide a new checker does
// not run the checkers on install.
$unexpected_results = $this->testResults['checker_1']['2 errors 2 warnings'];
TestChecker2::setTestResult($unexpected_results);
$this->container
->get('module_installer')
->install([
'help',
]);
// Check for message on 'admin/structure' instead of the status report
// because checkers will be run if needed on the status report.
$this
->drupalGet('admin/structure');
// Confirm that new checker message is not displayed because the checker was
// not run again.
$assert
->pageTextContainsOnce($expected_results[0]
->getMessages()[0]);
$assert
->pageTextNotContains($unexpected_results['1:errors']
->getMessages()[0]);
$assert
->pageTextNotContains($unexpected_results['1:errors']
->getSummary());
}
/**
* Tests that checker message for an uninstalled module is not displayed.
*/
public function testReadinessCheckerUninstall() : void {
$assert = $this
->assertSession();
$this
->drupalLogin($this->checkerRunnerUser);
$expected_results_1 = $this->testResults['checker_1']['1 error'];
TestChecker1::setTestResult($expected_results_1);
$expected_results_2 = $this->testResults['checker_2']['1 error'];
TestChecker2::setTestResult($expected_results_2);
$this->container
->get('module_installer')
->install([
'automatic_updates',
'automatic_updates_test',
'automatic_updates_test2',
]);
// Check for message on 'admin/structure' instead of the status report
// because checkers will be run if needed on the status report.
$this
->drupalGet('admin/structure');
$assert
->pageTextContainsOnce($expected_results_1[0]
->getMessages()[0]);
$assert
->pageTextContainsOnce($expected_results_2[0]
->getMessages()[0]);
// Confirm that when on of the module is uninstalled the other module's
// checker result is still displayed.
$this->container
->get('module_installer')
->uninstall([
'automatic_updates_test2',
]);
$this
->drupalGet('admin/structure');
$assert
->pageTextNotContains($expected_results_2[0]
->getMessages()[0]);
$assert
->pageTextContainsOnce($expected_results_1[0]
->getMessages()[0]);
// Confirm that when on of the module is uninstalled the other module's
// checker result is still displayed.
$this->container
->get('module_installer')
->uninstall([
'automatic_updates_test',
]);
$this
->drupalGet('admin/structure');
$assert
->pageTextNotContains($expected_results_2[0]
->getMessages()[0]);
$assert
->pageTextNotContains($expected_results_1[0]
->getMessages()[0]);
}
/**
* Asserts status report readiness report item matches a format.
*
* @param string $format
* The string to match.
* @param string $section
* The section of the status report in which the string should appear.
* @param string $message_prefix
* The prefix for before the string.
*/
private function assertReadinessReportMatches(string $format, string $section = 'error', string $message_prefix = '') : void {
$format = 'Update readiness checks ' . ($message_prefix ? "{$message_prefix} " : '') . $format;
$text = $this
->getSession()
->getPage()
->find('css', "h3#{$section} ~ details.system-status-report__entry:contains('Update readiness checks')")
->getText();
$this
->assertStringMatchesFormat($format, $text);
}
/**
* Delays the request for the test.
*
* @param int $minutes
* The number of minutes to delay request time. Defaults to 61 minutes.
*/
private function delayRequestTime(int $minutes = 61) : void {
static $total_delay = 0;
$total_delay += $minutes;
TestTime::setFakeTimeByOffset("+{$total_delay} minutes");
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssertHelperTrait:: |
protected static | function | Casts MarkupInterface objects into strings. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead. | |
AssertLegacyTrait:: |
protected | function | Asserts whether an expected cache tag was present in the last response. | |
AssertLegacyTrait:: |
protected | function | Asserts that the element with the given CSS selector is not present. | |
AssertLegacyTrait:: |
protected | function | Asserts that the element with the given CSS selector is present. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Passes if the raw text IS found escaped on the loaded page, fail otherwise. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field exists with the given name or ID. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field exists with the given ID and value. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field exists with the given name and value. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
AssertLegacyTrait:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field exists in the current page with a given Xpath result. | |
AssertLegacyTrait:: |
protected | function | Checks that current response header equals value. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertSame() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Passes if a link with the specified label is found. | |
AssertLegacyTrait:: |
protected | function | Passes if a link containing a given href (part) is found. | |
AssertLegacyTrait:: |
protected | function | Asserts whether an expected cache tag was absent in the last response. | |
AssertLegacyTrait:: |
protected | function | Passes if the raw text is not found escaped on the loaded page. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field does NOT exist with the given name or ID. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
AssertLegacyTrait:: |
protected | function | Asserts that a field does not exist or its value does not match, by XPath. | |
AssertLegacyTrait:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
AssertLegacyTrait:: |
protected | function | Passes if a link with the specified label is not found. | |
AssertLegacyTrait:: |
protected | function | Passes if a link containing a given href (part) is not found. | |
AssertLegacyTrait:: |
protected | function | Asserts that a select option does NOT exist in the current page. | |
AssertLegacyTrait:: |
protected | function | Triggers a pass if the Perl regex pattern is not found in the raw content. | |
AssertLegacyTrait:: |
protected | function | Passes if the raw text IS not found on the loaded page, fail otherwise. | 1 |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Passes if the page (with HTML stripped) does not contains the text. | 1 |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotSame() instead. | |
AssertLegacyTrait:: |
protected | function | Passes if the text is found MORE THAN ONCE on the text version of the page. | |
AssertLegacyTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertLegacyTrait:: |
protected | function | Asserts that a select option with the visible text exists. | |
AssertLegacyTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertLegacyTrait:: |
protected | function | Triggers a pass if the Perl regex pattern is found in the raw content. | |
AssertLegacyTrait:: |
protected | function | Passes if the raw text IS found on the loaded page, fail otherwise. | 1 |
AssertLegacyTrait:: |
protected | function | Asserts the page responds with the specified response code. | 1 |
AssertLegacyTrait:: |
protected | function | Passes if the page (with HTML stripped) contains the text. | 1 |
AssertLegacyTrait:: |
protected | function | Helper for assertText and assertNoText. | |
AssertLegacyTrait:: |
protected | function | Pass if the page title is the given string. | |
AssertLegacyTrait:: |
protected | function | Passes if the text is found ONLY ONCE on the text version of the page. | |
AssertLegacyTrait:: |
protected | function | Passes if the internal browser's URL matches the given path. | |
AssertLegacyTrait:: |
protected | function | Builds an XPath query. | |
AssertLegacyTrait:: |
protected | function | Helper: Constructs an XPath for the given set of attributes and value. | |
AssertLegacyTrait:: |
protected | function | Get all option elements, including nested options, in a select. | |
AssertLegacyTrait:: |
protected | function | Gets the current raw content. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead. | |
AssertLegacyTrait:: |
protected | function | ||
AutomaticUpdatesFunctionalTestBase:: |
protected static | property |
Modules to enable. Overrides BrowserTestBase:: |
2 |
AutomaticUpdatesFunctionalTestBase:: |
protected | function | Checks for available updates. | |
AutomaticUpdatesFunctionalTestBase:: |
protected | function |
Prepares site settings and services before installation. Overrides FunctionalTestSetupTrait:: |
|
AutomaticUpdatesFunctionalTestBase:: |
protected | function | Sets the current (running) version of core, as known to the Update module. | |
AutomaticUpdatesFunctionalTestBase:: |
protected | function | Sets the release metadata file to use when fetching available updates. | |
BlockCreationTrait:: |
protected | function | Creates a block instance based on default settings. Aliased as: drupalPlaceBlock | |
BrowserHtmlDebugTrait:: |
protected | property | The Base URI to use for links to the output files. | |
BrowserHtmlDebugTrait:: |
protected | property | Class name for HTML output logging. | |
BrowserHtmlDebugTrait:: |
protected | property | Counter for HTML output logging. | |
BrowserHtmlDebugTrait:: |
protected | property | Counter storage for HTML output logging. | |
BrowserHtmlDebugTrait:: |
protected | property | Directory name for HTML output logging. | |
BrowserHtmlDebugTrait:: |
protected | property | HTML output output enabled. | |
BrowserHtmlDebugTrait:: |
protected | property | The file name to write the list of URLs to. | |
BrowserHtmlDebugTrait:: |
protected | property | HTML output test ID. | |
BrowserHtmlDebugTrait:: |
protected | function | Formats HTTP headers as string for HTML output logging. | |
BrowserHtmlDebugTrait:: |
protected | function | Returns headers in HTML output format. | 1 |
BrowserHtmlDebugTrait:: |
protected | function | Logs a HTML output message in a text file. | |
BrowserHtmlDebugTrait:: |
protected | function | Creates the directory to store browser output. | |
BrowserTestBase:: |
protected | property | The base URL. | |
BrowserTestBase:: |
protected | property | The config importer that can be used in a test. | |
BrowserTestBase:: |
protected | property | An array of custom translations suitable for drupal_rewrite_settings(). | |
BrowserTestBase:: |
protected | property | The database prefix of this test run. | |
BrowserTestBase:: |
protected | property | Mink session manager. | |
BrowserTestBase:: |
protected | property | ||
BrowserTestBase:: |
protected | property | 1 | |
BrowserTestBase:: |
protected | property | The original container. | |
BrowserTestBase:: |
protected | property | The original array of shutdown function callbacks. | |
BrowserTestBase:: |
protected | property | ||
BrowserTestBase:: |
protected | property | The profile to install as a basis for testing. | 39 |
BrowserTestBase:: |
protected | property | The app root. | |
BrowserTestBase:: |
protected | property | Browser tests are run in separate processes to prevent collisions between code that may be loaded by tests. | |
BrowserTestBase:: |
protected | property | Time limit in seconds for the test. | |
BrowserTestBase:: |
protected | property | The translation file directory for the test environment. | |
BrowserTestBase:: |
protected | function | Clean up the Simpletest environment. | |
BrowserTestBase:: |
protected | function | Configuration accessor for tests. Returns non-overridden configuration. | |
BrowserTestBase:: |
protected | function | Translates a CSS expression to its XPath equivalent. | |
BrowserTestBase:: |
protected | function | Gets the value of an HTTP response header. | |
BrowserTestBase:: |
protected | function | Returns all response headers. | |
BrowserTestBase:: |
public static | function | Ensures test files are deletable. | |
BrowserTestBase:: |
protected | function | Gets an instance of the default Mink driver. | |
BrowserTestBase:: |
protected | function | Gets the JavaScript drupalSettings variable for the currently-loaded page. | 1 |
BrowserTestBase:: |
protected | function | Obtain the HTTP client for the system under test. | |
BrowserTestBase:: |
protected | function | Get the Mink driver args from an environment variable, if it is set. Can be overridden in a derived class so it is possible to use a different value for a subset of tests, e.g. the JavaScript tests. | 1 |
BrowserTestBase:: |
protected | function | Helper function to get the options of select field. | |
BrowserTestBase:: |
protected | function |
Provides a Guzzle middleware handler to log every response received. Overrides BrowserHtmlDebugTrait:: |
|
BrowserTestBase:: |
public | function | Returns Mink session. | |
BrowserTestBase:: |
protected | function | Get session cookies from current session. | |
BrowserTestBase:: |
protected | function |
Retrieves the current calling line in the class under test. Overrides BrowserHtmlDebugTrait:: |
|
BrowserTestBase:: |
protected | function | Visits the front page when initializing Mink. | 3 |
BrowserTestBase:: |
protected | function | Initializes Mink sessions. | 1 |
BrowserTestBase:: |
public | function | Installs Drupal into the Simpletest site. | 1 |
BrowserTestBase:: |
protected | function | Registers additional Mink sessions. | |
BrowserTestBase:: |
protected | function | 3 | |
BrowserTestBase:: |
protected | function | Transforms a nested array into a flat array suitable for drupalPostForm(). | |
BrowserTestBase:: |
protected | function | Performs an xpath search on the contents of the internal browser. | |
BrowserTestBase:: |
public | function | 1 | |
BrowserTestBase:: |
public | function | Prevents serializing any properties. | |
ConfigTestTrait:: |
protected | function | Returns a ConfigImporter object to import test configuration. | |
ConfigTestTrait:: |
protected | function | Copies configuration objects from source storage to target storage. | |
ContentTypeCreationTrait:: |
protected | function | Creates a custom content type based on default settings. Aliased as: drupalCreateContentType | 1 |
CronRunTrait:: |
protected | function | Runs cron on the test site. | |
FunctionalTestSetupTrait:: |
protected | property | The flag to set 'apcu_ensure_unique_prefix' setting. | 1 |
FunctionalTestSetupTrait:: |
protected | property | The class loader to use for installation and initialization of setup. | |
FunctionalTestSetupTrait:: |
protected | property | The config directories used in this test. | |
FunctionalTestSetupTrait:: |
protected | property | The "#1" admin user. | |
FunctionalTestSetupTrait:: |
protected | function | Execute the non-interactive installer. | 1 |
FunctionalTestSetupTrait:: |
protected | function | Returns all supported database driver installer objects. | |
FunctionalTestSetupTrait:: |
protected | function | Initialize various configurations post-installation. | 2 |
FunctionalTestSetupTrait:: |
protected | function | Initializes the kernel after installation. | |
FunctionalTestSetupTrait:: |
protected | function | Initialize settings created during install. | |
FunctionalTestSetupTrait:: |
protected | function | Initializes user 1 for the site to be installed. | |
FunctionalTestSetupTrait:: |
protected | function | Installs the default theme defined by `static::$defaultTheme` when needed. | |
FunctionalTestSetupTrait:: |
protected | function | Install modules defined by `static::$modules`. | 1 |
FunctionalTestSetupTrait:: |
protected | function | Returns the parameters that will be used when Simpletest installs Drupal. | 9 |
FunctionalTestSetupTrait:: |
protected | function | Prepares the current environment for running the test. | 23 |
FunctionalTestSetupTrait:: |
protected | function | Creates a mock request and sets it on the generator. | |
FunctionalTestSetupTrait:: |
protected | function | Resets and rebuilds the environment after setup. | |
FunctionalTestSetupTrait:: |
protected | function | Rebuilds \Drupal::getContainer(). | |
FunctionalTestSetupTrait:: |
protected | function | Resets all data structures after having enabled new modules. | |
FunctionalTestSetupTrait:: |
protected | function | Changes parameters in the services.yml file. | |
FunctionalTestSetupTrait:: |
protected | function | Sets up the base URL based upon the environment variable. | |
FunctionalTestSetupTrait:: |
protected | function | Rewrites the settings.php file of the test site. | |
NodeCreationTrait:: |
protected | function | Creates a node based on default settings. Aliased as: drupalCreateNode | |
NodeCreationTrait:: |
public | function | Get a node from the database based on its title. Aliased as: drupalGetNodeByTitle | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
RandomGeneratorTrait:: |
protected | property | The random generator. | |
RandomGeneratorTrait:: |
protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait:: |
protected | function | Generates a unique random string containing letters and numbers. | 1 |
RandomGeneratorTrait:: |
public | function | Generates a random PHP object. | |
RandomGeneratorTrait:: |
public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
RandomGeneratorTrait:: |
public | function | Callback for random string validation. | |
ReadinessValidationTest:: |
protected | property | A user who can view the status report and run readiness checkers. | |
ReadinessValidationTest:: |
protected | property |
The theme to install as the default for testing. Overrides BrowserTestBase:: |
|
ReadinessValidationTest:: |
protected | property | A user who can view the status report. | |
ReadinessValidationTest:: |
protected | property | The test checker. | |
ReadinessValidationTest:: |
private | function | Asserts status report readiness report item matches a format. | |
ReadinessValidationTest:: |
private | function | Delays the request for the test. | |
ReadinessValidationTest:: |
protected | function |
Overrides BrowserTestBase:: |
|
ReadinessValidationTest:: |
public | function | Tests installing a module with a checker before installing automatic_updates. | |
ReadinessValidationTest:: |
public | function | Tests that checker message for an uninstalled module is not displayed. | |
ReadinessValidationTest:: |
public | function | Tests readiness checkers results on admin pages.. | |
ReadinessValidationTest:: |
public | function | Tests readiness checkers on status report page. | |
RefreshVariablesTrait:: |
protected | function | Refreshes in-memory configuration and state information. | 3 |
SessionTestTrait:: |
protected | property | The name of the session cookie. | |
SessionTestTrait:: |
protected | function | Generates a session cookie name. | |
SessionTestTrait:: |
protected | function | Returns the session name in use on the child site. | |
StorageCopyTrait:: |
protected static | function | Copy the configuration from one storage to another and remove stale items. | |
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. | |
TestRequirementsTrait:: |
private | function | Checks missing module requirements. | |
TestRequirementsTrait:: |
protected | function | Check module requirements for the Drupal use case. | 1 |
TestRequirementsTrait:: |
protected static | function | Returns the Drupal root directory. | |
TestSetupTrait:: |
protected static | property | An array of config object names that are excluded from schema checking. | |
TestSetupTrait:: |
protected | property | The dependency injection container used in the test. | |
TestSetupTrait:: |
protected | property | The DrupalKernel instance used in the test. | |
TestSetupTrait:: |
protected | property | The site directory of the original parent site. | |
TestSetupTrait:: |
protected | property | The private file directory for the test environment. | |
TestSetupTrait:: |
protected | property | The public file directory for the test environment. | |
TestSetupTrait:: |
protected | property | The site directory of this test run. | |
TestSetupTrait:: |
protected | property | Set to TRUE to strict check all configuration saved. | 2 |
TestSetupTrait:: |
protected | property | The temporary file directory for the test environment. | |
TestSetupTrait:: |
protected | property | The test run ID. | |
TestSetupTrait:: |
protected | function | Changes the database connection to the prefixed one. | |
TestSetupTrait:: |
protected | function | Gets the config schema exclusions for this test. | |
TestSetupTrait:: |
public static | function | Returns the database connection to the site running Simpletest. | |
TestSetupTrait:: |
protected | function | Generates a database prefix for running tests. | 2 |
UiHelperTrait:: |
protected | property | The current user logged in using the Mink controlled browser. | |
UiHelperTrait:: |
protected | property | The number of meta refresh redirects to follow, or NULL if unlimited. | |
UiHelperTrait:: |
protected | property | The number of meta refresh redirects followed during ::drupalGet(). | |
UiHelperTrait:: |
public | function | Returns WebAssert object. | 1 |
UiHelperTrait:: |
protected | function | Builds an a absolute URL from a system path or a URL object. | |
UiHelperTrait:: |
protected | function | Checks for meta refresh tag and if found call drupalGet() recursively. | |
UiHelperTrait:: |
protected | function | Clicks the element with the given CSS selector. | |
UiHelperTrait:: |
protected | function | Follows a link by complete name. | |
UiHelperTrait:: |
protected | function | Searches elements using a CSS selector in the raw content. | |
UiHelperTrait:: |
protected | function | Retrieves a Drupal path or an absolute path. | 3 |
UiHelperTrait:: |
protected | function | Logs in a user using the Mink controlled browser. | |
UiHelperTrait:: |
protected | function | Logs a user out of the Mink controlled browser and confirms. | |
UiHelperTrait:: |
protected | function | Executes a form submission. | |
UiHelperTrait:: |
protected | function | Returns whether a given user account is logged in. | |
UiHelperTrait:: |
protected | function | Takes a path and returns an absolute path. | |
UiHelperTrait:: |
protected | function | Retrieves the plain-text content from the current page. | |
UiHelperTrait:: |
protected | function | Get the current URL from the browser. | |
UiHelperTrait:: |
protected | function | Prepare for a request to testing site. | 1 |
UiHelperTrait:: |
protected | function | Fills and submits a form. | |
UserCreationTrait:: |
protected | function | Checks whether a given list of permission names is valid. | |
UserCreationTrait:: |
protected | function | Creates an administrative role. | |
UserCreationTrait:: |
protected | function | Creates a role with specified permissions. Aliased as: drupalCreateRole | |
UserCreationTrait:: |
protected | function | Create a user with a given set of permissions. Aliased as: drupalCreateUser | |
UserCreationTrait:: |
protected | function | Grant permissions to a user role. | |
UserCreationTrait:: |
protected | function | Switch the current logged in user. | |
UserCreationTrait:: |
protected | function | Creates a random user account and sets it as current user. | |
ValidationTestTrait:: |
protected static | property | Expected explanation text when readiness checkers return error messages. | |
ValidationTestTrait:: |
protected | property | Test validation results. | |
ValidationTestTrait:: |
protected static | property | Expected explanation text when readiness checkers return warning messages. | |
ValidationTestTrait:: |
protected | function | Asserts expected validation results from the manager. | |
ValidationTestTrait:: |
protected | function | Asserts two validation result sets are equal. | |
ValidationTestTrait:: |
protected | function | Creates ValidationResult objects to be used in tests. | |
ValidationTestTrait:: |
protected | function | Gets the messages of a particular type from the manager. | |
XdebugRequestTrait:: |
protected | function | Adds xdebug cookies, from request setup. |