feat: normalize email addresses to lowercase on write

This commit is contained in:
2026-09-21 12:20:55 +02:00
parent d6327f033e
commit af46c57bd1
7 changed files with 102 additions and 4 deletions
+31
View File
@@ -200,6 +200,37 @@ class UserDataHandlerTest extends TestCase
$this->assertSame(['team' => ['selected' => true]], $teamer->getCrmSelections());
}
/**
* BusPro compares addresses case-insensitively and MyE&P lowercases them on login, so a
* mixed-case address coming back from the API must land lowercased on both the user and
* the teamer - otherwise the login identity and the mailing address drift apart.
*/
public function testUpdateLocalUserNormalizesTheAddressBusProReports(): void
{
$user = (new User())
->setFirstName('Old')
->setLastName('Name')
->setEmail('[email protected]')
->setBusProAddressId(1)
->setBusProPersonId(2)
;
$teamer = (new Teamer())
->setCommunication((new Communication())->setEmail('[email protected]'))
;
$user->setTeamer($teamer);
$profileResponse = $this->createProfileResponse()
->setCommunication((new BusProCommunication())->setEmail('[email protected]'))
;
$handler = new UserDataHandler($this->entityManager, $this->logger);
$handler->updateLocalUser($user, $profileResponse, true, [], ['ROLE_TEAMER'], []);
$this->assertSame('[email protected]', $user->getEmail());
$this->assertSame('[email protected]', $teamer->getCommunication()?->getEmail());
}
/**
* @dataProvider pendingRolesProvider
*/