also looking at this
Collection Response
#5
7 files
+42
-51
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -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,7 +14,7 @@ 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($favorites instanceof Collection); | |
| 17 | 18 | $this->assertTrue(count($favorites) > 0); |
| 18 | 19 | }); |
| 19 | 20 | |
| @@ -22,7 +23,7 @@ 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($favorites instanceof Collection); | |
| 26 | 27 | $this->assertTrue(count($favorites) === count($ids)); |
| 27 | 28 | }); |
| 28 | 29 | |
| @@ -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']); |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | use Illuminate\Support\Collection; | |
| 3 | 4 | use Meema\LaravelMeema\Facades\Folder; |
| 4 | 5 | use Meema\LaravelMeema\Tests\LaravelMeemaTestCase; |
| 5 | 6 | |
| @@ -13,7 +14,7 @@ beforeEach(function () { | ||
| 13 | 14 | it('can fetch all folders', function () { |
| 14 | 15 | $folders = Folder::get(); |
| 15 | 16 | |
| 16 | $this->assertTrue(is_array($folders)); | |
| 17 | $this->assertTrue($folders instanceof Collection); | |
| 17 | 18 | $this->assertTrue(count($folders) > 0); |
| 18 | 19 | }); |
| 19 | 20 | |
| @@ -24,7 +25,7 @@ it('can search a folder', function () { | ||
| 24 | 25 | |
| 25 | 26 | $folders = Folder::search($query); |
| 26 | 27 | |
| 27 | $this->assertTrue(is_array($folders)); | |
| 28 | $this->assertTrue($folders instanceof Collection); | |
| 28 | 29 | $this->assertTrue(str_contains($folders[0]['name'], $query)); |
| 29 | 30 | }); |
| 30 | 31 | |
| @@ -33,7 +34,7 @@ it('can fetch specific group of folders', function () { | ||
| 33 | 34 | |
| 34 | 35 | $folders = Folder::get($ids); |
| 35 | 36 | |
| 36 | $this->assertTrue(is_array($folders)); | |
| 37 | $this->assertTrue($folders instanceof Collection); | |
| 37 | 38 | $this->assertTrue(count($folders) === count($ids)); |
| 38 | 39 | }); |
| 39 | 40 | |
| @@ -88,7 +89,7 @@ it('can duplicate a folder', function () { | ||
| 88 | 89 | }); |
| 89 | 90 | |
| 90 | 91 | it('can delete a folder', function () { |
| 91 | $folders = Folder::get(); | |
| 92 | $folders = Folder::get()->toArray(); | |
| 92 | 93 | |
| 93 | 94 | $folders = array_reverse($folders); |
| 94 | 95 | $response = Folder::delete($folders[0]['id']); |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | use Illuminate\Support\Collection; | |
| 3 | 4 | use Meema\LaravelMeema\Facades\Folder; |
| 4 | 5 | use Meema\LaravelMeema\Facades\Media; |
| 5 | 6 | use Meema\LaravelMeema\Facades\Tag; |
| @@ -15,7 +16,7 @@ beforeEach(function () { | ||
| 15 | 16 | it('can be fetch all media', function () { |
| 16 | 17 | $media = Media::get(); |
| 17 | 18 | |
| 18 | $this->assertTrue(is_array($media)); | |
| 19 | $this->assertTrue($media instanceof Collection); | |
| 19 | 20 | $this->assertTrue(count($media) > 0); |
| 20 | 21 | }); |
| 21 | 22 | |
| @@ -25,7 +26,7 @@ it('can search a media', function () { | ||
| 25 | 26 | |
| 26 | 27 | $media = Media::search($query); |
| 27 | 28 | |
| 28 | $this->assertTrue(is_array($media)); | |
| 29 | $this->assertTrue($media instanceof Collection); | |
| 29 | 30 | $this->assertTrue(str_contains($media[0]['name'], $query)); |
| 30 | 31 | }); |
| 31 | 32 | |
| @@ -35,7 +36,7 @@ it('can be fetch all media for a tag', function () { | ||
| 35 | 36 | |
| 36 | 37 | $media = $tag->media()->get(); |
| 37 | 38 | |
| 38 | $this->assertTrue(is_array($media)); | |
| 39 | $this->assertTrue($media instanceof Collection); | |
| 39 | 40 | $this->assertTrue(count($media) > 0); |
| 40 | 41 | }); |
| 41 | 42 | |
| @@ -45,7 +46,7 @@ it('can be fetch all media for a folder', function () { | ||
| 45 | 46 | |
| 46 | 47 | $media = $folder->media()->get(); |
| 47 | 48 | |
| 48 | $this->assertTrue(is_array($media)); | |
| 49 | $this->assertTrue($media instanceof Collection); | |
| 49 | 50 | $this->assertTrue(count($media) > 0); |
| 50 | 51 | }); |
| 51 | 52 | |
| @@ -54,7 +55,7 @@ it('can be fetch specific group of media', function () { | ||
| 54 | 55 | |
| 55 | 56 | $media = Media::get($ids); |
| 56 | 57 | |
| 57 | $this->assertTrue(is_array($media)); | |
| 58 | $this->assertTrue($media instanceof Collection); | |
| 58 | 59 | $this->assertTrue(count($media) === count($ids)); |
| 59 | 60 | }); |
| 60 | 61 | |
| @@ -114,7 +115,7 @@ it('can duplicate a media', function () { | ||
| 114 | 115 | }); |
| 115 | 116 | |
| 116 | 117 | it('can delete a media', function () { |
| 117 | $media = Media::get(); | |
| 118 | $media = Media::get()->toArray(); | |
| 118 | 119 | |
| 119 | 120 | $media = array_reverse($media); |
| 120 | 121 | $response = Media::delete((int) $media[0]['media_id']); |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | use Illuminate\Support\Collection; | |
| 3 | 4 | use Meema\LaravelMeema\Facades\Folder; |
| 4 | 5 | use Meema\LaravelMeema\Facades\Media; |
| 5 | 6 | use Meema\LaravelMeema\Facades\Tag; |
| @@ -15,7 +16,7 @@ beforeEach(function () { | ||
| 15 | 16 | it('can fetch all tags', function () { |
| 16 | 17 | $tags = Tag::get(); |
| 17 | 18 | |
| 18 | $this->assertTrue(is_array($tags)); | |
| 19 | $this->assertTrue($tags instanceof Collection); | |
| 19 | 20 | $this->assertTrue(count($tags) > 0); |
| 20 | 21 | }); |
| 21 | 22 | |
| @@ -24,7 +25,7 @@ it('can fetch specific group of tags', function () { | ||
| 24 | 25 | |
| 25 | 26 | $tags = Tag::get($ids); |
| 26 | 27 | |
| 27 | $this->assertTrue(is_array($tags)); | |
| 28 | $this->assertTrue($tags instanceof Collection); | |
| 28 | 29 | $this->assertTrue(count($tags) === count($ids)); |
| 29 | 30 | }); |
| 30 | 31 | |
| @@ -50,7 +51,7 @@ it('can fetch all media tags', function () { | ||
| 50 | 51 | $media = Media::find(1); |
| 51 | 52 | $tags = $media->tags()->get(); |
| 52 | 53 | |
| 53 | $this->assertTrue(is_array($tags)); | |
| 54 | $this->assertTrue($tags instanceof Collection); | |
| 54 | 55 | $this->assertTrue(count($tags[0]) > 0); |
| 55 | 56 | }); |
| 56 | 57 | |
| @@ -59,12 +60,12 @@ it('can fetch all folder tags', function () { | ||
| 59 | 60 | |
| 60 | 61 | $tags = $folder->tags()->get(); |
| 61 | 62 | |
| 62 | $this->assertTrue(is_array($tags)); | |
| 63 | $this->assertTrue($tags instanceof Collection); | |
| 63 | 64 | $this->assertTrue(count($tags[0]) > 0); |
| 64 | 65 | }); |
| 65 | 66 | |
| 66 | 67 | it('can delete a tag', function () { |
| 67 | $tags = Tag::get(); | |
| 68 | $tags = Tag::get()->toArray(); | |
| 68 | 69 | |
| 69 | 70 | $tags = array_reverse($tags); |
| 70 | 71 | $response = Tag::delete($tags[0]['id']); |