Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     /** @var UserManager $userManager */
     $userManager = $this->container->get('oro_user.manager');
     $role = $manager->getRepository('OroUserBundle:Role')->findOneByRole('ROLE_ADMINISTRATOR');
     $group = $manager->getRepository('OroUserBundle:Group')->findOneByName('Administrators');
     $unit = $manager->getRepository('OroOrganizationBundle:BusinessUnit')->findOneByName('Main');
     $organization = $manager->getRepository('OroOrganizationBundle:Organization')->getFirst();
     $user = new User();
     $user->setUsername('owner_User');
     $user->addGroup($group);
     $user->addRole($role);
     $user->addBusinessUnit($unit);
     $user->setFirstname('Test Owner  FirstName');
     $user->setLastname('Test Owner LastName');
     $user->setEmail('*****@*****.**');
     $user->setOwner($unit);
     $user->addGroup($group);
     $user->setPlainPassword('test password');
     $user->setSalt(md5(mt_rand(1, 222)));
     $user->setOrganization($organization);
     $userManager->updateUser($user);
     $this->setReference('owner_user', $user);
     $manager->flush();
 }
 protected function getTestUser()
 {
     $user = new User();
     $user->setId(1);
     $user->setEmail('*****@*****.**');
     $user->setSalt('1fqvkjskgry8s8cs400840c0ok8ggck');
     return $user;
 }
 /**
  * @return User
  */
 protected function createUser()
 {
     $result = new User();
     $result->setSalt('salt');
     return $result;
 }