public function generateLink() { $link = new Link(); $link->email = $this->email; $link->generateToken(); return $link->save(false) && empty($this->getErrors()) ? $link : null; }
public function testSaveLink() { $link = new Link(); $link->email = "*****@*****.**"; $link->generateToken(); $token = $link->token; $this->assertTrue($link->save()); $this->tester->seeInDatabase('links', ['email' => '*****@*****.**', 'token' => $token]); }