diff --git a/core/modules/aggregator/src/Tests/UpdateFeedTest.php b/core/modules/aggregator/src/Tests/UpdateFeedTest.php index a4f2dd7..55cc4e0 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->assertUrl($feed->url()); + $this->assertUrl($feed->url('canonical', ['absolute' => TRUE])); $this->assertTrue($this->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.'); // Check feed source. diff --git a/core/modules/user/src/Tests/UserBlocksTest.php b/core/modules/user/src/Tests/UserBlocksTest.php index 89be95c..5549ba4 100644 --- a/core/modules/user/src/Tests/UserBlocksTest.php +++ b/core/modules/user/src/Tests/UserBlocksTest.php @@ -54,7 +54,7 @@ function testUserLoginBlock() { $this->assertNoText(t('User login'), 'Logged in.'); // Check that we are still on the same page. - $this->assertUrl(\Drupal::url('user.admin_permissions', [], ['absolute' => TRUE]), 'Still on the same page after login for access denied page'); + $this->assertUrl(\Drupal::url('user.admin_permissions', [], ['absolute' => TRUE]), [], 'Still on the same page after login for access denied page'); // Now, log out and repeat with a non-403 page. $this->drupalLogout(); diff --git a/core/modules/views/src/Tests/Handler/FieldWebTest.php b/core/modules/views/src/Tests/Handler/FieldWebTest.php index 8847263..cdb98dc 100644 --- a/core/modules/views/src/Tests/Handler/FieldWebTest.php +++ b/core/modules/views/src/Tests/Handler/FieldWebTest.php @@ -25,6 +25,11 @@ class FieldWebTest extends HandlerTestBase { */ public static $testViews = array('test_view', 'test_field_classes', 'test_field_output', 'test_click_sort'); + /** + * {@inheritdoc} + */ + public static $modules = ['node']; + protected $column_map = array( 'views_test_data_name' => 'name', ); @@ -51,13 +56,13 @@ public function testClickSorting() { $this->drupalGet('test_click_sort'); $this->assertResponse(200); // Only the id and name should be click sortable, but not the name. - $this->assertLinkByHref(url('test_click_sort', array('query' => array('order' => 'id', 'sort' => 'asc')))); - $this->assertLinkByHref(url('test_click_sort', array('query' => array('order' => 'name', 'sort' => 'desc')))); - $this->assertNoLinkByHref(url('test_click_sort', array('query' => array('order' => 'created')))); + $this->assertLinkByHref(\Drupal::url('view.test_click_sort.page_1', [], ['query' => ['order' => 'id', 'sort' => 'asc']])); + $this->assertLinkByHref(\Drupal::url('view.test_click_sort.page_1', [], ['query' => ['order' => 'name', 'sort' => 'desc']])); + $this->assertNoLinkByHref(\Drupal::url('view.test_click_sort.page_1', [], ['query' => ['order' => 'created']])); // Clicking a click sort should change the order. $this->clickLink(t('ID')); - $this->assertLinkByHref(url('test_click_sort', array('query' => array('order' => 'id', 'sort' => 'desc')))); + $this->assertLinkByHref(\Drupal::url('view.test_click_sort.page_1', [], ['query' => ['order' => 'id', 'sort' => 'desc']])); // Check that the output has the expected order (asc). $ids = $this->clickSortLoadIdsFromOutput(); $this->assertEqual($ids, range(1, 5)); @@ -199,38 +204,37 @@ public function testAlterUrl() { global $base_url, $script_path; foreach (array(FALSE, TRUE) as $absolute) { - // Get the expected start of the path string. - $base = ($absolute ? $base_url . '/' : base_path()) . $script_path; - $absolute_string = $absolute ? 'absolute' : NULL; $alter = &$id_field->options['alter']; $alter['path'] = 'node/123'; - $expected_result = url('node/123', array('absolute' => $absolute)); + $expected_result = \Drupal::url('entity.node.canonical', ['node' => '123'], ['absolute' => $absolute]); $alter['absolute'] = $absolute; $result = $id_field->theme($row); $this->assertSubString($result, $expected_result); - $expected_result = url('node/123', array('fragment' => 'foo', 'absolute' => $absolute)); + $expected_result = \Drupal::url('entity.node.canonical', ['node' => '123'], ['fragment' => 'foo', 'absolute' => $absolute]); $alter['path'] = 'node/123#foo'; $result = $id_field->theme($row); $this->assertSubString($result, $expected_result); - $expected_result = url('node/123', array('query' => array('foo' => NULL), 'absolute' => $absolute)); + $expected_result = \Drupal::url('entity.node.canonical', ['node' => '123'], ['query' => ['foo' => NULL], 'absolute' => $absolute]); $alter['path'] = 'node/123?foo'; $result = $id_field->theme($row); $this->assertSubString($result, $expected_result); - $expected_result = url('node/123', array('query' => array('foo' => 'bar', 'bar' => 'baz'), 'absolute' => $absolute)); + $expected_result = \Drupal::url('entity.node.canonical', ['node' => '123'], ['query' => ['foo' => 'bar', 'bar' => 'baz'], 'absolute' => $absolute]); $alter['path'] = 'node/123?foo=bar&bar=baz'; $result = $id_field->theme($row); $this->assertSubString(decode_entities($result), decode_entities($expected_result)); - $expected_result = url('node/123', array('query' => array('foo' => NULL), 'fragment' => 'bar', 'absolute' => $absolute)); + // @todo The route-based URL generator strips out NULL attributes. + // $expected_result = \Drupal::url('entity.node.canonical', ['node' => '123'], ['query' => ['foo' => NULL], 'fragment' => 'bar', 'absolute' => $absolute]); + $expected_result = \Drupal::urlGenerator()->generateFromPath('node/123', array('query' => array('foo' => NULL), 'fragment' => 'bar', 'absolute' => $absolute)); $alter['path'] = 'node/123?foo#bar'; $result = $id_field->theme($row); $this->assertSubString(decode_entities($result), decode_entities($expected_result)); - $expected_result = url('', array('absolute' => $absolute)); + $expected_result = \Drupal::url('', [], ['absolute' => $absolute]); $alter['path'] = ''; $result = $id_field->theme($row); $this->assertSubString($result, $expected_result);