X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fredirect%2Ftests%2Fsrc%2FKernel%2FRedirectAPITest.php;h=6d982f7c1f5da9bdb49e76de1805a03a26dbc102;hp=f57e66bc06cfe8110169a7c4864c678af9b10e44;hb=059867c3f96750652c80f39e44c442a58c2549ee;hpb=f8fc16ae6b862bef59baaad5d051dd37b7ff11b2 diff --git a/web/modules/contrib/redirect/tests/src/Kernel/RedirectAPITest.php b/web/modules/contrib/redirect/tests/src/Kernel/RedirectAPITest.php index f57e66bc0..6d982f7c1 100644 --- a/web/modules/contrib/redirect/tests/src/Kernel/RedirectAPITest.php +++ b/web/modules/contrib/redirect/tests/src/Kernel/RedirectAPITest.php @@ -125,6 +125,19 @@ class RedirectAPITest extends KernelTestBase { $this->fail('Failed to find a redirect by source path with query string.'); } + // Add a redirect to an external URL. + $external_redirect = $this->controller->create(); + $external_redirect->setSource('google'); + $external_redirect->setRedirect('https://google.com'); + $external_redirect->save(); + $found = $repository->findMatchingRedirect('google'); + if (!empty($found)) { + $this->assertEqual($found->getRedirectUrl()->toString(), 'https://google.com'); + } + else { + $this->fail('Failed to find a redirect for google.'); + } + // Hashes should be case-insensitive since the source paths are. /** @var \Drupal\redirect\Entity\Redirect $redirect */ $redirect = $this->controller->create();