Skip to content

Commit

Permalink
AuthPasswordBrokerTest without changing old tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chmv committed Oct 21, 2019
1 parent 5111a18 commit c4c5f4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/Auth/AuthPasswordBrokerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function testIfUserIsNotFoundErrorRedirectIsReturned()
public function testIfTokenIsRecentlyCreated()
{
$mocks = $this->getMocks();
$mocks['tokens'] = m::mock(TestTokenRepositoryInterface::class);
$broker = $this->getMockBuilder(PasswordBroker::class)->setMethods(['emailResetLink', 'getUri'])->setConstructorArgs(array_values($mocks))->getMock();
$mocks['users']->shouldReceive('retrieveByCredentials')->once()->with(['foo'])->andReturn($user = m::mock(CanResetPassword::class));
$mocks['tokens']->shouldReceive('recentlyCreated')->once()->with($user)->andReturn(true);
Expand Down Expand Up @@ -64,7 +65,6 @@ public function testBrokerCreatesTokenAndRedirectsWithoutError()
$mocks = $this->getMocks();
$broker = $this->getMockBuilder(PasswordBroker::class)->setMethods(['emailResetLink', 'getUri'])->setConstructorArgs(array_values($mocks))->getMock();
$mocks['users']->shouldReceive('retrieveByCredentials')->once()->with(['foo'])->andReturn($user = m::mock(CanResetPassword::class));
$mocks['tokens']->shouldReceive('recentlyCreated')->once()->with($user)->andReturn(false);
$mocks['tokens']->shouldReceive('create')->once()->with($user)->andReturn('token');
$user->shouldReceive('sendPasswordResetNotification')->with('token');

Expand Down Expand Up @@ -117,7 +117,7 @@ protected function getBroker($mocks)
protected function getMocks()
{
return [
'tokens' => m::mock(TestTokenRepositoryInterface::class),
'tokens' => m::mock(TokenRepositoryInterface::class),
'users' => m::mock(UserProvider::class),
'mailer' => m::mock(Mailer::class),
'view' => 'resetLinkView',
Expand Down

0 comments on commit c4c5f4a

Please sign in to comment.