public function SocialDrupalContext::beforeUserCreateObject in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::beforeUserCreateObject()
- 10.3.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::beforeUserCreateObject()
- 10.0.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::beforeUserCreateObject()
- 10.2.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::beforeUserCreateObject()
Call this function before users are created.
@beforeUserCreate
File
- tests/
behat/ features/ bootstrap/ SocialDrupalContext.php, line 62
Class
- SocialDrupalContext
- Provides pre-built step definitions for interacting with Open Social.
Namespace
Drupal\social\BehatCode
public function beforeUserCreateObject(EntityScope $scope) {
$user = $scope
->getEntity();
// If we add a user, using the Given users:
// we can allow it not to have en email. However we use some
// contrib modules that need an email for hook_user_insert().
if (!isset($user->mail)) {
$user->mail = strtolower(trim($user->name)) . '@example.com';
}
}