diff --git a/CHANGELOG.md b/CHANGELOG.md index 2908b33..2989ce5 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,19 +2,6 @@ All Notable changes to `laravel-collection-macros` will be documented in this file -## NEXT - YYYY-MM-DD +## 1.0.0 - 2016-08-09 -### Added -- Nothing - -### Deprecated -- Nothing - -### Fixed -- Nothing - -### Removed -- Nothing - -### Security -- Nothing +- initial release diff --git a/tests/IfAnyTest.php b/tests/IfAnyTest.php index f33c960..db58546 100644 --- a/tests/IfAnyTest.php +++ b/tests/IfAnyTest.php @@ -3,30 +3,27 @@ namespace Spatie\CollectionMacros\Test; use Illuminate\Support\Collection; -use Mockery; class IfAnyTest extends TestCase { /** @test */ public function it_executes_the_callable_if_the_collection_isnt_empty() { - $mock = Mockery::mock(); - $mock->shouldReceive('someCall')->once(); - - Collection::make(['foo'])->ifAny(function () use ($mock) { - $mock->someCall(); + Collection::make(['foo'])->ifAny(function () { + $this->spy->someCall(); }); + + $this->spy->shouldHaveReceived('someCall')->once(); } /** @test */ public function it_doesnt_execute_the_callable_if_the_collection_is_empty() { - $mock = Mockery::mock(); - $mock->shouldNotReceive('someCall'); - - Collection::make()->ifAny(function () use ($mock) { - $mock->someCall(); + Collection::make()->ifAny(function () { + $this->spy->someCall(); }); + + $this->spy->shouldNotHaveReceived('someCall'); } /** @test */ diff --git a/tests/TestCase.php b/tests/TestCase.php index 0afa041..be40174 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,6 +5,9 @@ use Mockery; use Orchestra\Testbench\TestCase as BaseTestCase; +/** + * @property \Mockery\MockInterface spy + */ abstract class TestCase extends BaseTestCase { public function setUp() @@ -12,6 +15,8 @@ public function setUp() parent::setUp(); require_once __DIR__.'/../src/macros.php'; + + $this->spy = Mockery::spy(); } public function tearDown()