Chris@0: drupalCreateUser(['administer languages', 'access administration pages', 'administer site configuration']); Chris@0: $this->drupalLogin($web_user); Chris@0: Chris@0: // Enable French language. Chris@0: $edit = []; Chris@0: $edit['predefined_langcode'] = 'fr'; Chris@0: $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); Chris@0: Chris@0: // Make French the default language. Chris@0: $edit = [ Chris@0: 'site_default_language' => 'fr', Chris@0: ]; Chris@0: $this->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration')); Chris@0: Chris@0: // Delete English. Chris@0: $this->drupalPostForm('admin/config/regional/language/delete/en', [], t('Delete')); Chris@0: Chris@0: // Changing the default language causes a container rebuild. Therefore need Chris@0: // to rebuild the container in the test environment. Chris@0: $this->rebuildContainer(); Chris@0: Chris@0: // Verify that French is the only language. Chris@0: $this->container->get('language_manager')->reset(); Chris@0: $this->assertFalse(\Drupal::languageManager()->isMultilingual(), 'Site is mono-lingual'); Chris@0: $this->assertEqual(\Drupal::languageManager()->getDefaultLanguage()->getId(), 'fr', 'French is the default language'); Chris@0: Chris@0: // Set language detection to URL. Chris@0: $edit = ['language_interface[enabled][language-url]' => TRUE]; Chris@0: $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); Chris@0: $this->drupalPlaceBlock('local_actions_block'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Verifies that links do not have language prefixes in them. Chris@0: */ Chris@0: public function testPageLinks() { Chris@0: // Navigate to 'admin/config' path. Chris@0: $this->drupalGet('admin/config'); Chris@0: Chris@0: // Verify that links in this page do not have a 'fr/' prefix. Chris@0: $this->assertNoLinkByHref('/fr/', 'Links do not contain language prefix'); Chris@0: Chris@0: // Verify that links in this page can be followed and work. Chris@0: $this->clickLink(t('Languages')); Chris@0: $this->assertResponse(200, 'Clicked link results in a valid page'); Chris@0: $this->assertText(t('Add language'), 'Page contains the add language text'); Chris@0: } Chris@0: Chris@0: }