public function AdminUserTest::testMultipleEmailsAdminUser in Multiple E-mail Addresses 2.x
Test that the Multiple E-mails user can add a new e-mail address.
File
- src/
Tests/ AdminUserTest.php, line 39 - Definition of Drupal\multiple_email\Tests\AdminUserTest.
Class
- AdminUserTest
- Test admin user interactions with the module.
Namespace
Drupal\multiple_email\TestsCode
public function testMultipleEmailsAdminUser() {
// Test settings page is accessable
$this
->drupalGet('admin/config/people/multiple-email');
$this
->assertText(t('Multiple E-mails'));
$this
->drupalPostForm('admin/config/people/multiple-email', array(), t('Save configuration'));
$this
->assertText(t('The configuration options have been saved.'));
// Test management of other users' multiple emails
$this
->drupalGet('user/' . $this->basicuser
->id() . '/edit/email-addresses');
$email = multiple_email_find_address($this->basicuser
->getEmail());
// Check for access denied on the edit form
$this
->drupalGet('user/' . $this->basicuser
->id() . '/edit/email-addresses/edit/' . $email->eid);
$this
->assertText(t('Access denied'), t('No access to edit form.'));
// Submit the basicuser edit form
$this
->drupalPostForm('user/' . $this->basicuser
->id() . '/edit', array(), t('Save'));
$this
->assertText(t('The changes have been saved.'));
// Submit the basicuser edit form with a new e-mail address
$new_email = $this
->randomMachineName() . '@example.com';
$edit = array(
'mail' => $new_email,
);
$this
->drupalPostForm('user/' . $this->basicuser
->id() . '/edit', $edit, t('Save'));
$this
->assertRaw(t('The changes have been saved.'));
}