Skip to content

Commit

Permalink
Improves testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Apr 13, 2021
1 parent 15bea14 commit a1fc2aa
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/Validation/ValidationNotPwnedVerifierTest.php
Expand Up @@ -39,16 +39,20 @@ public function testApiResponseGoesWrong()

$httpFactory
->shouldReceive('withHeaders')
->once()
->with(['Add-Padding' => true])
->andThrow($httpFactory);
->andReturn($httpFactory);

$httpFactory->shouldReceive('get')
->once()
->andReturn($response);

$response->shouldReceive('successful')
->once()
->andReturn(true);

$response->shouldReceive('body')
->once()
->andReturn('');

$verifier = new NotPwnedVerifier($httpFactory);
Expand All @@ -63,13 +67,16 @@ public function testApiGoesDown()

$httpFactory
->shouldReceive('withHeaders')
->once()
->with(['Add-Padding' => true])
->andThrow($httpFactory);
->andReturn($httpFactory);

$httpFactory->shouldReceive('get')
->once()
->andReturn($response);

$response->shouldReceive('successful')
->once()
->andReturn(false);

$verifier = new NotPwnedVerifier($httpFactory);
Expand All @@ -92,11 +99,13 @@ public function testDnsDown()

$httpFactory
->shouldReceive('withHeaders')
->once()
->with(['Add-Padding' => true])
->andThrow($httpFactory);
->andReturn($httpFactory);

$httpFactory
->shouldReceive('get')
->once()
->andThrow($exception);

$verifier = new NotPwnedVerifier($httpFactory);
Expand Down

0 comments on commit a1fc2aa

Please sign in to comment.