public function setUp() { parent::setUp('Newscoop\\Entity\\UserToken', 'Newscoop\\Entity\\Acl\\Role', 'Newscoop\\Entity\\User'); $this->service = new UserTokenService($this->em); $this->user = new User('test'); $this->user->setEmail('petr@localhost'); $this->em->persist($this->user); $this->em->flush(); }
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(); }
public function setUp() { parent::setUp('Newscoop\\Entity\\User', 'Newscoop\\Entity\\Acl\\Role', 'Newscoop\\Entity\\UserAttribute'); $this->auth = $this->getMockBuilder('Zend_Auth')->disableOriginalConstructor()->getMock(); $this->repository = $this->em->getRepository('Newscoop\\Entity\\User'); $this->service = new UserService($this->em, $this->auth); $this->user = new User(); $this->user->setEmail('*****@*****.**'); $this->user->setUsername('test'); $this->user->setFirstName('Foo'); $this->user->setLastName('Bar'); }
public function setUp() { global $application; parent::setUp('Newscoop\\Entity\\User', 'Newscoop\\Entity\\Acl\\Role', 'Newscoop\\Entity\\UserToken'); $this->service = new \Newscoop\Services\EmailService(\Zend_Registry::get('container')->getParameter('email'), \Zend_Registry::get('view'), \Zend_Registry::get('container')->getService('user.token')); \Zend_Mail::setDefaultTransport(new \Zend_Mail_Transport_File(array('path' => '/tmp', 'callback' => function ($transport) { return uniqid('mail', true); }))); $this->user = new User(); $this->user->setEmail(self::USER_EMAIL); $this->em->persist($this->user); $this->em->flush(); }
public function testFindWithLimit() { for ($i = 0; $i < 50; $i++) { $user = new User(); $user->setEmail(uniqid("email_{$i}", true)); $user->setUsername(uniqid("username_{$i}", true)); $this->em->persist($user); } $this->em->flush(); $this->assertEquals(25, count($this->service->find('email_'))); }
public function testSave() { $user = new User(); $user->setUsername('testname'); $user->setEmail('email'); $this->em->persist($user); $this->em->flush(); $event = new CommunityTickerEvent(); $this->repository->save($event, array('event' => 'test.event', 'user' => 1, 'params' => array('param1' => 'value1'))); $this->em->flush(); $this->em->clear(); $this->assertEquals(1, $event->getId()); $this->assertEquals('test.event', $event->getEvent()); $this->assertEquals($user, $event->getUser()); $this->assertEquals(array('param1' => 'value1'), $event->getParams()); }
public function setEmail($email) { $this->__load(); return parent::setEmail($email); }
public function testGenerateUsername() { $user = new User(); $user->setEmail('*****@*****.**'); $user->setUsername('Foo Bar'); $this->em->persist($user); $this->em->flush(); $this->assertEquals('Foos Bar', $this->service->generateUsername('Foos', 'Bar')); $this->assertEquals('Foo Bar1', $this->service->generateUsername('Foo', 'Bar')); $this->assertEquals('', $this->service->generateUsername(' ', ' ')); $this->assertEquals('Foo', $this->service->generateUsername('Foo', '')); $this->assertEquals('Bar', $this->service->generateUsername('', 'Bar')); $this->assertEquals('', $this->service->generateUsername('!@#$%^&*()+-={}[]\\|;\':"§-?/.>,<', '')); $this->assertEquals('_', $this->service->generateUsername('_', '')); $this->assertEquals('Foo Bar Jr', $this->service->generateUsername('Foo Bar ', ' Jr ')); }