Commit ed1acafc authored by Liam Morland's avatar Liam Morland
Browse files

Merge branch 'feature/ISTWCMS-4513-l26yan-Add-and-configure-realname-module' into '8.x-3.x'

ISTWCMS-4513 Add realname test function

See merge request !65
parents 75987e28 b539ccdd
......@@ -82,6 +82,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->ctaBlockTest();
$this->permissionsTest();
$this->realnameTest();
}
/**
......@@ -997,4 +999,42 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);
}
/**
* Tests Real name module.
*
* Create a new user.
* The user displays the first name and last name.
*/
private function realnameTest() {
$this->drupalLogin($this->drupalUsers['administrator']);
// Check admin/config/people/realname page.
$this->drupalGet('admin/config/people/realname');
$this->assertSession()->statusCodeEquals(200);
// The pattern is [user:field_uw_first_name] [user:field_uw_last_name].
$this->getSession()->getPage()->findById('edit-realname-pattern')->getValue('[user:field_uw_first_name] [user:field_uw_last_name]');
// Add a new user.
$this->drupalGet('admin/people/create');
$this->assertSession()->statusCodeEquals(200);
$fname = $this->randomString();
$lname = $this->randomString();
$pass = $this->randomString();
$edit = [
'edit-field-uw-first-name-0-value' => $fname,
'edit-field-uw-last-name-0-value' => $lname,
'edit-mail' => 'wcmstest@uwaterloo.ca',
'edit-name' => 'wcmstest',
'edit-pass-pass1' => $pass,
'edit-pass-pass2' => $pass,
];
$this->drupalPostForm('admin/people/create', $edit, 'Create new account');
// The first name and last name are displayed in people page.
$this->drupalGet('admin/people');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains($fname . ' ' . $lname);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment