function its_on_registration_init(UserEvent $userEvent, User $user, UrlGeneratorInterface $router, RandomUsernameGenerator $generator)
 {
     $generator->getUsername()->shouldBeCalled()->willReturn('12345');
     $this->beConstructedWith($router, $generator);
     $user->setUsername('12345')->shouldBeCalled();
     $userEvent->getUser()->shouldBeCalled()->willReturn($user);
     $this->onRegistrationInit($userEvent);
 }
 /**
  * take action when registration is initialized
  * set the username to a unique id
  *
  * @param UserEvent $event
  */
 public function onRegistrationInit(UserEvent $event)
 {
     $user = $event->getUser();
     $user->setUsername($this->generator->getUsername());
 }