ReviewOS

also looking at this

meemalabs/laravel-meema

Collection Response

#5
Merged glennmichael123 wants to merge collection-response into main
7 files +42 -51
tests/FavoriteTest.phpmodified+6-5
Changes to tests/FavoriteTest.php
@@ -1,5 +1,6 @@
11<?php
22
3use Illuminate\Support\Collection;
34use Meema\LaravelMeema\Facades\Favorite;
45use Meema\LaravelMeema\Tests\LaravelMeemaTestCase;
56
@@ -13,8 +14,8 @@ beforeEach(function () {
1314it('can fetch all favorites', function () {
1415 $favorites = Favorite::get();
1516
16 $this->assertTrue(is_array($favorites));
17 $this->assertTrue(count($favorites) > 0);
17 $this->assertTrue($favorites instanceof Collection);
18 $this->assertTrue($favorites->count() > 0);
1819});
1920
2021it('can fetch specific group of favorites', function () {
@@ -22,8 +23,8 @@ it('can fetch specific group of favorites', function () {
2223
2324 $favorites = Favorite::get($ids);
2425
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));
2728});
2829
2930it('can find a single favorite', function () {
@@ -54,7 +55,7 @@ it('can update a favorite', function () {
5455});
5556
5657it('can delete a favorite', function () {
57 $favorites = Favorite::get();
58 $favorites = Favorite::get()->toArray();
5859
5960 $favorites = array_reverse($favorites);
6061 $response = Favorite::delete($favorites[0]['id']);