Skip to content

Commit

Permalink
use mock to count correctly assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Perone committed Apr 18, 2017
1 parent 35586bd commit 38fa4b1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/Effect/Http/EmitResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,26 @@ final class EmitResponseTest extends TestCase
{
public function testEmitsResponseCorrectly()
{
$emitter = \Mockery::spy(EmitterInterface::class);
// we will be able to use spies with correct assertion count
// from the next mockery version
$emitter = \Mockery::mock(EmitterInterface::class);

$emitResponse = new EmitResponse($emitter);
$response = new Response();

$emitter->shouldReceive('emit')->with($response);

$emitResponse($response);
}

protected function assertPostConditions()
{
$container = \Mockery::getContainer();
if ($container != null) {
$count = $container->mockery_getExpectationCount();
$this->addToAssertionCount($count);
}

$emitter->shouldHaveReceived('emit')->with($response);
\Mockery::close();
}
}

0 comments on commit 38fa4b1

Please sign in to comment.