function StandardPerformanceTest::testLoginBlock

Same name and namespace in other branches
  1. 10 core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php \Drupal\Tests\standard\FunctionalJavascript\StandardPerformanceTest::testLoginBlock()

Tests the performance of logging in via the user login block.

1 call to StandardPerformanceTest::testLoginBlock()
StandardPerformanceTest::testStandardPerformance in core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
Tests performance of the standard profile.

File

core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php, line 137

Class

StandardPerformanceTest
Tests the performance of basic functionality in the standard profile.

Namespace

Drupal\Tests\standard\FunctionalJavascript

Code

protected function testLoginBlock() : void {
  $this->drupalPlaceBlock('user_login_block');
  // Log the user in in to warm all caches. Manually submit the form so that
  // we repeat the same steps when recording performance data. Do this twice
  // so that any caches which take two requests to warm are also covered.
  for ($i = 0; $i < 2; $i++) {
    $this->drupalGet('node/1');
    $this->assertSession()
      ->responseContains('Password');
    $this->submitLoginForm($this->user);
    $this->drupalLogout();
  }
  $this->drupalGet('node/1');
  $this->assertSession()
    ->responseContains('Password');
  $performance_data = $this->collectPerformanceData(function () {
    $this->submitLoginForm($this->user);
  }, 'standardBlockLogin');
  $this->assertQueriesByName('standardBlockLogin', $performance_data->getQueries());
  $this->assertMetricsByName('standardBlockLogin', $performance_data);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.