also looking at this
Collection Response
#5
7 files
+42
-51
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | use Illuminate\Support\Collection; | |
| 3 | 4 | use Meema\LaravelMeema\Facades\Favorite; |
| 4 | 5 | use Meema\LaravelMeema\Tests\LaravelMeemaTestCase; |
| 5 | 6 | |
| @@ -13,8 +14,8 @@ beforeEach(function () { | ||
| 13 | 14 | it('can fetch all favorites', function () { |
| 14 | 15 | $favorites = Favorite::get(); |
| 15 | 16 | |
| 16 | $this->assertTrue(is_array($favorites)); | |
| 17 | $this->assertTrue(count($favorites) > 0); | |
| 17 | $this->assertTrue($favorites instanceof Collection); | |
| 18 | $this->assertTrue($favorites->count() > 0); | |
| 18 | 19 | }); |
| 19 | 20 | |
| 20 | 21 | it('can fetch specific group of favorites', function () { |
| @@ -22,8 +23,8 @@ it('can fetch specific group of favorites', function () { | ||
| 22 | 23 | |
| 23 | 24 | $favorites = Favorite::get($ids); |
| 24 | 25 | |
| 25 | $this->assertTrue(is_array($favorites)); | |
| 26 | $this->assertTrue(count($favorites) === count($ids)); | |
| 26 | $this->assertTrue($favorites instanceof Collection); | |
| 27 | $this->assertTrue($favorites->count() === count($ids)); | |
| 27 | 28 | }); |
| 28 | 29 | |
| 29 | 30 | it('can find a single favorite', function () { |
| @@ -54,7 +55,7 @@ it('can update a favorite', function () { | ||
| 54 | 55 | }); |
| 55 | 56 | |
| 56 | 57 | it('can delete a favorite', function () { |
| 57 | $favorites = Favorite::get(); | |
| 58 | $favorites = Favorite::get()->toArray(); | |
| 58 | 59 | |
| 59 | 60 | $favorites = array_reverse($favorites); |
| 60 | 61 | $response = Favorite::delete($favorites[0]['id']); |