LanguagePathMonolingualTest.php in Zircon Profile 8
File
core/modules/language/src/Tests/LanguagePathMonolingualTest.php
View source
<?php
namespace Drupal\language\Tests;
use Drupal\simpletest\WebTestBase;
class LanguagePathMonolingualTest extends WebTestBase {
public static $modules = [
'block',
'language',
'path',
];
protected function setUp() {
parent::setUp();
$web_user = $this
->drupalCreateUser(array(
'administer languages',
'access administration pages',
'administer site configuration',
));
$this
->drupalLogin($web_user);
$edit = array();
$edit['predefined_langcode'] = 'fr';
$this
->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
$edit = array(
'site_default_language' => 'fr',
);
$this
->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration'));
$this
->drupalPostForm('admin/config/regional/language/delete/en', array(), t('Delete'));
$this
->rebuildContainer();
$this->container
->get('language_manager')
->reset();
$this
->assertFalse(\Drupal::languageManager()
->isMultilingual(), 'Site is mono-lingual');
$this
->assertEqual(\Drupal::languageManager()
->getDefaultLanguage()
->getId(), 'fr', 'French is the default language');
$edit = array(
'language_interface[enabled][language-url]' => TRUE,
);
$this
->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
$this
->drupalPlaceBlock('local_actions_block');
}
function testPageLinks() {
$this
->drupalGet('admin/config');
$this
->assertNoLinkByHref('/fr/', 'Links do not contain language prefix');
$this
->clickLink(t('Languages'));
$this
->assertResponse(200, 'Clicked link results in a valid page');
$this
->assertText(t('Add language'), 'Page contains the add language text');
}
}