/** * {@inheritdoc} */ public function load(ObjectManager $manager) { $userAdmin = new User(); $userAdmin->setName('Big boss'); $userAdmin->setEmail('*****@*****.**'); $userAdmin->setUsername('admin'); $userAdmin->setPlainPassword('mypassword'); $userAdmin->setEnabled(true); $userAdmin->addRole('ROLE_SUPER_ADMIN'); $manager->persist($userAdmin); $this->addReference('admin-user', $userAdmin); $bobUser = new User(); $bobUser->setName('Bobby'); $bobUser->setEmail('*****@*****.**'); $bobUser->setUsername('bob'); $bobUser->setPlainPassword('mypassword'); $bobUser->setEnabled(true); $manager->persist($bobUser); $this->addReference('bob-user', $bobUser); $emptyUser = new User(); $emptyUser->setName('Empty'); $emptyUser->setEmail('*****@*****.**'); $emptyUser->setUsername('empty'); $emptyUser->setPlainPassword('mypassword'); $emptyUser->setEnabled(true); $manager->persist($emptyUser); $this->addReference('empty-user', $emptyUser); $manager->flush(); }
public function testSendEmail() { $user = new User(); $user->setTwoFactorAuthentication(true); $user->setEmailAuthCode(666666); $user->setEmail('*****@*****.**'); $user->setName('Bob'); $authCodeMailer = new AuthCodeMailer($this->mailer, $this->twig, '*****@*****.**', 'wallabag test', $this->config); $authCodeMailer->sendAuthCode($user); $this->assertCount(1, $this->spool); $msg = $this->spool->getMessages()[0]; $this->assertArrayHasKey('*****@*****.**', $msg->getTo()); $this->assertEquals(['*****@*****.**' => 'wallabag test'], $msg->getFrom()); $this->assertEquals('subject', $msg->getSubject()); $this->assertContains('text body http://0.0.0.0/support', $msg->toString()); $this->assertContains('html body 666666', $msg->toString()); }