function PerformanceTestTrait::normalizeQuery

Normalizes a query by removing the database prefix and newlines.

Parameters

string $query_string: The query string to normalize.

string $database_prefix: The database prefix to remove from the query.

Return value

string The normalized query string.

1 call to PerformanceTestTrait::normalizeQuery()
PerformanceTestTrait::collectPerformanceData in core/tests/Drupal/Tests/PerformanceTestTrait.php
Executes a callable and collects performance data.

File

core/tests/Drupal/Tests/PerformanceTestTrait.php, line 713

Class

PerformanceTestTrait
Provides various methods to aid in collecting performance data during tests.

Namespace

Drupal\Tests

Code

protected static function normalizeQuery(string $query_string, string $database_prefix) : string {
    return str_replace([
        $database_prefix,
        "\r\n",
        "\r",
        "\n",
    ], [
        '',
        ' ',
        ' ',
        ' ',
    ], $query_string);
}

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