You are here

public function RedirectAPITest::testDuplicateRedirectEntry in Redirect 8

Test slash is removed from source path in findMatchingRedirect.

File

tests/src/Kernel/RedirectAPITest.php, line 168

Class

RedirectAPITest
Redirect entity and redirect API test coverage.

Namespace

Drupal\Tests\redirect\Kernel

Code

public function testDuplicateRedirectEntry() {
  $redirect = $this->storage
    ->create();
  $redirect
    ->setSource('/foo/foo', []);
  $redirect
    ->setRedirect('foo');
  $redirect
    ->save();
  $redirect_repository = \Drupal::service('redirect.repository');
  $matched_redirect = $redirect_repository
    ->findMatchingRedirect('/foo/foo', [], 'en-AU');
  $this
    ->assertNotNull($matched_redirect);
  $null_redirect = $redirect_repository
    ->findMatchingRedirect('/foo/foo-bar', [], 'en-AU');
  $this
    ->assertNull($null_redirect);
}