You are here

public function LanguageNegotiationUrlTest::testDomain in Drupal 8

Same name in this branch
  1. 8 core/modules/language/tests/src/Functional/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Functional\LanguageNegotiationUrlTest::testDomain()
  2. 8 core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::testDomain()
Same name and namespace in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Functional\LanguageNegotiationUrlTest::testDomain()

@covers ::processInbound

File

core/modules/language/tests/src/Functional/LanguageNegotiationUrlTest.php, line 62

Class

LanguageNegotiationUrlTest
@coversDefaultClass \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl @group language

Namespace

Drupal\Tests\language\Functional

Code

public function testDomain() {

  // Check if paths that contain language prefixes can be reached when
  // language is taken from the domain.
  $edit = [
    'language_negotiation_url_part' => 'domain',
    'prefix[en]' => 'eng',
    'prefix[de]' => 'de',
    'domain[en]' => $_SERVER['HTTP_HOST'],
    'domain[de]' => "de.{$_SERVER['HTTP_HOST']}",
  ];
  $this
    ->drupalPostForm('admin/config/regional/language/detection/url', $edit, $this
    ->t('Save configuration'));
  $nodeValues = [
    'title[0][value]' => 'Test',
    'path[0][alias]' => '/eng/test',
  ];
  $this
    ->drupalPostForm('node/add/article', $nodeValues, $this
    ->t('Save'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}