You are here

protected function JqueryUiLibraryAssetsTest::trimFilePath in Drupal 10

Same name and namespace in other branches
  1. 9 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 204

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;
}