assertLogMessage example

$this->assertSession()->pageTextContains(count($module_names) . ' modules have been enabled: ' . implode(', ', $module_names));
      }
      else {
        $this->assertSession()->pageTextContains('Module ' . $module_names[0] . ' has been enabled.');
      }

      // Check that hook_modules_installed() was invoked with the expected list       // of modules, that each module's database tables now exist, and that       // appropriate messages appear in the logs.       foreach ($modules_to_install as $module_to_install) {
        $this->assertSession()->pageTextContains('hook_modules_installed fired for ' . $module_to_install);
        $this->assertLogMessage('system', "%module module installed.", ['%module' => $module_to_install], RfcLogLevel::INFO);
        $this->assertInstallModuleUpdates($module_to_install);
        $this->assertModuleSuccessfullyInstalled($module_to_install);
      }

      // Verify the help page.       $this->assertHelp($name$module->info['name']);

      // Uninstall the original module, plus everything else that was installed       // with it.       // @todo Remove in https://www.drupal.org/project/node/3261652       if ($name == 'forum') {
        
    $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.
Home | Imprint | This part of the site doesn't use cookies.