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); }
public function addUser(ObjectManager $manager) { $user = new User(); $user->setFirstname('admin'); $user->setLastname('test'); $user->setUsername('*****@*****.**'); $user->setEmail('*****@*****.**'); $user->setPlainPassword('password'); $user->setEnabled(true); $manager->persist($user); return $this; }