From 78f31c9e8393a9d88dedeea7128e5264363a9638 Mon Sep 17 00:00:00 2001 From: freek Date: Tue, 9 Aug 2016 15:25:52 +0200 Subject: [PATCH] replace mock by spy --- tests/IfEmptyTest.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/IfEmptyTest.php b/tests/IfEmptyTest.php index 55a37d0..8f29d4c 100644 --- a/tests/IfEmptyTest.php +++ b/tests/IfEmptyTest.php @@ -3,30 +3,27 @@ namespace Spatie\CollectionMacros\Test; use Illuminate\Support\Collection; -use Mockery; class IfEmptyTest extends TestCase { /** @test */ public function it_executes_the_callable_if_the_collection_is_empty() { - $mock = Mockery::mock(); - $mock->shouldReceive('someCall')->once(); - - Collection::make()->ifEmpty(function () use ($mock) { - $mock->someCall(); + Collection::make()->ifEmpty(function () { + $this->spy->someCall(); }); + + $this->spy->shouldHaveReceived('someCall')->once(); } /** @test */ public function it_doesnt_execute_the_callable_if_the_collection_isnt_empty() { - $mock = Mockery::mock(); - $mock->shouldNotReceive('someCall'); - - Collection::make(['foo'])->ifEmpty(function () use ($mock) { - $mock->someCall(); + Collection::make(['foo'])->ifEmpty(function () { + $this->spy->someCall(); }); + + $this->spy->shouldNotHaveReceived('someCall'); } /** @test */