$this->
drupalGet('user/' .
$user->
id() . '/cancel'
);
$this->
submitForm(['user_cancel_method' => 'user_cancel_reassign'
], 'Confirm'
);
// View the database log report.
$this->
drupalGet('admin/reports/dblog'
);
$this->
assertSession()->
statusCodeEquals(200
);
// Verify that the expected events were recorded.
// Add user.
// Default display includes name and email address; if too long, the email
// address is replaced by three periods.
$this->
assertLogMessage("New user:
$name <{
$user->
getEmail()}>.", 'DBLog event was recorded: [add user]'
);
// Log in user.
$this->
assertLogMessage("Session opened for
$name.", 'DBLog event was recorded: [login user]'
);
// Log out user.
$this->
assertLogMessage("Session closed for
$name.", 'DBLog event was recorded: [logout user]'
);
// Delete user.
$message = "Deleted user:
$name <{
$user->
getEmail()}>.";
$message_text = Unicode::
truncate($message, 56, TRUE, TRUE
);
// Verify that the full message displays on the details page.
$link = FALSE;
if ($links =
$this->
xpath('//a[text()="' .
$message_text . '"]'
)) { // Found link with the message text.