public function testShouldGetPasswordRemindersCountByToken() { // Make sure that our user will recieve confirm $database = m::mock('DatabaseManager'); $database->shouldReceive('connection')->andReturn($database)->once()->getMock()->shouldReceive('table')->with('password_reminders')->andReturn($database)->once()->getMock()->shouldReceive('where')->with('token', '=', '456456')->andReturn($database)->once()->getMock()->shouldReceive('count')->andReturn(1)->once(); $this->repo->app['db'] = $database; $this->assertEquals(1, $this->repo->getPasswordRemindersCount('456456')); }
public function testShouldGetPasswordRemindersCountByToken() { // Make sure that the password reminders table will receive a first $database = $this->repo->app['MongoLidConnector']; $database->password_reminders = $database; // The collection that should be accessed $database->shouldReceive('find')->with(array('token' => '456456'))->andReturn($database)->once()->getMock()->shouldReceive('count')->andReturn(1)->once(); $this->repo->app['MongoLidConnector'] = $database; $this->assertEquals(1, $this->repo->getPasswordRemindersCount('456456')); }
/** * Checks to see if the user has a valid token. * * @param $token * @return bool */ public function isValidToken($token) { $count = $this->repo->getPasswordRemindersCount($token); return $count != 0; }