feat: normalize email addresses to lowercase on write
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user