diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
index c329032..5c5f7f6 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
@@ -339,8 +339,8 @@ public function calculateDependencies() {
/**
* {@inheritdoc}
*/
- public function urlInfo($rel = 'edit-form') {
- return parent::urlInfo($rel);
+ public function urlInfo($rel = 'edit-form', array $options = []) {
+ return parent::urlInfo($rel, $options);
}
/**
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
index 9424994..75e7ff2 100644
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ b/core/lib/Drupal/Core/Entity/Entity.php
@@ -147,7 +147,7 @@ public function label() {
/**
* {@inheritdoc}
*/
- public function urlInfo($rel = 'canonical') {
+ public function urlInfo($rel = 'canonical', array $options = []) {
if ($this->isNew()) {
throw new EntityMalformedException(sprintf('The "%s" entity type has not been saved, and cannot have a URI.', $this->getEntityTypeId()));
}
@@ -189,8 +189,9 @@ public function urlInfo($rel = 'canonical') {
$uri
->setOption('entity_type', $this->getEntityTypeId())
->setOption('entity', $this);
-
- return $uri;
+ $uri_options = $uri->getOptions();
+ $uri_options += $options;
+ return $uri->setOptions($uri_options);
}
/**
diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php
index 4399d01..f60b635 100644
--- a/core/lib/Drupal/Core/Entity/EntityInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityInterface.php
@@ -119,10 +119,13 @@ public function label();
*
* @param string $rel
* The link relationship type, for example: canonical or edit-form.
+ * @param array $options
+ * See \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for
+ * the available options.
*
* @return \Drupal\Core\Url
*/
- public function urlInfo($rel = 'canonical');
+ public function urlInfo($rel = 'canonical', array $options = array());
/**
* Returns the public URL for this entity.
diff --git a/core/modules/aggregator/src/Tests/UpdateFeedTest.php b/core/modules/aggregator/src/Tests/UpdateFeedTest.php
index fe3d45e..6736b02 100644
--- a/core/modules/aggregator/src/Tests/UpdateFeedTest.php
+++ b/core/modules/aggregator/src/Tests/UpdateFeedTest.php
@@ -31,7 +31,7 @@ function testUpdateFeed() {
$this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title[0][value]'])), format_string('The feed %name has been updated.', array('%name' => $edit['title[0][value]'])));
// Check feed data.
- $this->assertEqual($this->getUrl(), url('aggregator/sources/' . $feed->id(), array('absolute' => TRUE)));
+ $this->assertEqual($this->getUrl(), $feed->urlInfo('canonical', ['absolute' => TRUE]))->toString();
$this->assertTrue($this->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.');
// Check feed source.
diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index 393b705..de3ab11 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -124,7 +124,7 @@ function testFormatAdmin() {
// exists.
// @todo: See https://drupal.org/node/2031223 for the above
$edit_link = $this->xpath('//a[@href=:href]', array(
- ':href' => url('admin/config/content/formats/manage/' . $format_id)
+ ':href' => \Drupal::url('entity.filter_format.edit_form', ['filter_format' => $format_id])
));
$this->assertTrue($edit_link, format_string('Link href %href found.',
array('%href' => 'admin/config/content/formats/manage/' . $format_id)
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index bd63149..2d683ae 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -629,7 +629,7 @@ function template_preprocess_forum_list(&$variables) {
// Sanitize each forum so that the template can safely print the data.
foreach ($variables['forums'] as $id => $forum) {
$variables['forums'][$id]->description = Xss::filterAdmin($forum->description->value);
- $variables['forums'][$id]->link = url("forum/" . $forum->id());
+ $variables['forums'][$id]->link = $forum->url();
$variables['forums'][$id]->name = String::checkPlain($forum->label());
$variables['forums'][$id]->is_container = !empty($forum->forum_container->value);
$variables['forums'][$id]->zebra = $row % 2 == 0 ? 'odd' : 'even';
diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
index 4753539..8f32d13 100644
--- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
+++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
@@ -417,7 +417,7 @@ function testLanguageDomain() {
// Test URL in another language: http://it.example.com/admin.
// Base path gives problems on the testbot, so $correct_link is hard-coded.
// @see UrlAlterFunctionalTest::assertUrlOutboundAlter (path.test).
- $italian_url = url('admin', array('language' => $languages['it'], 'script' => ''));
+ $italian_url = \Drupal::url('system.admin', array(), array('language' => $languages['it'], 'script' => ''));
$url_scheme = \Drupal::request()->isSecure() ? 'https://' : 'http://';
$correct_link = $url_scheme . $link;
$this->assertEqual($italian_url, $correct_link, format_string('The url() function returns the right URL (@url) in accordance with the chosen language', array('@url' => $italian_url)));
@@ -426,7 +426,7 @@ function testLanguageDomain() {
$this->settingsSet('mixed_mode_sessions', TRUE);
$this->rebuildContainer();
- $italian_url = url('admin', array('https' => TRUE, 'language' => $languages['it'], 'script' => ''));
+ $italian_url = \Drupal::url('system.admin', array(), array('https' => TRUE, 'language' => $languages['it'], 'script' => ''));
$correct_link = 'https://' . $link;
$this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right HTTPS URL (via options) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
$this->settingsSet('mixed_mode_sessions', FALSE);
@@ -435,7 +435,7 @@ function testLanguageDomain() {
$request = Request::create('', 'GET', array(), array(), array(), array('HTTPS' => 'on'));
$this->container->get('request_stack')->push($request);
$generator = $this->container->get('url_generator');
- $italian_url = url('admin', array('language' => $languages['it'], 'script' => ''));
+ $italian_url = \Drupal::url('system.admin', array(), array('language' => $languages['it'], 'script' => ''));
$correct_link = 'https://' . $link;
$this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right URL (via current URL scheme) (@url) in accordance with the chosen language', array('@url' => $italian_url)));
}
diff --git a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
index eac3b43..2c9177c 100644
--- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
@@ -102,7 +102,7 @@ public function testStandalonePoFile() {
'langcode' => 'fr',
));
- $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => url('admin/reports/dblog')));
+ $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => \Drupal::url('dblog.overview')));
$this->assertRaw($skip_message, 'Unsafe strings were skipped.');
// Check empty files import with a user that cannot access site reports..
@@ -122,7 +122,7 @@ public function testStandalonePoFile() {
'langcode' => 'fr',
));
// The import should have created 0 string and rejected 0.
- $this->assertRaw(t('One translation file could not be imported. See the log for details.', array('@url' => url('admin/reports/dblog'))), 'The empty translation file import reported no translations imported.');
+ $this->assertRaw(t('One translation file could not be imported. See the log for details.', array('@url' => \Drupal::url('dblog.overview'))), 'The empty translation file import reported no translations imported.');
// Try importing a .po file which doesn't exist.
$name = $this->randomMachineName(16);
@@ -130,7 +130,7 @@ public function testStandalonePoFile() {
'langcode' => 'fr',
'files[file]' => $name,
), t('Import'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertEqual($this->getUrl(), \Drupal::url('locale.translate_import', array(), array('absolute' => TRUE)), 'Correct page redirection.');
$this->assertText(t('File to import not found.'), 'File to import not found message.');
// Try importing a .po file with overriding strings, and ensure existing
diff --git a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
index 341f39d..f7a304a 100644
--- a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
+++ b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
@@ -106,7 +106,7 @@ public function testStringTranslation() {
$this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
$this->assertText(t('The strings have been saved.'), 'The strings have been saved.');
$url_bits = explode('?', $this->getUrl());
- $this->assertEqual($url_bits[0], url('admin/config/regional/translate', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertEqual($url_bits[0], \Drupal::url('locale.translate_import', array(), array('absolute' => TRUE)), 'Correct page redirection.');
$search = array(
'string' => $name,
'langcode' => $langcode,
diff --git a/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php b/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php
index ddd9eae..5a33942 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateInterfaceTest.php
@@ -43,7 +43,7 @@ public function testInterface() {
$this->assertNoText(t('Translation update status'), 'No status message');
$this->drupalGet('admin/reports/translations');
- $this->assertRaw(t('No translatable languages available. Add a language first.', array('@add_language' => url('admin/config/regional/language'))), 'Language message');
+ $this->assertRaw(t('No translatable languages available. Add a language first.', array('@add_language' => \Drupal::url('language.admin_overview'))), 'Language message');
// Add German language.
$this->addLanguage('de');
@@ -70,7 +70,7 @@ public function testInterface() {
// Check if updates are available for German.
$this->drupalGet('admin/reports/status');
$this->assertText(t('Translation update status'), 'Status message');
- $this->assertRaw(t('Updates available for: @languages. See the Available translation updates page for more information.', array('@languages' => t('German'), '@updates' => url('admin/reports/translations'))), 'Updates available message');
+ $this->assertRaw(t('Updates available for: @languages. See the Available translation updates page for more information.', array('@languages' => t('German'), '@updates' => \Drupal::url('locale.translate_status'))), 'Updates available message');
$this->drupalGet('admin/reports/translations');
$this->assertText(t('Updates for: @modules', array('@modules' => 'Locale test translate')), 'Translations avaiable');
@@ -84,7 +84,7 @@ public function testInterface() {
// Check if no updates were found.
$this->drupalGet('admin/reports/status');
$this->assertText(t('Translation update status'), 'Status message');
- $this->assertRaw(t('Missing translations for: @languages. See the Available translation updates page for more information.', array('@languages' => t('German'), '@updates' => url('admin/reports/translations'))), 'Missing translations message');
+ $this->assertRaw(t('Missing translations for: @languages. See the Available translation updates page for more information.', array('@languages' => t('German'), '@updates' => \Drupal::url('locale.translate_status'))), 'Missing translations message');
$this->drupalGet('admin/reports/translations');
$this->assertText(t('Missing translations for one project'), 'No translations found');
$this->assertText(t('@module (@version).', array('@module' => 'Locale test translate', '@version' => '1.3-dev')), 'Release details');
diff --git a/core/modules/node/src/Plugin/views/field/Path.php b/core/modules/node/src/Plugin/views/field/Path.php
index 33c67d7..3ae18d4 100644
--- a/core/modules/node/src/Plugin/views/field/Path.php
+++ b/core/modules/node/src/Plugin/views/field/Path.php
@@ -59,7 +59,7 @@ public function query() {
*/
public function render(ResultRow $values) {
$nid = $this->getValue($values, 'nid');
- return url("node/$nid", array('absolute' => $this->options['absolute']));
+ return \Drupal::url('entity.node.canonical', ['node' => $nid], ['absolute' => $this->options['absolute']]);
}
}
diff --git a/core/modules/node/src/Tests/NodeBlockFunctionalTest.php b/core/modules/node/src/Tests/NodeBlockFunctionalTest.php
index 155166a..9bc5054 100644
--- a/core/modules/node/src/Tests/NodeBlockFunctionalTest.php
+++ b/core/modules/node/src/Tests/NodeBlockFunctionalTest.php
@@ -146,7 +146,7 @@ public function testRecentNodeBlock() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/structure/block');
$this->assertText($label, 'Block was displayed on the admin/structure/block page.');
- $this->assertLinkByHref(url('admin/structure/block/manage/' . $block->id()));
+ $this->assertLinkByHref($block->url());
}
}
diff --git a/core/modules/node/src/Tests/NodeTokenReplaceTest.php b/core/modules/node/src/Tests/NodeTokenReplaceTest.php
index fa7516d..98d1e9b 100644
--- a/core/modules/node/src/Tests/NodeTokenReplaceTest.php
+++ b/core/modules/node/src/Tests/NodeTokenReplaceTest.php
@@ -69,8 +69,8 @@ function testNodeTokenReplacement() {
$tests['[node:body]'] = $node->body->processed;
$tests['[node:summary]'] = $node->body->summary_processed;
$tests['[node:langcode]'] = String::checkPlain($node->language()->id);
- $tests['[node:url]'] = url('node/' . $node->id(), $url_options);
- $tests['[node:edit-url]'] = url('node/' . $node->id() . '/edit', $url_options);
+ $tests['[node:url]'] = $node->url('canonical', $url_options);
+ $tests['[node:edit-url]'] = $node->url('edit-form', $url_options);
$tests['[node:author]'] = String::checkPlain($account->getUsername());
$tests['[node:author:uid]'] = $node->getOwnerId();
$tests['[node:author:name]'] = String::checkPlain($account->getUsername());
diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php
index 3125928..c0fdb83 100644
--- a/core/modules/node/src/Tests/NodeTypeTest.php
+++ b/core/modules/node/src/Tests/NodeTypeTest.php
@@ -108,7 +108,7 @@ function testNodeTypeEditing() {
$this->assertRaw('Bar', 'New name was displayed.');
$this->assertRaw('Lorem ipsum', 'New description was displayed.');
$this->clickLink('Bar');
- $this->assertEqual(url('node/add/bar', array('absolute' => TRUE)), $this->getUrl(), 'New machine name was used in URL.');
+ $this->assertEqual(\Drupal::url('node.add', ['node_type' => 'bar'], ['absolute' => TRUE]), $this->getUrl(), 'New machine name was used in URL.');
$this->assertRaw('Foo', 'Title field was found.');
$this->assertRaw('Body', 'Body field was found.');
diff --git a/core/modules/node/src/Tests/PageEditTest.php b/core/modules/node/src/Tests/PageEditTest.php
index a014c80..3fb22c0 100644
--- a/core/modules/node/src/Tests/PageEditTest.php
+++ b/core/modules/node/src/Tests/PageEditTest.php
@@ -43,7 +43,7 @@ function testPageEdit() {
// Check that "edit" link points to correct page.
$this->clickLink(t('Edit'));
- $edit_url = url("node/" . $node->id() . "/edit", array('absolute' => TRUE));
+ $edit_url = $node->url('canonical', ['absolute' => TRUE]);
$actual_url = $this->getURL();
$this->assertEqual($edit_url, $actual_url, 'On edit page.');
diff --git a/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php b/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php
index bb01895..a4847fc 100644
--- a/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php
+++ b/core/modules/node/src/Tests/Views/NodeContextualLinksTest.php
@@ -84,7 +84,7 @@ protected function renderContextualLinks($ids, $current_path) {
// Perform HTTP request.
return $this->curlExec(array(
- CURLOPT_URL => url('contextual/render', array('absolute' => TRUE, 'query' => array('destination' => $current_path))),
+ CURLOPT_URL => \Drupal::url('contextual.render', [], ['absolute' => TRUE, 'query' => array('destination' => $current_path)]),
CURLOPT_POST => TRUE,
CURLOPT_POSTFIELDS => $post,
CURLOPT_HTTPHEADER => array(
diff --git a/core/modules/rdf/src/Tests/CommentAttributesTest.php b/core/modules/rdf/src/Tests/CommentAttributesTest.php
index ff2f28f..69a5966 100644
--- a/core/modules/rdf/src/Tests/CommentAttributesTest.php
+++ b/core/modules/rdf/src/Tests/CommentAttributesTest.php
@@ -42,8 +42,8 @@ protected function setUp() {
$this->setCommentSettings('comment_default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
// Prepares commonly used URIs.
- $this->base_uri = url('', array('absolute' => TRUE));
- $this->node_uri = url('node/' . $this->node->id(), array('absolute' => TRUE));
+ $this->base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
+ $this->node_uri = $this->node->url('canonical', ['absolute' => TRUE]);
// Set relation between node and comment.
$article_mapping = rdf_get_mapping('node', 'article');
@@ -182,11 +182,11 @@ public function testCommentReplyOfRdfaMarkup() {
$this->drupalLogin($this->web_user);
$comment_1 = $this->saveComment($this->node->id(), $this->web_user->id());
- $comment_1_uri = url('comment/' . $comment_1->id(), array('absolute' => TRUE));
+ $comment_1_uri = $comment_1->url('canonical', ['absolute' => TRUE]);
// Posts a reply to the first comment.
$comment_2 = $this->saveComment($this->node->id(), $this->web_user->id(), NULL, $comment_1->id());
- $comment_2_uri = url('comment/' . $comment_2->id(), array('absolute' => TRUE));
+ $comment_2_uri = $comment_2->url('canonical', ['absolute' => TRUE]);
$parser = new \EasyRdf_Parser_Rdfa();
$graph = new \EasyRdf_Graph();
diff --git a/core/modules/rdf/src/Tests/FileFieldAttributesTest.php b/core/modules/rdf/src/Tests/FileFieldAttributesTest.php
index abda15d..8d89b0a 100644
--- a/core/modules/rdf/src/Tests/FileFieldAttributesTest.php
+++ b/core/modules/rdf/src/Tests/FileFieldAttributesTest.php
@@ -84,10 +84,10 @@ function testNodeTeaser() {
// Parses front page where the node is displayed in its teaser form.
$parser = new \EasyRdf_Parser_Rdfa();
$graph = new \EasyRdf_Graph();
- $base_uri = url('', array('absolute' => TRUE));
+ $base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
$parser->parse($graph, $html, 'rdfa', $base_uri);
- $node_uri = url('node/' . $this->node->id(), array('absolute' => TRUE));
+ $node_uri = $this->node->url('canonical', ['absolute' => TRUE]);
$file_uri = file_create_url($this->file->getFileUri());
// Node relation to attached file.
diff --git a/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php b/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php
index 3715620..fbf0c6d 100644
--- a/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php
+++ b/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php
@@ -89,11 +89,11 @@ function testNodeTeaser() {
// Parse the teaser.
$parser = new \EasyRdf_Parser_Rdfa();
$graph = new \EasyRdf_Graph();
- $base_uri = url('', array('absolute' => TRUE));
+ $base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
$parser->parse($graph, $html, 'rdfa', $base_uri);
// Construct the node and image URIs for testing.
- $node_uri = url('node/' . $this->node->id(), array('absolute' => TRUE));
+ $node_uri = $this->node->url('canonical', ['absolute' => TRUE]);
$image_uri = entity_load('image_style', 'medium')->buildUrl($this->file->getFileUri());
// Test relations from node to image.
diff --git a/core/modules/rdf/src/Tests/NodeAttributesTest.php b/core/modules/rdf/src/Tests/NodeAttributesTest.php
index 8539b2b..43f736a 100644
--- a/core/modules/rdf/src/Tests/NodeAttributesTest.php
+++ b/core/modules/rdf/src/Tests/NodeAttributesTest.php
@@ -52,8 +52,8 @@ function testNodeAttributes() {
'title' => $this->randomMachineName(8) . "'",
));
- $node_uri = url('node/' . $node->id(), array('absolute' => TRUE));
- $base_uri = url('', array('absolute' => TRUE));
+ $node_uri = $node->url('canonical', ['absolute' => TRUE]);
+ $base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
// Parses front page where the node is displayed in its teaser form.
$parser = new \EasyRdf_Parser_Rdfa();
diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php
index d097a5e..29e9804 100644
--- a/core/modules/rdf/src/Tests/StandardProfileTest.php
+++ b/core/modules/rdf/src/Tests/StandardProfileTest.php
@@ -104,7 +104,7 @@ class StandardProfileTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- $this->base_uri = url('', array('absolute' => TRUE));
+ $this->base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
// Create two test users.
$this->adminUser = $this->drupalCreateUser(array(
diff --git a/core/modules/rdf/src/Tests/TaxonomyAttributesTest.php b/core/modules/rdf/src/Tests/TaxonomyAttributesTest.php
index 1900485..0624cb6 100644
--- a/core/modules/rdf/src/Tests/TaxonomyAttributesTest.php
+++ b/core/modules/rdf/src/Tests/TaxonomyAttributesTest.php
@@ -42,12 +42,12 @@ protected function setUp() {
*/
function testTaxonomyTermRdfaAttributes() {
$term = $this->createTerm($this->vocabulary);
- $term_uri = url('taxonomy/term/' . $term->id(), array('absolute' => TRUE));
+ $term_uri = $term->url('canonical', ['absolute' => TRUE]);
// Parses the term's page and checks that the RDF output is correct.
$parser = new \EasyRdf_Parser_Rdfa();
$graph = new \EasyRdf_Graph();
- $base_uri = url('', array('absolute' => TRUE));
+ $base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
$parser->parse($graph, $this->drupalGet('taxonomy/term/' . $term->id()), 'rdfa', $base_uri);
// Inspects RDF graph output.
diff --git a/core/modules/rdf/src/Tests/TaxonomyTermFieldAttributesTest.php b/core/modules/rdf/src/Tests/TaxonomyTermFieldAttributesTest.php
index 659f2d7..4eaec12 100644
--- a/core/modules/rdf/src/Tests/TaxonomyTermFieldAttributesTest.php
+++ b/core/modules/rdf/src/Tests/TaxonomyTermFieldAttributesTest.php
@@ -78,8 +78,8 @@ function testNodeTeaser() {
// Create a term in each vocabulary.
$term1 = $this->createTerm($this->vocabulary);
$term2 = $this->createTerm($this->vocabulary);
- $taxonomy_term_1_uri = url('taxonomy/term/' . $term1->id(), array('absolute' => TRUE));
- $taxonomy_term_2_uri = url('taxonomy/term/' . $term2->id(), array('absolute' => TRUE));
+ $taxonomy_term_1_uri = $term1->url('canonical', ['absolute' => TRUE]);
+ $taxonomy_term_2_uri = $term2->url('canonical', ['absolute' => TRUE]);
// Create the node.
$node = $this->drupalCreateNode(array('type' => 'article'));
@@ -95,11 +95,11 @@ function testNodeTeaser() {
// Parse the teaser.
$parser = new \EasyRdf_Parser_Rdfa();
$graph = new \EasyRdf_Graph();
- $base_uri = url('', array('absolute' => TRUE));
+ $base_uri = \Durpal::url('', [], ['absolute' => TRUE]);
$parser->parse($graph, $html, 'rdfa', $base_uri);
// Node relations to taxonomy terms.
- $node_uri = url('node/' . $node->id(), array('absolute' => TRUE));
+ $node_uri = $node->url('canonical', ['absolute' => TRUE]);
$expected_value = array(
'type' => 'uri',
'value' => $taxonomy_term_1_uri,
diff --git a/core/modules/rdf/src/Tests/UserAttributesTest.php b/core/modules/rdf/src/Tests/UserAttributesTest.php
index f3ac891..d6b6c24 100644
--- a/core/modules/rdf/src/Tests/UserAttributesTest.php
+++ b/core/modules/rdf/src/Tests/UserAttributesTest.php
@@ -64,7 +64,7 @@ function testUserAttributesInMarkup() {
// should be used.
$parser = new \EasyRdf_Parser_Rdfa();
$graph = new \EasyRdf_Graph();
- $base_uri = url('', array('absolute' => TRUE));
+ $base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
$parser->parse($graph, $this->drupalGet('user/' . $author->id()), 'rdfa', $base_uri);
// Inspects RDF graph output.
@@ -89,7 +89,7 @@ function testUserAttributesInMarkup() {
// Parses the node created by the user.
$parser = new \EasyRdf_Parser_Rdfa();
$graph = new \EasyRdf_Graph();
- $base_uri = url('', array('absolute' => TRUE));
+ $base_uri = \Drupal::url('', [], ['absolute' => TRUE]);
$parser->parse($graph, $this->drupalGet('node/' . $node->id()), 'rdfa', $base_uri);
// Ensures the default bundle mapping for user is used on the Authored By
diff --git a/core/modules/views/src/Tests/Plugin/DisplayTest.php b/core/modules/views/src/Tests/Plugin/DisplayTest.php
index 9b8d63b..6229cf3 100644
--- a/core/modules/views/src/Tests/Plugin/DisplayTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisplayTest.php
@@ -177,7 +177,7 @@ public function testReadMore() {
$this->drupalSetContent($output);
$result = $this->xpath('//a[@class=:class]', array(':class' => 'more-link'));
- $this->assertEqual($result[0]->attributes()->href, url('test_display_more'), 'The right more link is shown.');
+ $this->assertEqual($result[0]->attributes()->href, \Drupal::url('view.test_display_more.page_1'), 'The right more link is shown.');
$this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
// Test the renderMoreLink method directly. This could be directly unit
@@ -186,7 +186,7 @@ public function testReadMore() {
$more_link = drupal_render($more_link);
$this->drupalSetContent($more_link);
$result = $this->xpath('//a[@class=:class]', array(':class' => 'more-link'));
- $this->assertEqual($result[0]->attributes()->href, url('test_display_more'), 'The right more link is shown.');
+ $this->assertEqual($result[0]->attributes()->href, \Drupal::url('view.test_display_more.page_1'), 'The right more link is shown.');
$this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.');
// Test the useMoreText method directly. This could be directly unit
diff --git a/core/modules/views/src/Tests/Wizard/BasicTest.php b/core/modules/views/src/Tests/Wizard/BasicTest.php
index 09a36cb..99c495c 100644
--- a/core/modules/views/src/Tests/Wizard/BasicTest.php
+++ b/core/modules/views/src/Tests/Wizard/BasicTest.php
@@ -37,9 +37,9 @@ function testViewsWizardAndListing() {
$this->drupalGet('admin/structure/views');
$this->assertText($view1['label']);
$this->assertText($view1['description']);
- $this->assertLinkByHref(url('admin/structure/views/view/' . $view1['id']));
- $this->assertLinkByHref(url('admin/structure/views/view/' . $view1['id'] . '/delete'));
- $this->assertLinkByHref(url('admin/structure/views/view/' . $view1['id'] . '/duplicate'));
+ $this->assertLinkByHref(\Drupal::url('entity.view.edit_form', ['view' => $view1['id']]));
+ $this->assertLinkByHref(\Drupal::url('entity.view.delete_form', ['view' => $view1['id']]));
+ $this->assertLinkByHref(\Drupal::url('entity.view.duplicate_form', ['view' => $view1['id']]));
// The view should not have a REST export display.
$this->assertNoText('REST export', 'When no options are enabled in the wizard, the resulting view does not have a REST export display.');
@@ -79,9 +79,9 @@ function testViewsWizardAndListing() {
$this->assertRaw('assertText($view2['page[title]']);
- $this->assertRaw(url('node/' . $node1->id(), array('absolute' => TRUE)));
+ $this->assertRaw($node1->url('canonical', ['absolute' => TRUE]));
$this->assertText($node1->label());
- $this->assertRaw(url('node/' . $node2->id(), array('absolute' => TRUE)));
+ $this->assertRaw($node2->url('canonical', ['absolute' => TRUE]));
$this->assertText($node2->label());
// Go back to the views page and check if this view is there.
diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php
index 7e1bc27..bf6b42a 100644
--- a/core/modules/views_ui/src/ViewUI.php
+++ b/core/modules/views_ui/src/ViewUI.php
@@ -926,8 +926,8 @@ public function save() {
/**
* Implements \Drupal\Core\Entity\EntityInterface::uri().
*/
- public function urlInfo($rel = 'edit-form') {
- return $this->storage->urlInfo($rel);
+ public function urlInfo($rel = 'edit-form', array $options = []) {
+ return $this->storage->urlInfo($rel, $options);
}
/**