public function UserRegisterNotifyBasicTest::testUserRegisterNotifyAdminForm in User registration notification 7
Tests if admin form works properly.
File
- ./
user_register_notify.test, line 69 - Test file for User Registration Notification module.
Class
- UserRegisterNotifyBasicTest
- Test basic functionality of User Registration Notification module.
Code
public function testUserRegisterNotifyAdminForm() {
// Test e-mail validation.
$edit = array();
$edit['user_register_notify_type'] = 'custom';
$edit['user_register_notify_mail_to'] = 'foo@example.com';
$this
->drupalPost('admin/config/people/user-register-notify', $edit, t('Save configuration'));
$this
->assertRaw('foo@example.com', '[testUserRegisterNotifyAdminForm]: Saved one e-mail.');
// This assert requires entity.module or [user:status] token is not
// available and therefore cause a form validation error.
$edit['user_register_notify_mail_to'] = 'foo@example.com, bar@example.net';
$this
->drupalPost('admin/config/people/user-register-notify', $edit, t('Save configuration'));
$this
->assertRaw('foo@example.com,bar@example.net', '[testUserRegisterNotifyAdminForm]: Spaces removed from e-mail string.');
$edit['user_register_notify_mail_to'] = 'foo@example.com,bar@example.net,#invalid.org';
$this
->drupalPost('admin/config/people/user-register-notify', $edit, t('Save configuration'));
$this
->assertRaw(t('The e-mail address %mail is not valid.', array(
'%mail' => '#invalid.org',
)), '[testUserRegisterNotifyAdminForm]: Invalid e-mail address found.');
$edit['user_register_notify_mail_to'] = 'foo@example.com,bar@example.net';
$edit['user_register_notify_mail_from'] = 'foo@example.org';
$edit['user_register_notify_mail_replyto'] = 'bar@example.org';
$this
->drupalPost('admin/config/people/user-register-notify', $edit, t('Save configuration'));
$this
->assertRaw('foo@example.com,bar@example.net', '[testUserRegisterNotifyAdminForm]: Notification e-mail addresses configured.');
$this
->assertRaw('foo@example.org', '[testUserRegisterNotifyAdminForm]: From e-mail addresses configured.');
$this
->assertRaw('bar@example.org', '[testUserRegisterNotifyAdminForm]: Reply-to e-mail addresses configured.');
$edit['user_register_notify_mail_to'] = 'foo@example.com,bar@example.net';
$edit['user_register_notify_mail_from'] = 'foo@example.org,bar@example.net';
$edit['user_register_notify_mail_replyto'] = 'foo@example.com,bar@example.org';
$this
->drupalPost('admin/config/people/user-register-notify', $edit, t('Save configuration'));
$this
->assertRaw('foo@example.com,bar@example.net', '[testUserRegisterNotifyAdminForm]: Notification e-mail addresses configured.');
$this
->assertRaw(t('The e-mail address %mail is not valid.', array(
'%mail' => 'foo@example.org,bar@example.net',
)), '[testUserRegisterNotifyAdminForm]: From e-mail address validation works.');
$this
->assertRaw(t('The e-mail address %mail is not valid.', array(
'%mail' => 'foo@example.com,bar@example.org',
)), '[testUserRegisterNotifyAdminForm]: Reply-to e-mail address validation works.');
}