[TESTS][DataFixtures] Add password and email to created test user

This commit is contained in:
Hugo Sales 2021-07-28 21:25:07 +00:00
parent 14db5d9864
commit 988d384654
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -18,10 +18,11 @@ class CoreFixtures extends Fixture
{
$actors = [];
$local_entities = [];
foreach ([LocalUser::class => ['taken_user', 'setId'], LocalGroup::class => ['taken_group', 'setGroupId']] as $entity => [$nick, $method]) {
foreach ([LocalUser::class => ['taken_user', 'setId', ['password' => LocalUser::hashPassword('foobar'), 'outgoing_email' => 'email@provider']], LocalGroup::class => ['taken_group', 'setGroupId', []]]
as $entity => [$nick, $method, $extra_create]) {
$actor = GSActor::create(['nickname' => $nick, 'normalized_nickname' => Nickname::normalize($nick, check_already_used: false)]);
$manager->persist($actor);
$ent = $entity::create(['nickname' => $nick]);
$ent = $entity::create(array_merge(['nickname' => $nick], $extra_create)); // cannot use array spread for arrays with string keys
$ent->{$method}($actor->getId());
$local_entities[$nick] = $ent;
$manager->persist($ent);