Issue #2422257 by chx: Remove unnecessary query against the session table in WebTestBase.
parent
56ad560a5c
commit
e4e8f31411
|
@ -711,9 +711,17 @@ abstract class WebTestBase extends TestBase {
|
||||||
if (!isset($account->session_id)) {
|
if (!isset($account->session_id)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// The session ID is hashed before being stored in the database.
|
$session_id = $account->session_id;
|
||||||
// @see \Drupal\Core\Session\SessionHandler::read()
|
$request_stack = $this->container->get('request_stack');
|
||||||
return (bool) db_query("SELECT sid FROM {users_field_data} u INNER JOIN {sessions} s ON u.uid = s.uid AND u.default_langcode = 1 WHERE s.sid = :sid", array(':sid' => Crypt::hashBase64($account->session_id)))->fetchField();
|
$request = $request_stack->getCurrentRequest();
|
||||||
|
$cookies = $request->cookies->all();
|
||||||
|
foreach ($this->cookies as $name => $value) {
|
||||||
|
$cookies[$name] = $value['value'];
|
||||||
|
}
|
||||||
|
$request_stack->push($request->duplicate(NULL, NULL, NULL, $cookies));
|
||||||
|
$logged_in = (bool) $this->container->get('session_manager')->getSaveHandler()->read($session_id);
|
||||||
|
$request_stack->pop();
|
||||||
|
return $logged_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue