function SecurePagesTestCase::_testLocale in Secure Pages 6.2
Same name and namespace in other branches
- 8 securepages.test \SecurePagesTestCase::_testLocale()
- 7 securepages.test \SecurePagesTestCase::_testLocale()
Tests correct operation with locale module.
1 call to SecurePagesTestCase::_testLocale()
- SecurePagesTestCase::testSecurePages in ./
securepages.test - Runs all the test functions. These are run from a single outer function to avoid * multiple re-installs by simpletest.
File
- ./
securepages.test, line 77 - Provides SimpleTests for Secure Pages module.
Class
- SecurePagesTestCase
- @file Provides SimpleTests for Secure Pages module.
Code
function _testLocale() {
// Enable "Switch back to http pages when there are no matches".
variable_set('securepages_switch', TRUE);
// User to add and remove language.
$admin_user = $this
->drupalCreateUser(array(
'administer languages',
'access administration pages',
));
$this
->drupalLogin($admin_user);
// Add predefined language.
$edit = array(
'langcode' => 'fr',
);
$this
->drupalPost('admin/settings/language/add', $edit, t('Add language'));
$this
->assertText('fr', t('has been created and can now be used'));
// Enable URL language detection and selection.
$edit = array(
'language_negotiation' => '1',
);
$this
->drupalPost('admin/settings/language/configure', $edit, t('Save settings'));
$languages = language_list('language');
$lang = $languages['fr'];
$this
->drupalGet('user', array(
'language' => $lang,
));
$this
->assertResponse(200);
$this
->assertUrl($this
->_toHTTPS(url('user', array(
'absolute' => TRUE,
'language' => $lang,
))));
$this
->assertTrue(strstr($this->url, '/fr/'), t('URL contains language prefix.'));
$this
->drupalGet($this
->_toHTTPS(url('', array(
'absolute' => TRUE,
'language' => $lang,
))));
$this
->assertResponse(200);
$this
->assertUrl($this
->_toHTTP(url('', array(
'absolute' => TRUE,
'language' => $lang,
))));
// Clean up
variable_del('securepages_switch');
$this
->drupalLogout();
}