protected function SimplenewsTestBase::registerUser in Simplenews 8
Visits and submits the user registration form.
Parameters
string $email: (optional) The email of the new user. Defaults to a random email.
array $edit: (optional) Additional form field values, keyed by form field names.
Return value
int Uid of the new user.
5 calls to SimplenewsTestBase::registerUser()
- SimplenewsPersonalizationFormsTest::testBlockedSubscribe in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Blocked account subscribes, display message.
- SimplenewsPersonalizationFormsTest::testDeleteAccount in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Delete account, subscriptions deleted.
- SimplenewsPersonalizationFormsTest::testDisableAccount in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Disable account, subscriptions inactive.
- SimplenewsPersonalizationFormsTest::testSynchronizeRegisterSubscribe in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Register then subscribe: require login, fields updated.
- SimplenewsPersonalizationFormsTest::testSynchronizeSubscribeRegister in src/
Tests/ SimplenewsPersonalizationFormsTest.php - Subscribe then register: fields updated, subscription remains unconfirmed.
File
- src/
Tests/ SimplenewsTestBase.php, line 211 - Simplenews test functions.
Class
- SimplenewsTestBase
- Base class for simplenews web tests.
Namespace
Drupal\simplenews\TestsCode
protected function registerUser($email = NULL, array $edit = array()) {
$edit += array(
'mail' => $email ?: $this
->randomEmail(),
'name' => $this
->randomMachineName(),
);
$this
->drupalPostForm('user/register', $edit, t('Create new account'));
// Return uid of new user.
$uids = \Drupal::entityQuery('user')
->sort('created', 'DESC')
->range(0, 1)
->execute();
return array_shift($uids);
}