function LanguageNegotiationUrlTest::testDomain

Same name in this branch
  1. 11.x 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/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::testDomain()
  2. 9 core/modules/language/tests/src/Functional/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Functional\LanguageNegotiationUrlTest::testDomain()
  3. 8.9.x core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::testDomain()
  4. 8.9.x core/modules/language/tests/src/Functional/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Functional\LanguageNegotiationUrlTest::testDomain()
  5. 10 core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::testDomain()
  6. 10 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 <a href="/api/drupal/core%21modules%21language%21src%21Plugin%21LanguageNegotiation%21LanguageNegotiationUrl.php/class/LanguageNegotiationUrl/11.x" title="Class for identifying language via URL prefix or domain." class="local">\Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl</a> @group language

Namespace

Drupal\Tests\language\Functional

Code

public function testDomain() : void {
    // 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->drupalGet('admin/config/regional/language/detection/url');
    $this->submitForm($edit, 'Save configuration');
    $nodeValues = [
        'title[0][value]' => 'Test',
        'path[0][alias]' => '/eng/test',
    ];
    $this->drupalGet('node/add/article');
    $this->submitForm($nodeValues, 'Save');
    $this->assertSession()
        ->statusCodeEquals(200);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.