public function testActivate() { $this->user->activate(); $this->assertEquals('*****@*****.**', $this->user->getEmail()); $this->assertEquals('john', $this->user->getUsername()); $this->assertEquals('John', $this->user->getName()); $this->assertEquals('Smith', $this->user->getSurname()); $this->assertNotEmpty($this->user->getPassword()); $this->assertEmpty($this->user->getCode()); $this->assertFalse($this->user->isFrozen()); $this->assertInstanceOf(DateTime::class, $this->user->getCreatedAt()); $this->assertInstanceOf(ReadOnlyCollectionWrapper::class, $this->user->getRoles()); }
public function notifyNewPassword(User $u) { $subjKey = "systemModule.notification.newPassword.subject"; $bodyKey = "systemModule.notification.newPassword.body"; $subject = $this->translator->translate($subjKey, null, ["host" => $this->getHostName()]); $body = $this->translator->translate($bodyKey, null, ["name" => $u->getName(), "surname" => $u->getSurname(), "pass" => $u->provideRawPassword()]); $mail = new Message(); $mail->setFrom($this->getSenderEmail())->setSubject($subject)->setBody($body)->addTo($u->getContact()->getEmail()); $this->send($mail); }