public function RealnameBasicTest::testRealnameManageDisplay in Real Name 8
Same name and namespace in other branches
- 2.x tests/src/Functional/RealnameBasicTest.php \Drupal\Tests\realname\Functional\RealnameBasicTest::testRealnameManageDisplay()
Test realname display configuration.
File
- tests/
src/ Functional/ RealnameBasicTest.php, line 123
Class
- RealnameBasicTest
- Test basic functionality of Realname module.
Namespace
Drupal\Tests\realname\FunctionalCode
public function testRealnameManageDisplay() {
$assert_session = $this
->assertSession();
$edit['realname_pattern'] = '[user:account-name]';
$this
->drupalGet('admin/config/people/realname');
$this
->submitForm($edit, 'Save configuration');
$this
->drupalGet('admin/config/people/accounts/fields');
$assert_session
->titleEquals('Manage fields | Drupal');
// Assert real name field is not shown in manage fields list.
$assert_session
->pageTextNotContains('Real name');
$this
->drupalGet('admin/config/people/accounts/form-display');
$this
->assertSession()
->titleEquals('Manage form display | Drupal');
// Assert real name field is not shown in manage form display list.
$assert_session
->pageTextNotContains('Real name');
$this
->drupalGet('admin/config/people/accounts/display');
$this
->assertSession()
->titleEquals('Manage display | Drupal');
// Assert real name field is shown in manage display.
$assert_session
->pageTextContains('Real name');
// By default the realname field is not visible.
$this
->drupalGet('user/' . $this->adminUser
->id());
// Assert real name field not visible on user page.
$assert_session
->pageTextNotContains('Real name');
// Make realname field visible on user page.
$this
->drupalGet('admin/config/people/accounts/display');
$edit = [
'fields[realname][region]' => 'content',
];
$this
->submitForm($edit, 'Save');
$assert_session
->statusCodeEquals(200);
$this
->drupalGet('user/' . $this->adminUser
->id());
// Assert real name field is visible on user page.
$assert_session
->pageTextContains('Real name');
}