update drupal
This commit is contained in:
@@ -88,7 +88,8 @@ class UserBlocksTest extends BrowserTestBase {
|
||||
$this->assertEqual('MISS', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
|
||||
$this->drupalPostForm(NULL, $edit, t('Log in'));
|
||||
$this->assertNoText(t('User login'), 'Logged in.');
|
||||
$this->assertPattern('!<title.*?Compose tips.*?</title>!', 'Still on the same page after login for allowed page');
|
||||
// Verify that we are still on the same page after login for allowed page.
|
||||
$this->assertPattern('!<title.*?Compose tips.*?</title>!');
|
||||
|
||||
// Log out again and repeat with a non-403 page including query arguments.
|
||||
$this->drupalLogout();
|
||||
@@ -96,7 +97,8 @@ class UserBlocksTest extends BrowserTestBase {
|
||||
$this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
|
||||
$this->drupalPostForm(NULL, $edit, t('Log in'));
|
||||
$this->assertNoText(t('User login'), 'Logged in.');
|
||||
$this->assertPattern('!<title.*?Compose tips.*?</title>!', 'Still on the same page after login for allowed page');
|
||||
// Verify that we are still on the same page after login for allowed page.
|
||||
$this->assertPattern('!<title.*?Compose tips.*?</title>!');
|
||||
$this->assertStringContainsString('/filter/tips?foo=bar', $this->getUrl(), 'Correct query arguments are displayed after login');
|
||||
|
||||
// Repeat with different query arguments.
|
||||
@@ -105,7 +107,8 @@ class UserBlocksTest extends BrowserTestBase {
|
||||
$this->assertEqual('HIT', $this->drupalGetHeader(DynamicPageCacheSubscriber::HEADER));
|
||||
$this->drupalPostForm(NULL, $edit, t('Log in'));
|
||||
$this->assertNoText(t('User login'), 'Logged in.');
|
||||
$this->assertPattern('!<title.*?Compose tips.*?</title>!', 'Still on the same page after login for allowed page');
|
||||
// Verify that we are still on the same page after login for allowed page.
|
||||
$this->assertPattern('!<title.*?Compose tips.*?</title>!');
|
||||
$this->assertStringContainsString('/filter/tips?foo=baz', $this->getUrl(), 'Correct query arguments are displayed after login');
|
||||
|
||||
// Check that the user login block is not vulnerable to information
|
||||
|
||||
@@ -174,4 +174,53 @@ class UserEditTest extends BrowserTestBase {
|
||||
$this->assertSession()->statusCodeEquals(403);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a user is able to change site language.
|
||||
*/
|
||||
public function testUserChangeSiteLanguage() {
|
||||
// Install these modules here as these aren't needed for other test methods.
|
||||
\Drupal::service('module_installer')->install([
|
||||
'content_translation',
|
||||
'language',
|
||||
]);
|
||||
// Create and login as an admin user to add a new language and enable
|
||||
// translation for user accounts.
|
||||
$adminUser = $this->drupalCreateUser([
|
||||
'administer account settings',
|
||||
'administer languages',
|
||||
'administer content translation',
|
||||
'administer users',
|
||||
'translate any entity',
|
||||
]);
|
||||
$this->drupalLogin($adminUser);
|
||||
|
||||
// Add a new language into the system.
|
||||
$edit = [
|
||||
'predefined_langcode' => 'fr',
|
||||
];
|
||||
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
|
||||
$this->assertSession()->pageTextContains('French');
|
||||
|
||||
// Enable translation for user accounts.
|
||||
$edit = [
|
||||
'language[content_translation]' => 1,
|
||||
];
|
||||
$this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration');
|
||||
$this->assertSession()->pageTextContains('The configuration options have been saved.');
|
||||
|
||||
// Create a regular user for whom translation will be enabled.
|
||||
$webUser = $this->drupalCreateUser();
|
||||
|
||||
// Create a translation for a regular user account.
|
||||
$this->drupalPostForm('user/' . $webUser->id() . '/translations/add/en/fr', [], 'Save');
|
||||
$this->assertSession()->pageTextContains('The changes have been saved.');
|
||||
|
||||
// Update the site language of the user account.
|
||||
$edit = [
|
||||
'preferred_langcode' => 'fr',
|
||||
];
|
||||
$this->drupalPostForm('user/' . $webUser->id() . '/edit', $edit, 'Save');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class UserPasswordResetTest extends BrowserTestBase {
|
||||
|
||||
// Check successful login.
|
||||
$this->drupalPostForm(NULL, NULL, t('Log in'));
|
||||
$this->assertLink(t('Log out'));
|
||||
$this->assertSession()->linkExists(t('Log out'));
|
||||
$this->assertTitle($this->account->getAccountName() . ' | Drupal');
|
||||
|
||||
// Change the forgotten password.
|
||||
@@ -188,7 +188,7 @@ class UserPasswordResetTest extends BrowserTestBase {
|
||||
$this->drupalPostForm(NULL, $edit, t('Submit'));
|
||||
$reset_url = $this->getResetURL();
|
||||
$this->drupalGet($reset_url . '/login');
|
||||
$this->assertLink(t('Log out'));
|
||||
$this->assertSession()->linkExists(t('Log out'));
|
||||
$this->assertTitle($this->account->getAccountName() . ' | Drupal');
|
||||
|
||||
// Ensure blocked and deleted accounts can't access the user.reset.login
|
||||
@@ -358,7 +358,7 @@ class UserPasswordResetTest extends BrowserTestBase {
|
||||
// Use the last password reset URL which was generated.
|
||||
$reset_url = $this->getResetURL();
|
||||
$this->drupalGet($reset_url . '/login');
|
||||
$this->assertLink(t('Log out'));
|
||||
$this->assertSession()->linkExists(t('Log out'));
|
||||
$this->assertTitle($this->account->getAccountName() . ' | Drupal');
|
||||
$this->drupalLogout();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class ConvertTokensTest extends MigrateProcessTestCase {
|
||||
* Tests conversion of user tokens.
|
||||
*/
|
||||
public function testConvertTokens() {
|
||||
$value = $this->plugin->transform('Account details for !username at !site', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform('Account details for !username at !site', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertEquals('Account details for [user:name] at [site:name]', $value);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class ConvertTokensTest extends MigrateProcessTestCase {
|
||||
* Tests conversion of user tokens with a NULL value.
|
||||
*/
|
||||
public function testConvertTokensNull() {
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertEquals('', $value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user