3 namespace Drupal\Tests\language\Functional;
5 use Drupal\Core\StringTranslation\StringTranslationTrait;
6 use Drupal\Tests\BrowserTestBase;
9 * @coversDefaultClass \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl
12 class LanguageNegotiationUrlTest extends BrowserTestBase {
14 use StringTranslationTrait;
19 public static $modules = [
26 * @var \Drupal\user\Entity\User
33 protected function setUp() {
36 // Create an Article node type.
37 if ($this->profile != 'standard') {
38 $this->drupalCreateContentType(['type' => 'article']);
41 $this->user = $this->drupalCreateUser([
42 'administer languages',
43 'access administration pages',
44 'view the administration theme',
46 'create article content',
49 $this->drupalLogin($this->user);
51 $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'de'], $this->t('Add language'));
55 * @covers ::processInbound
57 public function testDomain() {
58 // Check if paths that contain language prefixes can be reached when
59 // language is taken from the domain.
61 'language_negotiation_url_part' => 'domain',
62 'prefix[en]' => 'eng',
64 'domain[en]' => $_SERVER['HTTP_HOST'],
65 'domain[de]' => "de.$_SERVER[HTTP_HOST]",
67 $this->drupalPostForm('admin/config/regional/language/detection/url', $edit, $this->t('Save configuration'));
70 'title[0][value]' => 'Test',
71 'path[0][alias]' => '/eng/test',
73 $this->drupalPostForm('node/add/article', $nodeValues, $this->t('Save and publish'));
74 $this->assertSession()->statusCodeEquals(200);