You are here

public function RedirectUILanguageTest::testUndefinedLangugageRedirects in Redirect 8

Test non-language specific redirect.

File

tests/src/Functional/RedirectUILanguageTest.php, line 78

Class

RedirectUILanguageTest
UI tests for redirect module with language and content translation modules.

Namespace

Drupal\Tests\redirect\Functional

Code

public function testUndefinedLangugageRedirects() {
  $this
    ->drupalLogin($this->adminUser);

  // Add a redirect for english.
  $this
    ->drupalPostForm('admin/config/search/redirect/add', [
    'redirect_source[0][path]' => 'langpath',
    'redirect_redirect[0][uri]' => '/user',
    'language[0][value]' => 'und',
  ], t('Save'));

  // Check redirect for english.
  $this
    ->assertRedirect('langpath', '/user', 301);

  // Check redirect for spanish.
  $this
    ->assertRedirect('es/langpath', '/es/user', 301);
}