Spin-off from #1215104: Use the non-interactive installer in WebTestBase::setUp()

Problem

  • drupal_save_session() is not checked for the session regenerate and destroy cases.
  • drupal_save_session() does not persist across calls to drupal_static_reset().

Details

  • From #1215104-41: Use the non-interactive installer in WebTestBase::setUp():

    When injecting the drupal_save_session() condition that happens in the session commit and other callbacks into the regenerate and destroy callbacks, then the non-interactive installer magically starts to work.

    The Drupal installer is saving the $user for uid 1 to the (new) database, which is automatically logged in as the last step of the installation process.

    While everything happens in the child site under test, the PHP session handling happens in the global scope. Therefore, this $user->save() as well as the user_login_finalize() regenerate/destroy the session ID + session + cookies of the user that is running the test through the Simpletest UI.

    That, in turn, changes the value of drupal_get_token(), which Batch API saves and validates for each batch to be executed.

Proposed solution

  1. Make drupal_session_regenerate(), _drupal_session_destroy(), and drupal_session_destroy_uid() adhere to the current flag of drupal_save_session().
  2. Make the flag in drupal_save_session() persist (static).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Issue tags: +Needs backport to D7
lucascaro’s picture

Status: Needs review » Reviewed & tested by the community

makes sense to me

sun’s picture

sun’s picture

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Looks good to me. Committed/pushed to 8.x.

lucascaro’s picture

Hey, here's a port for D7.

lucascaro’s picture

Status: Patch (to be ported) » Needs review
sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I think this makes sense, and I suppose there's not really a way to test the tester.

Committed and pushed to 7.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.