public function testShouldChangePassword()
 {
     // Make sure that the mock will return the table name
     $confide_user = m::mock(new _mockedUser());
     $confide_user->shouldReceive('getTable')->andReturn('users')->once()->getMock()->shouldReceive('getKey')->andReturn('3')->once()->getMock()->shouldReceive('getKeyName')->andReturn('id')->once();
     // Mocks DB in order to check for the following query:
     //     DB::table('users')->where('id',3)->update(array('password'=>'lol'));
     $database = m::mock('DatabaseManager');
     $database->shouldReceive('connection')->andReturn($database)->once()->getMock()->shouldReceive('table')->with('users')->andReturn($database)->once()->getMock()->shouldReceive('where')->with('id', '3')->andReturn($database)->once()->getMock()->shouldReceive('update')->with(array('password' => 'secret'))->andReturn(0)->once();
     $this->repo->app['db'] = $database;
     // Actually change the user password
     $this->assertTrue($this->repo->changePassword($confide_user, 'secret'));
 }
 public function testShouldChangePassword()
 {
     // Make sure that the mock will have an _id
     $confide_user = m::mock(new _mockedUser());
     $confide_user->_id = '123123';
     // Make sure that the password reminders collection will receive a update
     $database = $this->repo->app['MongoLidConnector'];
     $database->users = $database;
     // The collection that should be accessed
     $database->shouldReceive('update')->with(array('_id' => '123123'), array('$set' => array('password' => 'secret')))->andReturn(true)->once();
     $this->repo->app['MongoLidConnector'] = $database;
     // Actually change the user password
     $this->assertTrue($this->repo->changePassword($confide_user, 'secret'));
 }