Loading core/modules/system/src/Tests/Common/RenderWebTest.php +1 −1 Changes for core/modules/system/src/Tests/Common/RenderWebTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ function testDrupalRenderFormElements() { ), ); $this->assertRenderedElement($element, '//a[@href=:href and contains(., :title)]', array( ':href' => \Drupal::urlGenerator()->generateFromPath('common-test/destination', ['absolute' => TRUE]), ':href' => URL::fromRoute('common_test.destination')->setAbsolute()->toString(), ':title' => $element['#title'], )); Loading core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php +5 −4 Changes for core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -82,14 +82,14 @@ function testUrlAlter() { * A string with the original path that is run through generateFrommPath(). * @param $final * A string with the expected result after generateFrommPath(). * * @return * TRUE if $original was correctly altered to $final, FALSE otherwise. */ protected function assertUrlOutboundAlter($original, $final) { // Test outbound altering. $result = $this->container->get('url_generator')->generateFromPath(ltrim($original, '/')); $final = Url::fromUri('internal:' . $final)->toString(); $this->assertIdentical($result, $final, format_string('Altered outbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); $result = $this->container->get('path_processor_manager')->processOutbound($original); return $this->assertIdentical($result, $final, format_string('Altered outbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); } /** Loading @@ -99,12 +99,13 @@ protected function assertUrlOutboundAlter($original, $final) { * The original path before it has been altered by inbound URL processing. * @param $final * A string with the expected result. * * @return * TRUE if $original was correctly altered to $final, FALSE otherwise. */ protected function assertUrlInboundAlter($original, $final) { // Test inbound altering. $result = $this->container->get('path.alias_manager')->getPathByAlias($original); $this->assertIdentical($result, $final, format_string('Altered inbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); return $this->assertIdentical($result, $final, format_string('Altered inbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); } } core/modules/system/src/Tests/Routing/RouterTest.php +5 −4 Changes for core/modules/system/src/Tests/Routing/RouterTest.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use Drupal\simpletest\WebTestBase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Exception\RouteNotFoundException; use Drupal\Core\Url; /** * Functional class for the full integrated routing system. Loading Loading @@ -181,10 +182,10 @@ public function testControllerResolutionPage() { * Checks the generate method on the url generator using the front router. */ public function testUrlGeneratorFront() { global $base_path; $this->assertEqual($this->container->get('url_generator')->generate('<front>'), $base_path); $this->assertEqual($this->container->get('url_generator')->generateFromPath('<front>'), $base_path); $front_url = Url::fromRoute('<front>', [], ['absolute' => TRUE]); // Compare to the site base URL. $base_url = Url::fromUri('base:/', ['absolute' => TRUE]); $this->assertIdentical($base_url->toString(), $front_url->toString()); } /** Loading core/modules/system/tests/modules/url_alter_test/src/PathProcessor.php +1 −3 Changes for core/modules/system/tests/modules/url_alter_test/src/PathProcessor.php: 1 added line, 3 removed lines. Original line number Diff line number Diff line Loading @@ -27,9 +27,7 @@ public function processInbound($path, Request $request) { } // Rewrite community/ to forum/. if ($path == '/community' || strpos($path, '/community/') === 0) { $path = '/forum' . substr($path, 9); } $path = preg_replace('@^/community(.*)@', '/forum$1', $path); if ($path == '/url-alter-test/bar') { $path = '/url-alter-test/foo'; Loading core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php +2 −7 Changes for core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php: 2 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -31,9 +31,7 @@ public function processInbound($path, Request $request) { } // Rewrite community/ to forum/. if ($path == '/community' || strpos($path, '/community/') === 0) { $path = '/forum' . substr($path, 10); } $path = preg_replace('@^/community(.*)@', '/forum$1', $path); if ($path == '/url-alter-test/bar') { $path = '/url-alter-test/foo'; Loading @@ -57,10 +55,7 @@ public function processOutbound($path, &$options = array(), Request $request = N } // Rewrite forum/ to community/. if ($path == '/forum' || strpos($path, '/forum/') === 0) { $path = '/community' . substr($path, 5); } return $path; return preg_replace('@^/forum(.*)@', '/community$1', $path); } } Loading
core/modules/system/src/Tests/Common/RenderWebTest.php +1 −1 Changes for core/modules/system/src/Tests/Common/RenderWebTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ function testDrupalRenderFormElements() { ), ); $this->assertRenderedElement($element, '//a[@href=:href and contains(., :title)]', array( ':href' => \Drupal::urlGenerator()->generateFromPath('common-test/destination', ['absolute' => TRUE]), ':href' => URL::fromRoute('common_test.destination')->setAbsolute()->toString(), ':title' => $element['#title'], )); Loading
core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php +5 −4 Changes for core/modules/system/src/Tests/Path/UrlAlterFunctionalTest.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -82,14 +82,14 @@ function testUrlAlter() { * A string with the original path that is run through generateFrommPath(). * @param $final * A string with the expected result after generateFrommPath(). * * @return * TRUE if $original was correctly altered to $final, FALSE otherwise. */ protected function assertUrlOutboundAlter($original, $final) { // Test outbound altering. $result = $this->container->get('url_generator')->generateFromPath(ltrim($original, '/')); $final = Url::fromUri('internal:' . $final)->toString(); $this->assertIdentical($result, $final, format_string('Altered outbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); $result = $this->container->get('path_processor_manager')->processOutbound($original); return $this->assertIdentical($result, $final, format_string('Altered outbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); } /** Loading @@ -99,12 +99,13 @@ protected function assertUrlOutboundAlter($original, $final) { * The original path before it has been altered by inbound URL processing. * @param $final * A string with the expected result. * * @return * TRUE if $original was correctly altered to $final, FALSE otherwise. */ protected function assertUrlInboundAlter($original, $final) { // Test inbound altering. $result = $this->container->get('path.alias_manager')->getPathByAlias($original); $this->assertIdentical($result, $final, format_string('Altered inbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); return $this->assertIdentical($result, $final, format_string('Altered inbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result))); } }
core/modules/system/src/Tests/Routing/RouterTest.php +5 −4 Changes for core/modules/system/src/Tests/Routing/RouterTest.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ use Drupal\simpletest\WebTestBase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Exception\RouteNotFoundException; use Drupal\Core\Url; /** * Functional class for the full integrated routing system. Loading Loading @@ -181,10 +182,10 @@ public function testControllerResolutionPage() { * Checks the generate method on the url generator using the front router. */ public function testUrlGeneratorFront() { global $base_path; $this->assertEqual($this->container->get('url_generator')->generate('<front>'), $base_path); $this->assertEqual($this->container->get('url_generator')->generateFromPath('<front>'), $base_path); $front_url = Url::fromRoute('<front>', [], ['absolute' => TRUE]); // Compare to the site base URL. $base_url = Url::fromUri('base:/', ['absolute' => TRUE]); $this->assertIdentical($base_url->toString(), $front_url->toString()); } /** Loading
core/modules/system/tests/modules/url_alter_test/src/PathProcessor.php +1 −3 Changes for core/modules/system/tests/modules/url_alter_test/src/PathProcessor.php: 1 added line, 3 removed lines. Original line number Diff line number Diff line Loading @@ -27,9 +27,7 @@ public function processInbound($path, Request $request) { } // Rewrite community/ to forum/. if ($path == '/community' || strpos($path, '/community/') === 0) { $path = '/forum' . substr($path, 9); } $path = preg_replace('@^/community(.*)@', '/forum$1', $path); if ($path == '/url-alter-test/bar') { $path = '/url-alter-test/foo'; Loading
core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php +2 −7 Changes for core/modules/system/tests/modules/url_alter_test/src/PathProcessorTest.php: 2 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -31,9 +31,7 @@ public function processInbound($path, Request $request) { } // Rewrite community/ to forum/. if ($path == '/community' || strpos($path, '/community/') === 0) { $path = '/forum' . substr($path, 10); } $path = preg_replace('@^/community(.*)@', '/forum$1', $path); if ($path == '/url-alter-test/bar') { $path = '/url-alter-test/foo'; Loading @@ -57,10 +55,7 @@ public function processOutbound($path, &$options = array(), Request $request = N } // Rewrite forum/ to community/. if ($path == '/forum' || strpos($path, '/forum/') === 0) { $path = '/community' . substr($path, 5); } return $path; return preg_replace('@^/forum(.*)@', '/community$1', $path); } }