public function testShouldForgotPassword() { // Make sure that the mock will have an email $confide_user = m::mock(new _mockedUser()); $confide_user->email = '*****@*****.**'; $timeStamp = new \DateTime(); // Make sure that the password reminders collection will receive an insert $database = $this->repo->app['MongoLidConnector']; $database->password_reminders = $database; // The collection that should be accessed $database->shouldReceive('insert')->andReturn(true)->once(); $this->repo->app['MongoLidConnector'] = $database; // Actually checks if the token is returned $this->assertNotNull($this->repo->forgotPassword($confide_user)); }
public function testShouldForgotPassword() { // Make sure that the mock will return the table name $confide_user = m::mock(new _mockedUser()); $confide_user->email = '*****@*****.**'; $timeStamp = new \DateTime(); // Mocks DB in order to check for the following query: // DB::table('password_reminders')->insert(array( // 'email'=> $this->email, // 'token'=> $token, // 'created_at'=> new \DateTime //)); $database = m::mock('DatabaseManager'); $database->shouldReceive('connection')->andReturn($database)->once()->getMock()->shouldReceive('table')->with('password_reminders')->andReturn($database)->once()->getMock()->shouldReceive('insert')->andReturn(true)->once(); $this->repo->app['db'] = $database; // Actually checks if the token is returned $this->assertNotNull($this->repo->forgotPassword($confide_user)); }