function JqueryUiLibraryAssetsTest::trimFilePath

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php \Drupal\FunctionalTests\Libraries\JqueryUiLibraryAssetsTest::trimFilePath()
  2. 11.x core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php \Drupal\FunctionalTests\Libraries\JqueryUiLibraryAssetsTest::trimFilePath()

Removes base_url() and query args from file paths.

Parameters

string $path: The path being trimmed.

Return value

string The trimmed path.

2 calls to JqueryUiLibraryAssetsTest::trimFilePath()
JqueryUiLibraryAssetsTest::testAssetLoadingUnchanged in core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php
Confirms jQuery UI assets load as expected.
JqueryUiLibraryAssetsTest::testLibraryAssetLoadingOrder in core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php
Confirms that jQuery UI assets load on the page in the configured order.

File

core/tests/Drupal/FunctionalTests/Libraries/JqueryUiLibraryAssetsTest.php, line 207

Class

JqueryUiLibraryAssetsTest
Tests the loading of jQuery UI CSS and JS assets.

Namespace

Drupal\FunctionalTests\Libraries

Code

protected function trimFilePath($path) {
    $base_path_position = strpos($path, base_path());
    if ($base_path_position !== FALSE) {
        $path = substr_replace($path, '', $base_path_position, strlen(base_path()));
    }
    $query_pos = strpos($path, '?');
    return $query_pos !== FALSE ? substr($path, 0, $query_pos) : $path;
}

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