Example #1
0
 public function testCheckingPersistCode()
 {
     User::setHasher($hasher = m::mock('Cartalyst\\Sentry\\Hashing\\HasherInterface'));
     $user = new User();
     // Create a new hash
     $hasher->shouldReceive('hash')->with('reset_code')->andReturn('hashed_reset_code');
     $user->persist_code = 'reset_code';
     // Check the hash
     $this->assertTrue($user->checkPersistCode('hashed_reset_code'));
     $this->assertFalse($user->checkPersistCode('not_the_codeed_reset_code'));
 }