Skip to content
Snippets Groups Projects
Commit 91f16bad authored by Adam G-H's avatar Adam G-H Committed by Ted Bowman
Browse files

Issue #3409774 by phenaproxima, tedbow: Run functional tests on GitLab CI

parent 849277cb
No related branches found
Tags 3.0.0
1 merge request!1005Enable functional tests and see what breaks
Pipeline #68826 failed
...@@ -120,13 +120,13 @@ composer: ...@@ -120,13 +120,13 @@ composer:
- rm expand_composer_json.php - rm expand_composer_json.php
- composer create-project --no-install drupal/recommended-project:$_TARGET_CORE ./composer/Template/RecommendedProject - composer create-project --no-install drupal/recommended-project:$_TARGET_CORE ./composer/Template/RecommendedProject
- composer create-project --no-install drupal/legacy-project:$_TARGET_CORE ./composer/Template/LegacyProject - composer create-project --no-install drupal/legacy-project:$_TARGET_CORE ./composer/Template/LegacyProject
- composer run core-convert --working-dir=./modules/contrib/automatic_updates -- $PWD --gitlabci - composer run core-convert --working-dir=./modules/contrib/automatic_updates -- $PWD --gitlabci --core_target_branch=10.1.x
- test -d ./core/modules/package_manager - test -d ./core/modules/package_manager
- test -d ./core/modules/auto_updates - test -d ./core/modules/auto_updates
- rm -r -f ./modules/contrib - rm -r -f ./modules/contrib
phpunit: phpunit:
extends: .phpunit-base stage: test
parallel: parallel:
matrix: matrix:
- MODULE: - MODULE:
...@@ -135,9 +135,74 @@ phpunit: ...@@ -135,9 +135,74 @@ phpunit:
TEST_TYPE: TEST_TYPE:
- PHPUnit-Unit - PHPUnit-Unit
- PHPUnit-Kernel - PHPUnit-Kernel
- PHPUnit-Functional
rules:
- if: '$SKIP_PHPUNIT == "1"'
when: never
- when: on_success
needs: [ "composer" ]
extends:
- .test-variables
variables: variables:
COMPOSER_HOME: '$CI_PROJECT_DIR/.composer' SYMFONY_DEPRECATIONS_HELPER: weak
_PHPUNIT_CONCURRENT: '1'
_PHPUNIT_EXTRA: '--types $TEST_TYPE --module $MODULE'
_PHPUNIT_TESTGROUPS: '--verbose' _PHPUNIT_TESTGROUPS: '--verbose'
_WEB_ROOT: '$CI_PROJECT_DIR' _PHPUNIT_EXTRA: '--types $TEST_TYPE --module $MODULE'
SIMPLETEST_BASE_URL: 'http://localhost'
services:
- name: $_CONFIG_DOCKERHUB_ROOT/$_TARGET_DB_TYPE-$_TARGET_DB_VERSION:production
alias: database
- name: $_CONFIG_DOCKERHUB_ROOT/chromedriver:production
alias: chrome
entrypoint:
- chromedriver
- "--no-sandbox"
- "--log-path=/tmp/chromedriver.log"
- "--verbose"
- "--whitelisted-ips="
script:
# Set up the web server. This is a copy of the &setup-websever anchor from the upstream template.
- mkdir -p $BROWSERTEST_OUTPUT_DIRECTORY
- mkdir -p $CI_PROJECT_DIR/sites/default/files/simpletest
- chmod -R 755 $BROWSERTEST_OUTPUT_DIRECTORY
- chmod -R 755 $CI_PROJECT_DIR/sites/default/files/simpletest
- sudo rm -r -f /var/www/html
- ln -s $CI_PROJECT_DIR /var/www/html
- chown -R www-data:www-data $CI_PROJECT_DIR
- service apache2 start
- curl $SIMPLETEST_BASE_URL
# Set up the database. This is a copy of the &simpletest-db anchor from the upstream template.
- |
[[ $_TARGET_DB_TYPE == "sqlite" ]] && export SIMPLETEST_DB=sqlite://localhost/sites/default/files/db.sqlite
[[ $_TARGET_DB_TYPE == "mysql" ]] && export SIMPLETEST_DB=mysql://$MYSQL_USER:$MYSQL_PASSWORD@database/$MYSQL_DATABASE
[[ $_TARGET_DB_TYPE == "pgsql" ]] && export SIMPLETEST_DB=pgsql://$POSTGRES_USER:$POSTGRES_PASSWORD@database/$POSTGRES_DB
# Provide some context on the test run.
- vendor/bin/drush status
# Remove all spaces from _PHPUNIT_TESTGROUPS for reliable checking and to
# ensure only one string is passed to bin/phpunit or run-tests.sh
- _PHPUNIT_TESTGROUPS=$(echo $_PHPUNIT_TESTGROUPS | sed -e 's/ //g')
# Execute tests.
- |
# if _PHPUNIT_TESTGROUPS is blank then do not add anything, because the test group will be handled by the matrix.
# if _PHPUNIT_TESTGROUPS is --all then add --directory modules/custom/$CI_PROJECT_NAME
# Otherwise add $_PHPUNIT_TESTGROUPS (without the --group)
WHAT_TO_RUN=$([[ "$_PHPUNIT_TESTGROUPS" == "" ]] && echo "" || ([[ "$_PHPUNIT_TESTGROUPS" == "--all" ]] && echo "--directory modules/custom/$CI_PROJECT_NAME" || echo "$_PHPUNIT_TESTGROUPS"))
echo "_PHPUNIT_CONCURRENT=$_PHPUNIT_CONCURRENT, _PHPUNIT_TESTGROUPS=$_PHPUNIT_TESTGROUPS, WHAT_TO_RUN=$WHAT_TO_RUN"
echo "executing: sudo SYMFONY_DEPRECATIONS_HELPER='$SYMFONY_DEPRECATIONS_HELPER' MINK_DRIVER_ARGS_WEBDRIVER='$MINK_DRIVER_ARGS_WEBDRIVER' -u www-data php $CI_PROJECT_DIR/core/scripts/run-tests.sh --color --keep-results --concurrency '32' --repeat '1' --sqlite 'sites/default/files/.sqlite' --dburl $SIMPLETEST_DB --url $SIMPLETEST_BASE_URL --verbose --non-html $WHAT_TO_RUN $_PHPUNIT_EXTRA"
sudo SYMFONY_DEPRECATIONS_HELPER="$SYMFONY_DEPRECATIONS_HELPER" MINK_DRIVER_ARGS_WEBDRIVER="$MINK_DRIVER_ARGS_WEBDRIVER" -u www-data php $CI_PROJECT_DIR/core/scripts/run-tests.sh --color --keep-results --concurrency "32" --repeat "1" --sqlite "sites/default/files/.sqlite" --dburl $SIMPLETEST_DB --url $SIMPLETEST_BASE_URL --xml $CI_PROJECT_DIR/sites/default/files/simpletest --verbose --non-html $WHAT_TO_RUN $_PHPUNIT_EXTRA || EXIT_CODE=$?
- cp /var/log/apache2/test.apache.access.log $CI_PROJECT_DIR/apache.access.log.txt
- cp /var/log/apache2/test.apache.error.log $CI_PROJECT_DIR/apache.error.log.txt
- exit $EXIT_CODE
artifacts:
expire_in: 6 mos
expose_as: 'junit-browser_output-apache_log'
when: always
reports:
junit:
- junit.xml
- $CI_PROJECT_DIR/$_WEB_ROOT/sites/default/files/simpletest/phpunit-*.xml
paths:
- junit.xml
- $CI_PROJECT_DIR/$_WEB_ROOT/sites/default/files/simpletest
- $BROWSERTEST_OUTPUT_DIRECTORY
- apache.access.log.txt
- apache.error.log.txt
...@@ -67,7 +67,7 @@ class FailureMarkerRequirementTest extends BrowserTestBase { ...@@ -67,7 +67,7 @@ class FailureMarkerRequirementTest extends BrowserTestBase {
$this->drupalGet('/admin/reports/status'); $this->drupalGet('/admin/reports/status');
$assert_session = $this->assertSession(); $assert_session = $this->assertSession();
$assert_session->pageTextContains('Failed update detected'); $assert_session->pageTextContains('Failed update detected');
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
} }
} }
...@@ -186,6 +186,12 @@ class ConverterCommand extends Command { ...@@ -186,6 +186,12 @@ class ConverterCommand extends Command {
// This allows line that only need to be in the core MR to be commented // This allows line that only need to be in the core MR to be commented
// out. // out.
'// CORE_MR_ONLY:' => '', '// CORE_MR_ONLY:' => '',
// Note this following line could leave 'CORE_MR_ONLY-10.1.x' comments in
// the core MR, but we currently do not have any. Leaving
// 'CORE_MR_ONLY-11.x' in is fine because we don't actually convert to
// 10.1.x for a core MR. We might want to just remove the whole line if
// it does not match the core target branch.
"// CORE_MR_ONLY-{$this->core_target_branch}:" => '',
$old_machine_name => $new_machine_name, $old_machine_name => $new_machine_name,
'AutomaticUpdates' => 'AutoUpdates', 'AutomaticUpdates' => 'AutoUpdates',
"__DIR__ . '/../../../package_manager/tests" => "__DIR__ . '/../../../../Xpackage_manager/tests", "__DIR__ . '/../../../package_manager/tests" => "__DIR__ . '/../../../../Xpackage_manager/tests",
......
...@@ -33,7 +33,7 @@ class HelpPageTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -33,7 +33,7 @@ class HelpPageTest extends AutomaticUpdatesFunctionalTestBase {
public function testHelpPage(): void { public function testHelpPage(): void {
$user = $this->createUser([ $user = $this->createUser([
'access administration pages', 'access administration pages',
// CORE_MR_ONLY:'access help pages', // CORE_MR_ONLY-11.x:'access help pages',
]); ]);
$this->drupalLogin($user); $this->drupalLogin($user);
$this->drupalGet('/admin/help/automatic_updates'); $this->drupalGet('/admin/help/automatic_updates');
......
...@@ -27,7 +27,7 @@ class PreUpdateTest extends UpdaterFormTestBase { ...@@ -27,7 +27,7 @@ class PreUpdateTest extends UpdaterFormTestBase {
$this->checkForUpdates(); $this->checkForUpdates();
$this->drupalGet('/admin/reports/updates/update'); $this->drupalGet('/admin/reports/updates/update');
$assert_session->pageTextContains('No update available'); $assert_session->pageTextContains('No update available');
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
} }
/** /**
......
...@@ -65,8 +65,8 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase { ...@@ -65,8 +65,8 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase {
$this->drupalGet('/admin/modules/update'); $this->drupalGet('/admin/modules/update');
// The warning should be visible. // The warning should be visible.
$assert_session = $this->assertSession(); $assert_session = $this->assertSession();
$assert_session->pageTextContains(reset($messages)); $assert_session->pageTextContains((reset($messages))->render());
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
$page->pressButton('Update to 9.8.1'); $page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1); $this->assertUpdateStagedTimes(1);
...@@ -79,7 +79,7 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase { ...@@ -79,7 +79,7 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase {
// a warning about pending database updates. Once the staged changes have // a warning about pending database updates. Once the staged changes have
// been applied, we should be redirected to update.php, where neither // been applied, we should be redirected to update.php, where neither
// warning should be visible. // warning should be visible.
$assert_session->pageTextContains(reset($messages)); $assert_session->pageTextContains((reset($messages))->render());
// Ensure that a list of pending database updates is visible, along with a // Ensure that a list of pending database updates is visible, along with a
// short explanation, in the warning messages. // short explanation, in the warning messages.
...@@ -92,7 +92,7 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase { ...@@ -92,7 +92,7 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase {
else { else {
$assert_session->checkboxChecked('maintenance_mode'); $assert_session->checkboxChecked('maintenance_mode');
} }
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
$page->pressButton('Continue'); $page->pressButton('Continue');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
// Confirm that the site was in maintenance before the update was applied. // Confirm that the site was in maintenance before the update was applied.
...@@ -109,8 +109,8 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase { ...@@ -109,8 +109,8 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase {
$assert_session->linkByHrefExists('/update.php'); $assert_session->linkByHrefExists('/update.php');
$page->clickLink('database update script'); $page->clickLink('database update script');
$assert_session->addressEquals('/update.php'); $assert_session->addressEquals('/update.php');
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
$assert_session->pageTextNotContains(reset($messages)); $assert_session->pageTextNotContains((reset($messages))->render());
$assert_session->pageTextNotContains($possible_update_message); $assert_session->pageTextNotContains($possible_update_message);
$this->assertTrue($state->get('system.maintenance_mode')); $this->assertTrue($state->get('system.maintenance_mode'));
$page->clickLink('Continue'); $page->clickLink('Continue');
...@@ -121,7 +121,7 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase { ...@@ -121,7 +121,7 @@ class StagedDatabaseUpdateTest extends UpdaterFormTestBase {
$assert_session->pageTextContains('Updates were attempted.'); $assert_session->pageTextContains('Updates were attempted.');
// Confirm the site was returned to the original maintenance module state. // Confirm the site was returned to the original maintenance module state.
$this->assertSame($state->get('system.maintenance_mode'), $maintenance_mode_on); $this->assertSame($state->get('system.maintenance_mode'), $maintenance_mode_on);
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
} }
} }
...@@ -108,7 +108,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -108,7 +108,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// Cron Updates will always be disabled on installation as per // Cron Updates will always be disabled on installation as per
// automatic_updates.settings.yml . // automatic_updates.settings.yml .
$session = $this->assertSession(); $session = $this->assertSession();
$session->pageTextNotContains($expected_result->messages[0]); $session->pageTextNotContains($expected_result->messages[0]->render());
$session->linkExists('See status report for more details.'); $session->linkExists('See status report for more details.');
} }
...@@ -301,11 +301,11 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -301,11 +301,11 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// Confirm on admin pages that the summary will be displayed. // Confirm on admin pages that the summary will be displayed.
$this->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['1 error']->severity); $this->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['1 error']->severity);
$assert->pageTextContainsOnce((string) $expected_results['1 error']->summary); $assert->pageTextContainsOnce((string) $expected_results['1 error']->summary);
$assert->pageTextNotContains($expected_results['1 error']->messages[0]); $assert->pageTextNotContains($expected_results['1 error']->messages[0]->render());
// Warnings are not displayed on admin pages if there are any errors. // Warnings are not displayed on admin pages if there are any errors.
$this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results['1 warning']->severity); $this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results['1 warning']->severity);
$assert->pageTextNotContains($expected_results['1 warning']->messages[0]); $assert->pageTextNotContains($expected_results['1 warning']->messages[0]->render());
$assert->pageTextNotContains($expected_results['1 warning']->summary); $assert->pageTextNotContains($expected_results['1 warning']->summary->render());
// Confirm the status check event is not dispatched on every admin page // Confirm the status check event is not dispatched on every admin page
// load. // load.
...@@ -315,10 +315,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -315,10 +315,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
]; ];
TestSubscriber1::setTestResult($unexpected_results, StatusCheckEvent::class); TestSubscriber1::setTestResult($unexpected_results, StatusCheckEvent::class);
$this->drupalGet(Url::fromRoute($admin_route)); $this->drupalGet(Url::fromRoute($admin_route));
$assert->pageTextNotContains($unexpected_results['2 errors']->summary); $assert->pageTextNotContains($unexpected_results['2 errors']->summary->render());
$assert->pageTextContainsOnce((string) $expected_results['1 error']->summary); $assert->pageTextContainsOnce((string) $expected_results['1 error']->summary->render());
$assert->pageTextNotContains($unexpected_results['2 warnings']->summary); $assert->pageTextNotContains($unexpected_results['2 warnings']->summary->render());
$assert->pageTextNotContains($expected_results['1 warning']->messages[0]); $assert->pageTextNotContains($expected_results['1 warning']->messages[0]->render());
// Confirm the updated results will be shown when status checks are run // Confirm the updated results will be shown when status checks are run
// again. // again.
...@@ -328,15 +328,15 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -328,15 +328,15 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// Confirm on admin pages only the error summary will be displayed if there // Confirm on admin pages only the error summary will be displayed if there
// is more than 1 error. // is more than 1 error.
$this->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['2 errors']->severity); $this->assertSame(SystemManager::REQUIREMENT_ERROR, $expected_results['2 errors']->severity);
$assert->pageTextNotContains($expected_results['2 errors']->messages[0]); $assert->pageTextNotContains($expected_results['2 errors']->messages[0]->render());
$assert->pageTextNotContains($expected_results['2 errors']->messages[1]); $assert->pageTextNotContains($expected_results['2 errors']->messages[1]->render());
$assert->pageTextContainsOnce($expected_results['2 errors']->summary); $assert->pageTextContainsOnce($expected_results['2 errors']->summary->render());
$assert->pageTextContainsOnce(static::$errorsExplanation); $assert->pageTextContainsOnce(static::$errorsExplanation);
// Warnings are not displayed on admin pages if there are any errors. // Warnings are not displayed on admin pages if there are any errors.
$this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results['2 warnings']->severity); $this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results['2 warnings']->severity);
$assert->pageTextNotContains($expected_results['2 warnings']->messages[0]); $assert->pageTextNotContains($expected_results['2 warnings']->messages[0]->render());
$assert->pageTextNotContains($expected_results['2 warnings']->messages[1]); $assert->pageTextNotContains($expected_results['2 warnings']->messages[1]->render());
$assert->pageTextNotContains($expected_results['2 warnings']->summary); $assert->pageTextNotContains($expected_results['2 warnings']->summary->render());
$expected_results = [$this->createValidationResult(SystemManager::REQUIREMENT_WARNING, 2)]; $expected_results = [$this->createValidationResult(SystemManager::REQUIREMENT_WARNING, 2)];
TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class); TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class);
...@@ -346,10 +346,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -346,10 +346,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// are no errors. // are no errors.
$assert->pageTextNotContains(static::$errorsExplanation); $assert->pageTextNotContains(static::$errorsExplanation);
$this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results[0]->severity); $this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results[0]->severity);
$assert->pageTextNotContains($expected_results[0]->messages[0]); $assert->pageTextNotContains($expected_results[0]->messages[0]->render());
$assert->pageTextNotContains($expected_results[0]->messages[1]); $assert->pageTextNotContains($expected_results[0]->messages[1]->render());
$assert->pageTextContainsOnce(static::$warningsExplanation); $assert->pageTextContainsOnce(static::$warningsExplanation);
$assert->pageTextContainsOnce($expected_results[0]->summary); $assert->pageTextContainsOnce($expected_results[0]->summary->render());
$expected_results = [$this->createValidationResult(SystemManager::REQUIREMENT_WARNING)]; $expected_results = [$this->createValidationResult(SystemManager::REQUIREMENT_WARNING)];
TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class); TestSubscriber1::setTestResult($expected_results, StatusCheckEvent::class);
...@@ -360,8 +360,8 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -360,8 +360,8 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// pages if there is only 1 warning and there are no errors. // pages if there is only 1 warning and there are no errors.
$this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results[0]->severity); $this->assertSame(SystemManager::REQUIREMENT_WARNING, $expected_results[0]->severity);
$assert->pageTextContainsOnce(static::$warningsExplanation); $assert->pageTextContainsOnce(static::$warningsExplanation);
$assert->pageTextContainsOnce((string) $expected_results[0]->summary); $assert->pageTextContainsOnce((string) $expected_results[0]->summary->render());
$assert->pageTextNotContains($expected_results[0]->messages[0]); $assert->pageTextNotContains($expected_results[0]->messages[0]->render());
// Confirm status check messages are not displayed when cron updates are // Confirm status check messages are not displayed when cron updates are
// disabled. // disabled.
...@@ -371,7 +371,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -371,7 +371,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
$this->drupalGet('admin/structure'); $this->drupalGet('admin/structure');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$assert->pageTextNotContains(static::$warningsExplanation); $assert->pageTextNotContains(static::$warningsExplanation);
$assert->pageTextNotContains($expected_results[0]->messages[0]); $assert->pageTextNotContains($expected_results[0]->messages[0]->render());
} }
/** /**
...@@ -399,7 +399,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -399,7 +399,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
TestSubscriber2::setTestResult($expected_results, StatusCheckEvent::class); TestSubscriber2::setTestResult($expected_results, StatusCheckEvent::class);
$this->container->get('module_installer')->install(['automatic_updates_test_status_checker']); $this->container->get('module_installer')->install(['automatic_updates_test_status_checker']);
$this->drupalGet('admin/structure'); $this->drupalGet('admin/structure');
$assert->pageTextContainsOnce((string) $expected_results[0]->summary); $assert->pageTextContainsOnce((string) $expected_results[0]->summary->render());
// Confirm that installing a module runs the checkers, even if the new // Confirm that installing a module runs the checkers, even if the new
// module does not provide any validators. // module does not provide any validators.
...@@ -414,9 +414,9 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -414,9 +414,9 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// because validators will be run if needed on the status report. // because validators will be run if needed on the status report.
$this->drupalGet('admin/structure'); $this->drupalGet('admin/structure');
// Confirm that new checker messages are displayed. // Confirm that new checker messages are displayed.
$assert->pageTextNotContains($previous_results[0]->messages[0]); $assert->pageTextNotContains($previous_results[0]->messages[0]->render());
$assert->pageTextNotContains($expected_results['2 errors']->messages[0]); $assert->pageTextNotContains($expected_results['2 errors']->messages[0]->render());
$assert->pageTextContainsOnce($expected_results['2 errors']->summary); $assert->pageTextContainsOnce($expected_results['2 errors']->summary->render());
} }
/** /**
...@@ -438,22 +438,22 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -438,22 +438,22 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// Check for message on 'admin/structure' instead of the status report // Check for message on 'admin/structure' instead of the status report
// because checkers will be run if needed on the status report. // because checkers will be run if needed on the status report.
$this->drupalGet('admin/structure'); $this->drupalGet('admin/structure');
$assert->pageTextContainsOnce($expected_results_1[0]->summary); $assert->pageTextContainsOnce($expected_results_1[0]->summary->render());
$assert->pageTextContainsOnce($expected_results_2[0]->summary); $assert->pageTextContainsOnce($expected_results_2[0]->summary->render());
// Confirm that when on of the module is uninstalled the other module's // Confirm that when on of the module is uninstalled the other module's
// checker result is still displayed. // checker result is still displayed.
$this->container->get('module_installer')->uninstall(['automatic_updates_test_status_checker']); $this->container->get('module_installer')->uninstall(['automatic_updates_test_status_checker']);
$this->drupalGet('admin/structure'); $this->drupalGet('admin/structure');
$assert->pageTextNotContains($expected_results_2[0]->summary); $assert->pageTextNotContains($expected_results_2[0]->summary->render());
$assert->pageTextContainsOnce($expected_results_1[0]->summary); $assert->pageTextContainsOnce($expected_results_1[0]->summary->render());
// Confirm that when on of the module is uninstalled the other module's // Confirm that when on of the module is uninstalled the other module's
// checker result is still displayed. // checker result is still displayed.
$this->container->get('module_installer')->uninstall(['automatic_updates_test']); $this->container->get('module_installer')->uninstall(['automatic_updates_test']);
$this->drupalGet('admin/structure'); $this->drupalGet('admin/structure');
$assert->pageTextNotContains($expected_results_2[0]->messages[0]); $assert->pageTextNotContains($expected_results_2[0]->messages[0]->render());
$assert->pageTextNotContains($expected_results_1[0]->messages[0]); $assert->pageTextNotContains($expected_results_1[0]->messages[0]->render());
} }
/** /**
...@@ -483,10 +483,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -483,10 +483,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// The error should be persistently visible, even after the checker stops // The error should be persistently visible, even after the checker stops
// flagging it. // flagging it.
$this->drupalGet('/admin/structure'); $this->drupalGet('/admin/structure');
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class); TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class);
$this->getSession()->reload(); $this->getSession()->reload();
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
// Do the update; we don't expect any errors or special conditions to appear // Do the update; we don't expect any errors or special conditions to appear
// during it. The Update button is displayed because the form does its own // during it. The Update button is displayed because the form does its own
...@@ -498,7 +498,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -498,7 +498,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// page, to confirm that the updater form is not discarding the previous // page, to confirm that the updater form is not discarding the previous
// results by doing its checks. // results by doing its checks.
$this->drupalGet('/admin/structure'); $this->drupalGet('/admin/structure');
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
// Proceed with the update. // Proceed with the update.
$this->drupalGet('/admin/modules/update'); $this->drupalGet('/admin/modules/update');
$page->pressButton('Update to 9.8.1'); $page->pressButton('Update to 9.8.1');
...@@ -510,7 +510,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -510,7 +510,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// The warning should not be visible anymore. // The warning should not be visible anymore.
$this->drupalGet('/admin/structure'); $this->drupalGet('/admin/structure');
$assert_session->pageTextNotContains($message); $assert_session->pageTextNotContains($message->render());
} }
/** /**
...@@ -535,22 +535,22 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -535,22 +535,22 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// flagging it. // flagging it.
$this->drupalGet('/admin/structure'); $this->drupalGet('/admin/structure');
$assert_session = $this->assertSession(); $assert_session = $this->assertSession();
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class); TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class);
$session = $this->getSession(); $session = $this->getSession();
$session->reload(); $session->reload();
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
$config = $this->config('automatic_updates.settings'); $config = $this->config('automatic_updates.settings');
// If we disable notifications, stored results should not be cleared. // If we disable notifications, stored results should not be cleared.
$config->set('status_check_mail', StatusCheckMailer::DISABLED)->save(); $config->set('status_check_mail', StatusCheckMailer::DISABLED)->save();
$session->reload(); $session->reload();
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
// If we re-enable them, though, they should be cleared. // If we re-enable them, though, they should be cleared.
$config->set('status_check_mail', StatusCheckMailer::ERRORS_ONLY)->save(); $config->set('status_check_mail', StatusCheckMailer::ERRORS_ONLY)->save();
$session->reload(); $session->reload();
$assert_session->pageTextNotContains($message); $assert_session->pageTextNotContains($message->render());
$no_results_message = 'Your site has not recently run an update readiness check.'; $no_results_message = 'Your site has not recently run an update readiness check.';
$assert_session->pageTextContains($no_results_message); $assert_session->pageTextContains($no_results_message);
...@@ -559,10 +559,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -559,10 +559,10 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
TestSubscriber1::setTestResult([$result], StatusCheckEvent::class); TestSubscriber1::setTestResult([$result], StatusCheckEvent::class);
$session->getPage()->clickLink('Rerun readiness checks now'); $session->getPage()->clickLink('Rerun readiness checks now');
$this->drupalGet('/admin/structure'); $this->drupalGet('/admin/structure');
$assert_session->pageTextContains($message); $assert_session->pageTextContains($message->render());
$config->set('status_check_mail', StatusCheckMailer::ALL)->save(); $config->set('status_check_mail', StatusCheckMailer::ALL)->save();
$session->reload(); $session->reload();
$assert_session->pageTextNotContains($message); $assert_session->pageTextNotContains($message->render());
$assert_session->pageTextContains($no_results_message); $assert_session->pageTextContains($no_results_message);
} }
...@@ -607,7 +607,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -607,7 +607,7 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
$session->reload(); $session->reload();
$assert_session = $this->assertSession(); $assert_session = $this->assertSession();
$assert_session->pageTextContainsOnce('Unattended updates are configured to run via the console, but do not appear to have run recently.'); $assert_session->pageTextContainsOnce('Unattended updates are configured to run via the console, but do not appear to have run recently.');
$assert_session->pageTextNotContains((string) $result->messages[0]); $assert_session->pageTextNotContains((string) $result->messages[0]->render());
} }
/** /**
......
...@@ -61,7 +61,7 @@ class SuccessfulUpdateTest extends UpdaterFormTestBase { ...@@ -61,7 +61,7 @@ class SuccessfulUpdateTest extends UpdaterFormTestBase {
$cached_message = $this->setAndAssertCachedMessage(); $cached_message = $this->setAndAssertCachedMessage();
$this->drupalGet($update_form_url); $this->drupalGet($update_form_url);
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
$page->pressButton('Update to 9.8.1'); $page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1); $this->assertUpdateStagedTimes(1);
...@@ -71,7 +71,7 @@ class SuccessfulUpdateTest extends UpdaterFormTestBase { ...@@ -71,7 +71,7 @@ class SuccessfulUpdateTest extends UpdaterFormTestBase {
$page->pressButton('Continue'); $page->pressButton('Continue');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$assert_session->addressEquals('/admin/reports/updates'); $assert_session->addressEquals('/admin/reports/updates');
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
// Confirm that the site was in maintenance before the update was applied. // Confirm that the site was in maintenance before the update was applied.
// @see \Drupal\package_manager_test_validation\EventSubscriber\TestSubscriber::handleEvent() // @see \Drupal\package_manager_test_validation\EventSubscriber\TestSubscriber::handleEvent()
$this->assertTrue($state->get(PreApplyEvent::class . '.system.maintenance_mode')); $this->assertTrue($state->get(PreApplyEvent::class . '.system.maintenance_mode'));
......
...@@ -121,7 +121,7 @@ class UpdateErrorTest extends UpdaterFormTestBase { ...@@ -121,7 +121,7 @@ class UpdateErrorTest extends UpdaterFormTestBase {
$this->assertStatusMessageContainsResult($expected_results[0]); $this->assertStatusMessageContainsResult($expected_results[0]);
$assert_session->pageTextContainsOnce(static::$errorsExplanation); $assert_session->pageTextContainsOnce(static::$errorsExplanation);
$assert_session->pageTextNotContains(static::$warningsExplanation); $assert_session->pageTextNotContains(static::$warningsExplanation);
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class); TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class);
// Set up an error with one message and a summary. We should see both when // Set up an error with one message and a summary. We should see both when
...@@ -133,7 +133,7 @@ class UpdateErrorTest extends UpdaterFormTestBase { ...@@ -133,7 +133,7 @@ class UpdateErrorTest extends UpdaterFormTestBase {
$this->assertStatusMessageContainsResult($expected_result); $this->assertStatusMessageContainsResult($expected_result);
$assert_session->pageTextContainsOnce(static::$errorsExplanation); $assert_session->pageTextContainsOnce(static::$errorsExplanation);
$assert_session->pageTextNotContains(static::$warningsExplanation); $assert_session->pageTextNotContains(static::$warningsExplanation);
$assert_session->pageTextNotContains($cached_message); $assert_session->pageTextNotContains($cached_message->render());
TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class); TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class);
} }
......
...@@ -53,7 +53,7 @@ abstract class UpdaterFormTestBase extends AutomaticUpdatesFunctionalTestBase { ...@@ -53,7 +53,7 @@ abstract class UpdaterFormTestBase extends AutomaticUpdatesFunctionalTestBase {
'administer modules', 'administer modules',
'access site reports', 'access site reports',
'view update notifications', 'view update notifications',
// CORE_MR_ONLY:'access help pages', // CORE_MR_ONLY-11.x:'access help pages',
]); ]);
$this->drupalLogin($user); $this->drupalLogin($user);
$this->checkForUpdates(); $this->checkForUpdates();
...@@ -82,7 +82,7 @@ abstract class UpdaterFormTestBase extends AutomaticUpdatesFunctionalTestBase { ...@@ -82,7 +82,7 @@ abstract class UpdaterFormTestBase extends AutomaticUpdatesFunctionalTestBase {
$this->drupalGet('/admin/reports/status'); $this->drupalGet('/admin/reports/status');
$this->clickLink('Rerun readiness checks'); $this->clickLink('Rerun readiness checks');
$this->drupalGet('/admin'); $this->drupalGet('/admin');
$this->assertSession()->pageTextContains($message); $this->assertSession()->pageTextContains($message->render());
// Clear the results so the only way the message could appear on the pages // Clear the results so the only way the message could appear on the pages
// used for the update process is if they show the cached results. // used for the update process is if they show the cached results.
TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class); TestSubscriber1::setTestResult(NULL, StatusCheckEvent::class);
......
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