/**
* Provides data for self::testEncodePath().
*
* @return array
*/ publicstaticfunctionproviderTestEncodePath(){ return[ ['unencoded path with spaces', 'unencoded%20path%20with%20spaces'], [
// HTTP and to https://example.com/bar.jpg when viewing a HTTPS page)
// Both types of relative URIs are characterized by a leading slash, hence
// we can use a single check.
if(mb_substr($uri, 0, 1) == '/'){ return$uri; } else{ // If this is not a properly formatted stream, then it is a shipped
// file. Therefore, return the urlencoded URI with the base URL
// prepended.
$options = UrlHelper::parse($uri); $path = $base_url . UrlHelper::encodePath($options['path']); // Append the query.
if($options['query']){ $path .= '?' . UrlHelper::buildQuery($options['query']); }
// Switch to ucfirst and ucwords.
$id_field->options['alter']['path_case'] = 'ucfirst'; $id_field->options['alter']['path'] = 'drupal has a great community'; $output = $renderer->executeInRenderContext(newRenderContext(), function D)use($id_field, $row){ return$id_field->theme($row); }); $this->assertSubString($output, UrlHelper::encodePath('Drupal has a great community'));
$id_field->options['alter']['path_case'] = 'ucwords'; $output = $renderer->executeInRenderContext(newRenderContext(), function D)use($id_field, $row){ return$id_field->theme($row); }); $this->assertSubString($output, UrlHelper::encodePath('Drupal Has A Great Community')); unset($id_field->options['alter']['path_case']);
// Tests the link_class setting and see whether it actually exists in the
// output.
$id_field->options['alter']['link_class'] = $class = $this->randomMachineName();
/**
* Finds and returns the base URL for public://.
*
* Defaults to the current site's base URL plus directory path.
*
* Note that this static method is used by \Drupal\system\Form\FileSystemForm
* so you should alter that form or substitute a different form if you change
* the class providing the stream_wrapper.public service.
*
* @return string
* The external base URL for public://
*/