public function testShouldConfirm() { // Make sure that our user will recieve confirm $confide_user = m::mock(new _mockedUser()); $confide_user->shouldReceive('confirm')->andReturn(true)->once()->getMock()->shouldReceive('where')->with('confirmation_code', '=', '123123')->andReturn($confide_user)->once()->getMock()->shouldReceive('get')->andReturn($confide_user)->once()->getMock()->shouldReceive('first')->andReturn($confide_user)->once(); // This will make sure that the mocked user will be returned // when calling `model()` (that will occur inside `repo->confirm()`) $this->repo->model = $confide_user; $this->assertTrue($this->repo->confirm('123123')); }
/** * Set the user confirmation to true. * * @param string $code * @return bool */ public function confirm($code) { return $this->repo->confirm($code); }