public function setUsername($username) { $username = preg_replace('~[^\\pL0-9_.]+~u', '-', $username); $username = trim($username, '-.'); $this->username = str_replace('-', ' ', $username); return $this; }
public function setUp() { parent::setUp('Newscoop\\Entity\\User', 'Newscoop\\Entity\\Acl\\Role'); $this->service = new DoctrineAuthService($this->em); $this->user = new User(); $this->user->setEmail(self::EMAIL); $this->user->setUsername(self::USERNAME); $this->user->setPassword(self::PASSWORD); $this->em->persist($this->user); $this->em->flush(); }