container = $container; } public function load(ObjectManager $manager) { $manager->persist($this->getTestUser()); $manager->flush(); } protected function getTestUser(): UserInterface { /** * @var UserManager */ $userManager = $this->container->get('fos_user.user_manager'); /** * @var User */ $testUser = $userManager->createUser(); $testUser->setEmail('test@test.de'); $testUser->setUsername('test'); $testUser->setPlainPassword('test'); $testUser->setEnabled(true); $userManager->updateUser($testUser); return $testUser; } }