Issue #2416763 by xjm, Wim Leers, effulgentsia: Convert Url::fromUri() base:// scheme to base:
parent
089a68f4a8
commit
e69cd76706
|
@ -499,9 +499,9 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) {
|
|||
* non-controller or sub-domain URIs such as core/install.php. Note that
|
||||
* \Drupal\Core\Url::fromUri() expects a valid URI including the scheme. URIs
|
||||
* from the same sub-domain that are not handled by Drupal controllers should
|
||||
* be prepended with base://. For example:
|
||||
* use the base: scheme. For example:
|
||||
* @code
|
||||
* $installer_url = \Drupal\Core\Url::fromUri('base://core/install.php')->toString();
|
||||
* $installer_url = \Drupal\Core\Url::fromUri('base:core/install.php')->toString();
|
||||
* $external_url = \Drupal\Core\Url::fromUri('http://example.com', ['query' => ['foo' => 'bar']])->toString();
|
||||
* $internal_url = \Drupal\Core\Url::fromRoute('system.admin')->toString();
|
||||
* @endcode
|
||||
|
@ -604,9 +604,9 @@ function drupal_http_header_attributes(array $attributes = array()) {
|
|||
* core/install.php use \Drupal\Core\Url::fromUri(). Note that
|
||||
* \Drupal\Core\Url::fromUri() expects a valid URI including the scheme. URIs
|
||||
* from the same sub-domain that are not handled by Drupal controllers should
|
||||
* be prepended with base://. For example:
|
||||
* be prepended with base:. For example:
|
||||
* @code
|
||||
* $installer_url = \Drupal\Core\Url::fromUri('base://core/install.php')->toString();
|
||||
* $installer_url = \Drupal\Core\Url::fromUri('base:core/install.php')->toString();
|
||||
* $installer_link = \Drupal::l($text, $installer_url);
|
||||
* $external_url = \Drupal\Core\Url::fromUri('http://example.com', ['query' => ['foo' => 'bar']])->toString();
|
||||
* $external_link = \Drupal::l($text, $external_url);
|
||||
|
|
|
@ -584,7 +584,7 @@ function install_run_task($task, &$install_state) {
|
|||
// Otherwise, the batch will complete.
|
||||
// Disable the default script for the URL and clone the object, as
|
||||
// batch_process() will add additional options to the batch URL.
|
||||
$url = Url::fromUri('base://install.php', ['query' => $install_state['parameters'], 'script' => '']);
|
||||
$url = Url::fromUri('base:install.php', ['query' => $install_state['parameters'], 'script' => '']);
|
||||
$response = batch_process($url, clone $url);
|
||||
if ($response instanceof Response) {
|
||||
// Save $_SESSION data from batch.
|
||||
|
|
|
@ -476,7 +476,7 @@ class Drupal {
|
|||
* the \Drupal\Core\Url object. See \Drupal\Core\Url::fromRoute() for
|
||||
* detailed documentation. For non-routed local URIs relative to
|
||||
* the base path (like robots.txt) use Url::fromUri()->toString() with the
|
||||
* base:// scheme.
|
||||
* base: scheme.
|
||||
*
|
||||
* @param string $route_name
|
||||
* The name of the route.
|
||||
|
|
|
@ -36,7 +36,7 @@ class ConfirmFormHelper {
|
|||
$options = UrlHelper::parse($query->get('destination'));
|
||||
// @todo Use Url::fromPath() once https://www.drupal.org/node/2351379 is
|
||||
// resolved.
|
||||
$url = Url::fromUri('base://' . $options['path'], $options);
|
||||
$url = Url::fromUri('base:' . $options['path'], $options);
|
||||
}
|
||||
// Check for a route-based cancel link.
|
||||
else {
|
||||
|
|
|
@ -139,7 +139,7 @@ class Url {
|
|||
*
|
||||
* This method is for URLs that have Drupal routes (that is, most pages
|
||||
* generated by Drupal). For non-routed local URIs relative to the base
|
||||
* path (like robots.txt) use Url::fromUri() with the base:// scheme.
|
||||
* path (like robots.txt) use Url::fromUri() with the base: scheme.
|
||||
*
|
||||
* @param string $route_name
|
||||
* The name of the route
|
||||
|
@ -193,7 +193,7 @@ class Url {
|
|||
*
|
||||
* This method is for generating URLs for URIs that:
|
||||
* - do not have Drupal routes: both external URLs and unrouted local URIs
|
||||
* like base://robots.txt
|
||||
* like base:robots.txt
|
||||
* - do have a Drupal route but have a custom scheme to simplify linking.
|
||||
* Currently, there is only the entity: scheme (This allows URIs of the
|
||||
* form entity:{entity_type}/{entity_id}. For example: entity:node/1
|
||||
|
@ -204,7 +204,7 @@ class Url {
|
|||
*
|
||||
* @param string $uri
|
||||
* The URI of the resource including the scheme. For Drupal paths that are
|
||||
* not handled by the routing system, use base:// for the scheme. For entity
|
||||
* not handled by the routing system, use base: for the scheme. For entity
|
||||
* URLs you may use entity:{entity_type}/{entity_id} URIs.
|
||||
* @param array $options
|
||||
* (optional) An associative array of additional URL options, with the
|
||||
|
@ -233,15 +233,18 @@ class Url {
|
|||
*/
|
||||
public static function fromUri($uri, $options = array()) {
|
||||
if (!($scheme = parse_url($uri, PHP_URL_SCHEME))) {
|
||||
throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base:// for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri]));
|
||||
throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base: for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri]));
|
||||
}
|
||||
|
||||
// Special case entity: URIs. Map these to the canonical entity route.
|
||||
if ($scheme === 'entity') {
|
||||
return static::fromEntityUri($uri);
|
||||
}
|
||||
|
||||
$url = new static($uri, array(), $options);
|
||||
if ($scheme !== 'base') {
|
||||
$url->external = TRUE;
|
||||
$url->setOption('external', TRUE);
|
||||
}
|
||||
$url->setUnrouted();
|
||||
|
||||
return $url;
|
||||
|
@ -313,11 +316,6 @@ class Url {
|
|||
// Set empty route name and parameters.
|
||||
$this->routeName = NULL;
|
||||
$this->routeParameters = array();
|
||||
// @todo Add a method for the check below in
|
||||
// https://www.drupal.org/node/2346859.
|
||||
if ($this->external = strpos($this->uri, 'base://') !== 0) {
|
||||
$this->options['external'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,14 +61,14 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface {
|
|||
// Note that UrlHelper::isExternal will return FALSE if the $uri has a
|
||||
// disallowed protocol. This is later made safe since we always add at
|
||||
// least a leading slash.
|
||||
if (strpos($uri, 'base://') === 0) {
|
||||
if (parse_url($uri, PHP_URL_SCHEME) === 'base') {
|
||||
return $this->buildLocalUrl($uri, $options);
|
||||
}
|
||||
elseif (UrlHelper::isExternal($uri)) {
|
||||
// UrlHelper::isExternal() only returns true for safe protocols.
|
||||
return $this->buildExternalUrl($uri, $options);
|
||||
}
|
||||
throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base:// for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri]));
|
||||
throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base: for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,8 +108,10 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface {
|
|||
$this->addOptionDefaults($options);
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
|
||||
// Remove the base:// scheme.
|
||||
$uri = substr($uri, 7);
|
||||
// Remove the base: scheme.
|
||||
// @todo Consider using a class constant for this in
|
||||
// https://www.drupal.org/node/2417459
|
||||
$uri = substr($uri, 5);
|
||||
|
||||
// Allow (outbound) path processing, if needed. A valid use case is the path
|
||||
// alias overview form:
|
||||
|
|
|
@ -18,11 +18,11 @@ interface UnroutedUrlAssemblerInterface {
|
|||
* domain-local URIs and external URLs.
|
||||
*
|
||||
* @param string $uri
|
||||
* A local URI or an external URL being linked to, such as "base://foo"
|
||||
* A local URI or an external URL being linked to, such as "base:foo"
|
||||
* or "http://example.com/foo".
|
||||
* - If you provide a full URL, it will be considered an external URL as
|
||||
* long as it has an allowed protocol.
|
||||
* - If you provide only a local URI (e.g. "base://foo"), it will be
|
||||
* - If you provide only a local URI (e.g. "base:foo"), it will be
|
||||
* considered a path local to Drupal, but not handled by the routing
|
||||
* system. The base path (the subdirectory where the front controller
|
||||
* is found) will be added to the path. Additional query arguments for
|
||||
|
|
|
@ -255,11 +255,11 @@ class DbLogController extends ControllerBase {
|
|||
),
|
||||
array(
|
||||
array('data' => $this->t('Location'), 'header' => TRUE),
|
||||
$this->l($dblog->location, $dblog->location ? Url::fromUri('base://' . $dblog->location) : Url::fromRoute('<none>')),
|
||||
$this->l($dblog->location, $dblog->location ? Url::fromUri('base:' . $dblog->location) : Url::fromRoute('<none>')),
|
||||
),
|
||||
array(
|
||||
array('data' => $this->t('Referrer'), 'header' => TRUE),
|
||||
$this->l($dblog->referer, $dblog->referer ? Url::fromUri('base://' . $dblog->referer) : Url::fromRoute('<none>')),
|
||||
$this->l($dblog->referer, $dblog->referer ? Url::fromUri('base:' . $dblog->referer) : Url::fromRoute('<none>')),
|
||||
),
|
||||
array(
|
||||
array('data' => $this->t('Message'), 'header' => TRUE),
|
||||
|
|
|
@ -63,7 +63,7 @@ class FieldUI {
|
|||
// Redirect to any given path within the same domain.
|
||||
// @todo Use Url::fromPath() once https://www.drupal.org/node/2351379 is
|
||||
// resolved.
|
||||
$next_destination = Url::fromUri('base://' . $options['path']);
|
||||
$next_destination = Url::fromUri('base:' . $options['path']);
|
||||
}
|
||||
return $next_destination;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
$data_with_valid_type = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -37,10 +37,10 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
'_links' => array(
|
||||
'type' => array(
|
||||
array(
|
||||
'href' => Url::fromUri('base://rest/types/foo', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/types/foo', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
array(
|
||||
'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -52,7 +52,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
$data_with_invalid_type = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/types/foo', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/types/foo', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -85,7 +85,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
$no_field_data = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -95,7 +95,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
$empty_field_data = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
'field_test_text' => array(),
|
||||
|
@ -113,7 +113,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
$data = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
'uuid' => array(
|
||||
|
@ -183,7 +183,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
$data = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
'field_test_text' => array(
|
||||
|
|
|
@ -61,8 +61,8 @@ class NormalizeTest extends NormalizerTestBase {
|
|||
$entity->getTranslation('en')->set('field_test_entity_reference', array(0 => $translation_values['field_test_entity_reference']));
|
||||
$entity->save();
|
||||
|
||||
$type_uri = Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString();
|
||||
$relation_uri = Url::fromUri('base://rest/relation/entity_test/entity_test/field_test_entity_reference', array('absolute' => TRUE))->toString();
|
||||
$type_uri = Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString();
|
||||
$relation_uri = Url::fromUri('base:rest/relation/entity_test/entity_test/field_test_entity_reference', array('absolute' => TRUE))->toString();
|
||||
|
||||
$expected_array = array(
|
||||
'_links' => array(
|
||||
|
|
|
@ -225,7 +225,7 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity
|
|||
// built.
|
||||
if ($clean_urls === FALSE && file_uri_scheme($uri) == 'public' && !file_exists($uri)) {
|
||||
$directory_path = file_stream_wrapper_get_instance_by_uri($uri)->getDirectoryPath();
|
||||
return Url::fromUri('base://' . $directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query))->toString();
|
||||
return Url::fromUri('base:' . $directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query))->toString();
|
||||
}
|
||||
|
||||
$file_url = file_create_url($uri);
|
||||
|
|
|
@ -87,7 +87,7 @@ class ImageThemeFunctionTest extends WebTestBase {
|
|||
'#theme' => 'image_formatter',
|
||||
'#image_style' => 'test',
|
||||
'#item' => $entity->image_test,
|
||||
'#url' => Url::fromUri('base://' . $path),
|
||||
'#url' => Url::fromUri('base:' . $path),
|
||||
);
|
||||
|
||||
// Test using theme_image_formatter() with a NULL value for the alt option.
|
||||
|
|
|
@ -116,7 +116,7 @@ class MenuTest extends MenuWebTestBase {
|
|||
// Verify delete link exists and reset link does not exist.
|
||||
$this->drupalGet('admin/structure/menu/manage/' . $this->menu->id());
|
||||
$this->assertLinkByHref('admin/structure/menu/item/' . $this->items[0]->id() . '/delete');
|
||||
$this->assertNoLinkByHref(Url::fromUri('base://admin/structure/menu/link/' . $this->items[0]->getPluginId() . '/reset')->toString());
|
||||
$this->assertNoLinkByHref(Url::fromUri('base:admin/structure/menu/link/' . $this->items[0]->getPluginId() . '/reset')->toString());
|
||||
// Check delete and reset access.
|
||||
$this->drupalGet('admin/structure/menu/item/' . $this->items[0]->id() . '/delete');
|
||||
$this->assertResponse(200);
|
||||
|
|
|
@ -86,11 +86,11 @@ class PathController extends ControllerBase {
|
|||
$destination = drupal_get_destination();
|
||||
foreach ($this->aliasStorage->getAliasesForAdminListing($header, $keys) as $data) {
|
||||
$row = array();
|
||||
$row['data']['alias'] = $this->l(Unicode::truncate($data->alias, 50, FALSE, TRUE), Url::fromUri('base://' . $data->source, array(
|
||||
$row['data']['alias'] = $this->l(Unicode::truncate($data->alias, 50, FALSE, TRUE), Url::fromUri('base:' . $data->source, array(
|
||||
'path_processing' => TRUE,
|
||||
'attributes' => array('title' => $data->alias),
|
||||
)));
|
||||
$row['data']['source'] = $this->l(Unicode::truncate($data->source, 50, FALSE, TRUE), Url::fromUri('base://' . $data->source, array(
|
||||
$row['data']['source'] = $this->l(Unicode::truncate($data->source, 50, FALSE, TRUE), Url::fromUri('base:' . $data->source, array(
|
||||
'alias' => TRUE,
|
||||
'attributes' => array('title' => $data->source),
|
||||
)));
|
||||
|
|
|
@ -54,7 +54,7 @@ class RelationLinkManager implements RelationLinkManagerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRelationUri($entity_type, $bundle, $field_name) {
|
||||
return $this->urlAssembler->assemble("base://rest/relation/$entity_type/$bundle/$field_name", array('absolute' => TRUE));
|
||||
return $this->urlAssembler->assemble("base:rest/relation/$entity_type/$bundle/$field_name", array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ class TypeLinkManager implements TypeLinkManagerInterface {
|
|||
*/
|
||||
public function getTypeUri($entity_type, $bundle) {
|
||||
// @todo Make the base path configurable.
|
||||
return $this->urlAssembler->assemble("base://rest/type/$entity_type/$bundle", array('absolute' => TRUE));
|
||||
return $this->urlAssembler->assemble("base:rest/type/$entity_type/$bundle", array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,7 +70,7 @@ class NodeTest extends RESTTestBase {
|
|||
$data = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/type/node/resttest', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/node/resttest', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
),
|
||||
'title' => array(
|
||||
|
|
|
@ -63,12 +63,12 @@ class EntityResolverTest extends NormalizerTestBase {
|
|||
$entity->set('field_test_entity_reference', array(array('target_id' => 1)));
|
||||
$entity->save();
|
||||
|
||||
$field_uri = Url::fromUri('base://rest/relation/entity_test_mulrev/entity_test_mulrev/field_test_entity_reference', array('absolute' => TRUE))->toString();
|
||||
$field_uri = Url::fromUri('base:rest/relation/entity_test_mulrev/entity_test_mulrev/field_test_entity_reference', array('absolute' => TRUE))->toString();
|
||||
|
||||
$data = array(
|
||||
'_links' => array(
|
||||
'type' => array(
|
||||
'href' => Url::fromUri('base://rest/type/entity_test_mulrev/entity_test_mulrev', array('absolute' => TRUE))->toString(),
|
||||
'href' => Url::fromUri('base:rest/type/entity_test_mulrev/entity_test_mulrev', array('absolute' => TRUE))->toString(),
|
||||
),
|
||||
$field_uri => array(
|
||||
array(
|
||||
|
|
|
@ -77,7 +77,7 @@ class SimpleTestBrowserTest extends WebTestBase {
|
|||
// @see drupal_valid_test_ua()
|
||||
// Not using File API; a potential error must trigger a PHP warning.
|
||||
unlink($this->siteDirectory . '/.htkey');
|
||||
$this->drupalGet(Url::fromUri('base://core/install.php', array('external' => TRUE, 'absolute' => TRUE))->toString());
|
||||
$this->drupalGet(Url::fromUri('base:core/install.php', array('external' => TRUE, 'absolute' => TRUE))->toString());
|
||||
$this->assertResponse(403, 'Cannot access install.php.');
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ function statistics_help($route_name, RouteMatchInterface $route_match) {
|
|||
function statistics_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) {
|
||||
if (!$node->isNew() && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) {
|
||||
$build['statistics_content_counter']['#attached']['library'][] = 'statistics/drupal.statistics';
|
||||
$settings = array('data' => array('nid' => $node->id()), 'url' => Url::fromUri('base://' . drupal_get_path('module', 'statistics') . '/statistics.php')->toString());
|
||||
$settings = array('data' => array('nid' => $node->id()), 'url' => Url::fromUri('base:' . drupal_get_path('module', 'statistics') . '/statistics.php')->toString());
|
||||
$build['statistics_content_counter']['#attached']['drupalSettings']['statistics'] = $settings;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,15 +23,15 @@ class AddFeedTest extends WebTestBase {
|
|||
function testBasicFeedAddNoTitle() {
|
||||
$path = $this->randomMachineName(12);
|
||||
$external_url = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12);
|
||||
$fully_qualified_local_url = Url::fromUri('base://' . $this->randomMachineName(12), array('absolute' => TRUE))->toString();
|
||||
$fully_qualified_local_url = Url::fromUri('base:' . $this->randomMachineName(12), array('absolute' => TRUE))->toString();
|
||||
|
||||
$path_for_title = $this->randomMachineName(12);
|
||||
$external_for_title = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12);
|
||||
$fully_qualified_for_title = Url::fromUri('base://' . $this->randomMachineName(12), array('absolute' => TRUE))->toString();
|
||||
$fully_qualified_for_title = Url::fromUri('base:' . $this->randomMachineName(12), array('absolute' => TRUE))->toString();
|
||||
|
||||
$urls = array(
|
||||
'path without title' => array(
|
||||
'url' => Url::fromUri('base://' . $path, array('absolute' => TRUE))->toString(),
|
||||
'url' => Url::fromUri('base:' . $path, array('absolute' => TRUE))->toString(),
|
||||
'title' => '',
|
||||
),
|
||||
'external URL without title' => array(
|
||||
|
@ -43,7 +43,7 @@ class AddFeedTest extends WebTestBase {
|
|||
'title' => '',
|
||||
),
|
||||
'path with title' => array(
|
||||
'url' => Url::fromUri('base://' . $path_for_title, array('absolute' => TRUE))->toString(),
|
||||
'url' => Url::fromUri('base:' . $path_for_title, array('absolute' => TRUE))->toString(),
|
||||
'title' => $this->randomMachineName(12),
|
||||
),
|
||||
'external URL with title' => array(
|
||||
|
|
|
@ -32,12 +32,12 @@ class UrlTest extends WebTestBase {
|
|||
$text = $this->randomMachineName();
|
||||
$path = "<SCRIPT>alert('XSS')</SCRIPT>";
|
||||
$link = _l($text, $path);
|
||||
$sanitized_path = check_url(Url::fromUri('base://' . $path)->toString());
|
||||
$sanitized_path = check_url(Url::fromUri('base:' . $path)->toString());
|
||||
$this->assertTrue(strpos($link, $sanitized_path) !== FALSE, format_string('XSS attack @path was filtered by _l().', array('@path' => $path)));
|
||||
|
||||
// Test \Drupal\Core\Url.
|
||||
$link = Url::fromUri('base://' . $path)->toString();
|
||||
$sanitized_path = check_url(Url::fromUri('base://' . $path)->toString());
|
||||
$link = Url::fromUri('base:' . $path)->toString();
|
||||
$sanitized_path = check_url(Url::fromUri('base:' . $path)->toString());
|
||||
$this->assertTrue(strpos($link, $sanitized_path) !== FALSE, format_string('XSS attack @path was filtered by #theme', ['@path' => $path]));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@ trait AssertBreadcrumbTrait {
|
|||
foreach ($trail as $path => $title) {
|
||||
// If the path is empty, generate the path from the <front> route. If
|
||||
// the path does not start with a leading, then run it through
|
||||
// Url::fromUri('base://')->toString() to get correct the base
|
||||
// Url::fromUri('base:')->toString() to get correct the base
|
||||
// prepended.
|
||||
if ($path == '') {
|
||||
$url = Url::fromRoute('<front>')->toString();
|
||||
}
|
||||
elseif ($path[0] != '/') {
|
||||
$url = Url::fromUri('base://' . $path)->toString();
|
||||
$url = Url::fromUri('base:' . $path)->toString();
|
||||
}
|
||||
else {
|
||||
$url = $path;
|
||||
|
|
|
@ -37,7 +37,7 @@ trait AssertMenuActiveTrailTrait {
|
|||
$part_xpath .= 'li[contains(@class, :class)]/a[contains(@href, :href) and contains(text(), :title)]';
|
||||
$part_args = array(
|
||||
':class' => 'active-trail',
|
||||
':href' => Url::fromUri('base://' . $link_path)->toString(),
|
||||
':href' => Url::fromUri('base:' . $link_path)->toString(),
|
||||
':title' => $link_title,
|
||||
);
|
||||
$xpath .= $this->buildXPathQuery($part_xpath, $part_args);
|
||||
|
@ -57,7 +57,7 @@ trait AssertMenuActiveTrailTrait {
|
|||
$args = array(
|
||||
':class-trail' => 'active-trail',
|
||||
':class-active' => 'active',
|
||||
':href' => Url::fromUri('base://' . $active_link_path)->toString(),
|
||||
':href' => Url::fromUri('base:' . $active_link_path)->toString(),
|
||||
':title' => $active_link_title,
|
||||
);
|
||||
$elements = $this->xpath($xpath, $args);
|
||||
|
|
|
@ -278,7 +278,7 @@ class BreadcrumbTest extends MenuTestBase {
|
|||
// other than the breadcrumb trail.
|
||||
$elements = $this->xpath('//nav[@id=:menu]/descendant::a[@href=:href]', array(
|
||||
':menu' => 'block-bartik-tools',
|
||||
':href' => Url::fromUri('base://' . $link_path)->toString(),
|
||||
':href' => Url::fromUri('base:' . $link_path)->toString(),
|
||||
));
|
||||
$this->assertTrue(count($elements) == 1, "Link to {$link_path} appears only once.");
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class LocalTasksTest extends WebTestBase {
|
|||
));
|
||||
$this->assertTrue(count($elements), 'Local tasks found.');
|
||||
foreach ($hrefs as $index => $element) {
|
||||
$expected = Url::fromUri('base://' . $hrefs[$index])->toString();
|
||||
$expected = Url::fromUri('base:' . $hrefs[$index])->toString();
|
||||
$method = ($elements[$index]['href'] == $expected ? 'pass' : 'fail');
|
||||
$this->{$method}(format_string('Task @number href @value equals @expected.', array(
|
||||
'@number' => $index + 1,
|
||||
|
|
|
@ -191,7 +191,7 @@ class FunctionsTest extends WebTestBase {
|
|||
$variables['links'] = array(
|
||||
'a link' => array(
|
||||
'title' => 'A <link>',
|
||||
'url' => Url::fromUri('base://a/link'),
|
||||
'url' => Url::fromUri('base:a/link'),
|
||||
),
|
||||
'plain text' => array(
|
||||
'title' => 'Plain "text"',
|
||||
|
@ -215,7 +215,7 @@ class FunctionsTest extends WebTestBase {
|
|||
|
||||
$expected_links = '';
|
||||
$expected_links .= '<ul id="somelinks">';
|
||||
$expected_links .= '<li class="a-link"><a href="' . Url::fromUri('base://a/link')->toString() . '">' . String::checkPlain('A <link>') . '</a></li>';
|
||||
$expected_links .= '<li class="a-link"><a href="' . Url::fromUri('base:a/link')->toString() . '">' . String::checkPlain('A <link>') . '</a></li>';
|
||||
$expected_links .= '<li class="plain-text">' . String::checkPlain('Plain "text"') . '</li>';
|
||||
$expected_links .= '<li class="front-page"><a href="' . Url::fromRoute('<front>')->toString() . '">' . String::checkPlain('Front page') . '</a></li>';
|
||||
$expected_links .= '<li class="router-test"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '">' . String::checkPlain('Test route') . '</a></li>';
|
||||
|
@ -254,7 +254,7 @@ class FunctionsTest extends WebTestBase {
|
|||
);
|
||||
$expected_links = '';
|
||||
$expected_links .= '<ul id="somelinks">';
|
||||
$expected_links .= '<li class="a-link"><a href="' . Url::fromUri('base://a/link')->toString() . '">' . String::checkPlain('A <link>') . '</a></li>';
|
||||
$expected_links .= '<li class="a-link"><a href="' . Url::fromUri('base:a/link')->toString() . '">' . String::checkPlain('A <link>') . '</a></li>';
|
||||
$expected_links .= '<li class="plain-text"><span class="a/class">' . String::checkPlain('Plain "text"') . '</span></li>';
|
||||
$expected_links .= '<li class="front-page"><a href="' . Url::fromRoute('<front>')->toString() . '">' . String::checkPlain('Front page') . '</a></li>';
|
||||
$expected_links .= '<li class="router-test"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '">' . String::checkPlain('Test route') . '</a></li>';
|
||||
|
@ -269,7 +269,7 @@ class FunctionsTest extends WebTestBase {
|
|||
$variables['set_active_class'] = TRUE;
|
||||
$expected_links = '';
|
||||
$expected_links .= '<ul id="somelinks">';
|
||||
$expected_links .= '<li class="a-link"><a href="' . Url::fromUri('base://a/link')->toString() . '">' . String::checkPlain('A <link>') . '</a></li>';
|
||||
$expected_links .= '<li class="a-link"><a href="' . Url::fromUri('base:a/link')->toString() . '">' . String::checkPlain('A <link>') . '</a></li>';
|
||||
$expected_links .= '<li class="plain-text"><span class="a/class">' . String::checkPlain('Plain "text"') . '</span></li>';
|
||||
$expected_links .= '<li data-drupal-link-system-path="<front>" class="front-page"><a href="' . Url::fromRoute('<front>')->toString() . '" data-drupal-link-system-path="<front>">' . String::checkPlain('Front page') . '</a></li>';
|
||||
$expected_links .= '<li data-drupal-link-system-path="router_test/test1" class="router-test"><a href="' . \Drupal::urlGenerator()->generate('router_test.1') . '" data-drupal-link-system-path="router_test/test1">' . String::checkPlain('Test route') . '</a></li>';
|
||||
|
|
|
@ -421,7 +421,7 @@ function system_authorized_init($callback, $file, $arguments = array(), $page_ti
|
|||
function system_authorized_get_url(array $options = array()) {
|
||||
global $base_url;
|
||||
// Prefix with $base_url so url() treats it as an external link.
|
||||
$url = Url::fromUri('base://core/authorize.php');
|
||||
$url = Url::fromUri('base:core/authorize.php');
|
||||
$url_options = $url->getOptions();
|
||||
$url->setOptions($options + $url_options);
|
||||
return $url;
|
||||
|
|
|
@ -56,7 +56,7 @@ class FormTestRedirectForm extends FormBase {
|
|||
if (!$form_state->isValueEmpty('destination')) {
|
||||
// @todo Use Url::fromPath() once https://www.drupal.org/node/2351379 is
|
||||
// resolved.
|
||||
$form_state->setRedirectUrl(Url::fromUri('base://' . $form_state->getValue('destination')));
|
||||
$form_state->setRedirectUrl(Url::fromUri('base:' . $form_state->getValue('destination')));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -44,7 +44,7 @@ abstract class UpdateTestBase extends WebTestBase {
|
|||
protected function refreshUpdateStatus($xml_map, $url = 'update-test') {
|
||||
// Tell the Update Manager module to fetch from the URL provided by
|
||||
// update_test module.
|
||||
$this->config('update.settings')->set('fetch.url', Url::fromUri('base://' . $url, array('absolute' => TRUE))->toString())->save();
|
||||
$this->config('update.settings')->set('fetch.url', Url::fromUri('base:' . $url, array('absolute' => TRUE))->toString())->save();
|
||||
// Save the map for UpdateTestController::updateTest() to use.
|
||||
$this->config('update_test.settings')->set('xml_map', $xml_map)->save();
|
||||
// Manually check the update status.
|
||||
|
|
|
@ -458,7 +458,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
|
|||
$errors[] = $this->t('No query allowed.');
|
||||
}
|
||||
|
||||
if (!parse_url('base://' . $path)) {
|
||||
if (!parse_url('base:' . $path)) {
|
||||
$errors[] = $this->t('Invalid path. Valid characters are alphanumerics as well as "-", ".", "_" and "~".');
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ abstract class Links extends FieldPluginBase {
|
|||
$path = strip_tags(String::decodeEntities($this->viewsTokenReplace($path, $tokens)));
|
||||
|
||||
$links[$field] = array(
|
||||
'url' => $path ? UrlObject::fromUri('base://' . $path) : $url,
|
||||
'url' => $path ? UrlObject::fromUri('base:' . $path) : $url,
|
||||
'title' => $title,
|
||||
);
|
||||
if (!empty($this->options['destination'])) {
|
||||
|
|
|
@ -71,7 +71,7 @@ class FieldUrlTest extends ViewUnitTestBase {
|
|||
|
||||
$this->executeView($view);
|
||||
|
||||
$this->assertEqual(\Drupal::l('John', Url::fromUri('base://John')), $view->field['name']->advancedRender($view->result[0]));
|
||||
$this->assertEqual(\Drupal::l('John', Url::fromUri('base:John')), $view->field['name']->advancedRender($view->result[0]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class MenuTest extends WizardTestBase {
|
|||
$this->drupalGet('');
|
||||
$this->assertResponse(200);
|
||||
$this->assertLink($view['page[link_properties][title]']);
|
||||
$this->assertLinkByHref(Url::fromUri('base://' . $view['page[path]'])->toString());
|
||||
$this->assertLinkByHref(Url::fromUri('base:' . $view['page[path]'])->toString());
|
||||
|
||||
// Make sure the link is associated with the main menu.
|
||||
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
|
||||
|
|
|
@ -170,7 +170,7 @@ class DefaultViewsTest extends UITestBase {
|
|||
|
||||
// Check that a dynamic path is shown as text.
|
||||
$this->assertRaw('test_route_with_suffix/%/suffix');
|
||||
$this->assertNoLinkByHref(Url::fromUri('base://test_route_with_suffix/%/suffix')->toString());
|
||||
$this->assertNoLinkByHref(Url::fromUri('base:test_route_with_suffix/%/suffix')->toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -105,10 +105,6 @@ class DisplayPathTest extends UITestBase {
|
|||
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => '?bar'), t('Apply'));
|
||||
$this->assertText('Path is empty');
|
||||
|
||||
// Add an invalid path from a random test failure.
|
||||
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => 'AKI@&hO@'), t('Apply'));
|
||||
$this->assertText('Invalid path');
|
||||
|
||||
// Provide a random, valid path string.
|
||||
$random_string = $this->randomMachineName();
|
||||
|
||||
|
|
|
@ -318,7 +318,7 @@ class ViewEditForm extends ViewFormBase {
|
|||
}
|
||||
// @todo Use Url::fromPath() once https://www.drupal.org/node/2351379 is
|
||||
// resolved.
|
||||
$form_state->setRedirectUrl(Url::fromUri("base://$destination"));
|
||||
$form_state->setRedirectUrl(Url::fromUri("base:$destination"));
|
||||
}
|
||||
|
||||
$view->save();
|
||||
|
@ -424,7 +424,7 @@ class ViewEditForm extends ViewFormBase {
|
|||
'#options' => array('alt' => array($this->t("Go to the real page for this display"))),
|
||||
// @todo Use Url::fromPath() once
|
||||
// https://www.drupal.org/node/2351379 is resolved.
|
||||
'#url' => Url::fromUri("base://$path"),
|
||||
'#url' => Url::fromUri("base:$path"),
|
||||
'#prefix' => '<li class="view">',
|
||||
"#suffix" => '</li>',
|
||||
);
|
||||
|
|
|
@ -263,7 +263,7 @@ class ViewListBuilder extends ConfigEntityListBuilder {
|
|||
if ($display->hasPath()) {
|
||||
$path = $display->getPath();
|
||||
if ($view->status() && strpos($path, '%') === FALSE) {
|
||||
$all_paths[] = \Drupal::l('/' . $path, Url::fromUri('base://' . $path));
|
||||
$all_paths[] = \Drupal::l('/' . $path, Url::fromUri('base:' . $path));
|
||||
}
|
||||
else {
|
||||
$all_paths[] = String::checkPlain('/' . $path);
|
||||
|
|
|
@ -702,7 +702,7 @@ class ViewUI implements ViewEntityInterface {
|
|||
Xss::filterAdmin($this->executable->getTitle()),
|
||||
);
|
||||
if (isset($path)) {
|
||||
$path = \Drupal::l($path, Url::fromUri('base://' . $path));
|
||||
$path = \Drupal::l($path, Url::fromUri('base:' . $path));
|
||||
}
|
||||
else {
|
||||
$path = t('This display has no path.');
|
||||
|
|
|
@ -96,7 +96,7 @@ class ConfirmFormHelperTest extends UnitTestCase {
|
|||
$query = array('destination' => 'baz');
|
||||
$form = $this->getMock('Drupal\Core\Form\ConfirmFormInterface');
|
||||
$link = ConfirmFormHelper::buildCancelLink($form, new Request($query));
|
||||
$this->assertSame('base://' . $query['destination'], $link['#url']->getUri());
|
||||
$this->assertSame('base:' . $query['destination'], $link['#url']->getUri());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class UnroutedUrlTest extends UnitTestCase {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $unroutedInternal = 'base://robots.txt';
|
||||
protected $unroutedInternal = 'base:robots.txt';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -69,20 +69,53 @@ class UnroutedUrlTest extends UnitTestCase {
|
|||
* Tests the fromUri() method.
|
||||
*
|
||||
* @covers ::fromUri
|
||||
*
|
||||
* @dataProvider providerFromUri
|
||||
*/
|
||||
public function testFromUri() {
|
||||
$urls = [
|
||||
Url::fromUri($this->unroutedExternal),
|
||||
Url::fromUri($this->unroutedInternal)
|
||||
public function testFromUri($uri, $is_external) {
|
||||
$url = Url::fromUri($uri);
|
||||
|
||||
$this->assertInstanceOf('Drupal\Core\Url', $url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Data provider for testFromUri().
|
||||
*/
|
||||
public function providerFromUri() {
|
||||
return [
|
||||
['http://drupal.org', TRUE],
|
||||
['base:robots.txt', FALSE],
|
||||
['base:AKI@&hO@', FALSE],
|
||||
['base:(:;2&+h^', FALSE],
|
||||
];
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('Drupal\Core\Url', $urls[0]);
|
||||
$this->assertTrue($urls[0]->isExternal());
|
||||
/**
|
||||
* Tests the fromUri() method.
|
||||
*
|
||||
* @covers ::fromUri
|
||||
* @dataProvider providerFromInvalidUri
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testFromInvalidUri($uri) {
|
||||
$url = Url::fromUri($uri);
|
||||
}
|
||||
|
||||
$this->assertInstanceOf('Drupal\Core\Url', $urls[1]);
|
||||
$this->assertFalse($urls[1]->isExternal());
|
||||
|
||||
return $urls;
|
||||
/**
|
||||
* Data provider for testFromInvalidUri().
|
||||
*/
|
||||
public function providerFromInvalidUri() {
|
||||
return [
|
||||
['base://AKI@&hO@'],
|
||||
['#foo'],
|
||||
['foo?bar'],
|
||||
['?bar'],
|
||||
['base://(:;2&+h^'],
|
||||
['test'],
|
||||
['/test'],
|
||||
['//test'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,102 +136,101 @@ class UnroutedUrlTest extends UnitTestCase {
|
|||
$this->assertNull(Url::createFromRequest($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the fromUri() method with an non-scheme path.
|
||||
*
|
||||
* @covers ::fromUri
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testFromUriWithNonScheme() {
|
||||
Url::fromUri('test');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the isExternal() method.
|
||||
*
|
||||
* @depends testFromUri
|
||||
* @dataProvider providerFromUri
|
||||
*
|
||||
* @covers ::isExternal
|
||||
*/
|
||||
public function testIsExternal(array $urls) {
|
||||
$this->assertTrue($urls[0]->isExternal());
|
||||
$this->assertFalse($urls[1]->isExternal());
|
||||
public function testIsExternal($uri, $is_external) {
|
||||
$url = Url::fromUri($uri);
|
||||
$this->assertSame($url->isExternal(), $is_external);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the toString() method.
|
||||
*
|
||||
* @depends testFromUri
|
||||
* @dataProvider providerFromUri
|
||||
*
|
||||
* @covers ::toString
|
||||
*/
|
||||
public function testToString(array $urls) {
|
||||
$this->assertSame($this->unroutedExternal, $urls[0]->toString());
|
||||
$this->assertSame($this->unroutedInternal, $urls[1]->toString());
|
||||
public function testToString($uri) {
|
||||
$url = Url::fromUri($uri);
|
||||
$this->assertSame($uri, $url->toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the getRouteName() method.
|
||||
*
|
||||
* @depends testFromUri
|
||||
* @dataProvider providerFromUri
|
||||
*
|
||||
* @expectedException \UnexpectedValueException
|
||||
*
|
||||
* @covers ::getRouteName
|
||||
*/
|
||||
public function testGetRouteName(array $urls) {
|
||||
$urls[0]->getRouteName();
|
||||
public function testGetRouteName($uri) {
|
||||
$url = Url::fromUri($uri);
|
||||
$url->getRouteName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the getRouteParameters() method.
|
||||
*
|
||||
* @depends testFromUri
|
||||
* @dataProvider providerFromUri
|
||||
*
|
||||
* @expectedException \UnexpectedValueException
|
||||
*
|
||||
* @covers ::getRouteParameters
|
||||
*/
|
||||
public function testGetRouteParameters(array $urls) {
|
||||
$urls[0]->getRouteParameters();
|
||||
public function testGetRouteParameters($uri) {
|
||||
$url = Url::fromUri($uri);
|
||||
$url->getRouteParameters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the getInternalPath() method.
|
||||
*
|
||||
* @depends testFromUri
|
||||
* @dataProvider providerFromUri
|
||||
*
|
||||
* @covers ::getInternalPath
|
||||
*
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testGetInternalPath(array $urls) {
|
||||
$this->assertNull($urls[0]->getInternalPath());
|
||||
public function testGetInternalPath($uri) {
|
||||
$url = Url::fromUri($uri);
|
||||
$this->assertNull($url->getInternalPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the getPath() method.
|
||||
*
|
||||
* @depends testFromUri
|
||||
* @dataProvider providerFromUri
|
||||
*
|
||||
* @covers ::getUri
|
||||
*/
|
||||
public function testGetUri(array $urls) {
|
||||
$this->assertNotNull($urls[0]->getUri());
|
||||
$this->assertNotNull($urls[1]->getUri());
|
||||
public function testGetUri($uri) {
|
||||
$url = Url::fromUri($uri);
|
||||
$this->assertNotNull($url->getUri());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the getOptions() method.
|
||||
*
|
||||
* @depends testFromUri
|
||||
* @dataProvider providerFromUri
|
||||
*
|
||||
* @covers ::getOptions
|
||||
*/
|
||||
public function testGetOptions(array $urls) {
|
||||
$this->assertInternalType('array', $urls[0]->getOptions());
|
||||
$this->assertInternalType('array', $urls[1]->getOptions());
|
||||
public function testGetOptions($uri) {
|
||||
$url = Url::fromUri($uri);
|
||||
$this->assertInternalType('array', $url->getOptions());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -109,12 +109,12 @@ class UnroutedUrlAssemblerTest extends UnitTestCase {
|
|||
*/
|
||||
public function providerTestAssembleWithLocalUri() {
|
||||
return [
|
||||
['base://example', [], FALSE, '/example'],
|
||||
['base://example', ['query' => ['foo' => 'bar']], FALSE, '/example?foo=bar'],
|
||||
['base://example', ['fragment' => 'example', ], FALSE, '/example#example'],
|
||||
['base://example', [], TRUE, '/subdir/example'],
|
||||
['base://example', ['query' => ['foo' => 'bar']], TRUE, '/subdir/example?foo=bar'],
|
||||
['base://example', ['fragment' => 'example', ], TRUE, '/subdir/example#example'],
|
||||
['base:example', [], FALSE, '/example'],
|
||||
['base:example', ['query' => ['foo' => 'bar']], FALSE, '/example?foo=bar'],
|
||||
['base:example', ['fragment' => 'example', ], FALSE, '/example#example'],
|
||||
['base:example', [], TRUE, '/subdir/example'],
|
||||
['base:example', ['query' => ['foo' => 'bar']], TRUE, '/subdir/example?foo=bar'],
|
||||
['base:example', ['fragment' => 'example', ], TRUE, '/subdir/example#example'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase {
|
|||
$this->setupRequestStack(FALSE);
|
||||
$this->pathProcessor->expects($this->never())
|
||||
->method('processOutbound');
|
||||
$result = $this->unroutedUrlAssembler->assemble('base://test-uri', []);
|
||||
$result = $this->unroutedUrlAssembler->assemble('base:test-uri', []);
|
||||
$this->assertEquals('/test-uri', $result);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class UnroutedUrlAssemblerTest extends UnitTestCase {
|
|||
->method('processOutbound')
|
||||
->with('test-uri', ['path_processing' => TRUE, 'fragment' => NULL, 'query' => [], 'absolute' => NULL, 'prefix' => NULL, 'script' => NULL])
|
||||
->willReturn('test-other-uri');
|
||||
$result = $this->unroutedUrlAssembler->assemble('base://test-uri', ['path_processing' => TRUE]);
|
||||
$result = $this->unroutedUrlAssembler->assemble('base:test-uri', ['path_processing' => TRUE]);
|
||||
$this->assertEquals('/test-other-uri', $result);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ class PrimitiveTypeConstraintValidatorTest extends UnitTestCase {
|
|||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'https://www.drupal.org', TRUE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'Invalid', FALSE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'entity:node/1', TRUE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'base://', FALSE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'base://node', TRUE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'base:', TRUE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'base:node', TRUE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'user-path:', TRUE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'public://', FALSE];
|
||||
$data[] = [$this->getMock('Drupal\Core\TypedData\Type\UriInterface'), 'public://foo.png', TRUE];
|
||||
|
|
Loading…
Reference in New Issue