diff --git a/core/tests/Drupal/Tests/Component/Utility/UrlTest.php b/core/tests/Drupal/Tests/Component/Utility/UrlTest.php index de62324..20fd9d9 100644 --- a/core/tests/Drupal/Tests/Component/Utility/UrlTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/UrlTest.php @@ -315,6 +315,29 @@ public static function providerTestIsExternal() { } /** + * Tests if external path matches local path. + * + * @see \Drupal\Component\Utility\Url::externalIsLocal() + * + * @dataProvider providerTestExternalIsLocal + */ + public function testExternalIsLocal($url, $base_url, $expected) { + $isLocal = Url::externalIsLocal($url, $base_url); + $this->assertEquals($expected, $isLocal); + } + + /** + * Provides data for self::testExternalIsLocal(). + */ + public static function providerTestExternalIsLocal() { + return array( + array('http://example.com/internal/path', 'http://example.com/', TRUE), + array('http://example.org/external/path', 'http://example.com/', FALSE), + array('http://example.org', 'http://example.com/', FALSE), + ); + } + + /** * Tests bad protocol filtering and escaping. * * @dataProvider providerTestFilterBadProtocol