function OpenTelemetryAuthenticatedPerformanceTest::testFrontPageAuthenticatedWarmCache

Same name in other branches
  1. 10 core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php \Drupal\Tests\demo_umami\FunctionalJavascript\OpenTelemetryAuthenticatedPerformanceTest::testFrontPageAuthenticatedWarmCache()

Logs front page tracing data with an authenticated user and warm cache.

File

core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php, line 35

Class

OpenTelemetryAuthenticatedPerformanceTest
Tests demo_umami profile performance.

Namespace

Drupal\Tests\demo_umami\FunctionalJavascript

Code

public function testFrontPageAuthenticatedWarmCache() : void {
    $this->drupalGet('<front>');
    $this->drupalGet('<front>');
    $performance_data = $this->collectPerformanceData(function () {
        $this->drupalGet('<front>');
    }, 'authenticatedFrontPage');
    $expected_queries = [
        'SELECT "session" FROM "sessions" WHERE "sid" = "SESSION_ID" LIMIT 0, 1',
        'SELECT * FROM "users_field_data" "u" WHERE "u"."uid" = "10" AND "u"."default_langcode" = 1',
        'SELECT "roles_target_id" FROM "user__roles" WHERE "entity_id" = "10"',
        'SELECT "config"."name" AS "name" FROM "config" "config" WHERE ("collection" = "") AND ("name" LIKE "language.entity.%" ESCAPE ' . "'\\\\'" . ') ORDER BY "collection" ASC, "name" ASC',
    ];
    $recorded_queries = $performance_data->getQueries();
    $this->assertSame($expected_queries, $recorded_queries);
    $expected = [
        'QueryCount' => 4,
        'CacheGetCount' => 40,
        'CacheGetCountByBin' => [
            'config' => 22,
            'discovery' => 5,
            'data' => 7,
            'bootstrap' => 4,
            'dynamic_page_cache' => 2,
        ],
        'CacheSetCount' => 0,
        'CacheDeleteCount' => 0,
        'CacheTagChecksumCount' => 0,
        'CacheTagIsValidCount' => 10,
        'CacheTagInvalidationCount' => 0,
        'CacheTagLookupQueryCount' => 2,
        'ScriptCount' => 1,
        'ScriptBytes' => 123850,
        'StylesheetCount' => 2,
        'StylesheetBytes' => 43600,
    ];
    $this->assertMetrics($expected, $performance_data);
}

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