protected function SimplenewsTestBase::registerUser in Simplenews 8.2
Same name and namespace in other branches
- 3.x tests/src/Functional/SimplenewsTestBase.php \Drupal\Tests\simplenews\Functional\SimplenewsTestBase::registerUser()
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 tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Blocked account subscribes, display message.
- SimplenewsPersonalizationFormsTest::testDeleteAccount in tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Delete account, subscriptions deleted.
- SimplenewsPersonalizationFormsTest::testDisableAccount in tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Disable account, subscriptions inactive.
- SimplenewsPersonalizationFormsTest::testSynchronizeRegisterSubscribe in tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Register then subscribe: require login, fields updated.
- SimplenewsPersonalizationFormsTest::testSynchronizeSubscribeRegister in tests/
src/ Functional/ SimplenewsPersonalizationFormsTest.php - Subscribe then register: fields updated, subscription remains unconfirmed.
File
- tests/
src/ Functional/ SimplenewsTestBase.php, line 222
Class
- SimplenewsTestBase
- Base class for simplenews web tests.
Namespace
Drupal\Tests\simplenews\FunctionalCode
protected function registerUser($email = NULL, array $edit = []) {
$edit += [
'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);
}