ReviewOS

also looking at this

meemalabs/laravel-meema

Collection Response

#5
Merged glennmichael123 wants to merge collection-response into main
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.

tests/FavoriteTest.phpmodified+4-3
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,7 +14,7 @@ beforeEach(function () {
1314it('can fetch all favorites', function () {
1415 $favorites = Favorite::get();
1516
16 $this->assertTrue(is_array($favorites));
17 $this->assertTrue($favorites instanceof Collection);
1718 $this->assertTrue(count($favorites) > 0);
1819});
1920
@@ -22,7 +23,7 @@ it('can fetch specific group of favorites', function () {
2223
2324 $favorites = Favorite::get($ids);
2425
25 $this->assertTrue(is_array($favorites));
26 $this->assertTrue($favorites instanceof Collection);
2627 $this->assertTrue(count($favorites) === count($ids));
2728});
2829
@@ -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']);
tests/FolderTest.phpmodified+5-4
Changes to tests/FolderTest.php
@@ -1,5 +1,6 @@
11<?php
22
3use Illuminate\Support\Collection;
34use Meema\LaravelMeema\Facades\Folder;
45use Meema\LaravelMeema\Tests\LaravelMeemaTestCase;
56
@@ -13,7 +14,7 @@ beforeEach(function () {
1314it('can fetch all folders', function () {
1415 $folders = Folder::get();
1516
16 $this->assertTrue(is_array($folders));
17 $this->assertTrue($folders instanceof Collection);
1718 $this->assertTrue(count($folders) > 0);
1819});
1920
@@ -24,7 +25,7 @@ it('can search a folder', function () {
2425
2526 $folders = Folder::search($query);
2627
27 $this->assertTrue(is_array($folders));
28 $this->assertTrue($folders instanceof Collection);
2829 $this->assertTrue(str_contains($folders[0]['name'], $query));
2930});
3031
@@ -33,7 +34,7 @@ it('can fetch specific group of folders', function () {
3334
3435 $folders = Folder::get($ids);
3536
36 $this->assertTrue(is_array($folders));
37 $this->assertTrue($folders instanceof Collection);
3738 $this->assertTrue(count($folders) === count($ids));
3839});
3940
@@ -88,7 +89,7 @@ it('can duplicate a folder', function () {
8889});
8990
9091it('can delete a folder', function () {
91 $folders = Folder::get();
92 $folders = Folder::get()->toArray();
9293
9394 $folders = array_reverse($folders);
9495 $response = Folder::delete($folders[0]['id']);
tests/MediaTest.phpmodified+7-6
Changes to tests/MediaTest.php
@@ -1,5 +1,6 @@
11<?php
22
3use Illuminate\Support\Collection;
34use Meema\LaravelMeema\Facades\Folder;
45use Meema\LaravelMeema\Facades\Media;
56use Meema\LaravelMeema\Facades\Tag;
@@ -15,7 +16,7 @@ beforeEach(function () {
1516it('can be fetch all media', function () {
1617 $media = Media::get();
1718
18 $this->assertTrue(is_array($media));
19 $this->assertTrue($media instanceof Collection);
1920 $this->assertTrue(count($media) > 0);
2021});
2122
@@ -25,7 +26,7 @@ it('can search a media', function () {
2526
2627 $media = Media::search($query);
2728
28 $this->assertTrue(is_array($media));
29 $this->assertTrue($media instanceof Collection);
2930 $this->assertTrue(str_contains($media[0]['name'], $query));
3031});
3132
@@ -35,7 +36,7 @@ it('can be fetch all media for a tag', function () {
3536
3637 $media = $tag->media()->get();
3738
38 $this->assertTrue(is_array($media));
39 $this->assertTrue($media instanceof Collection);
3940 $this->assertTrue(count($media) > 0);
4041});
4142
@@ -45,7 +46,7 @@ it('can be fetch all media for a folder', function () {
4546
4647 $media = $folder->media()->get();
4748
48 $this->assertTrue(is_array($media));
49 $this->assertTrue($media instanceof Collection);
4950 $this->assertTrue(count($media) > 0);
5051});
5152
@@ -54,7 +55,7 @@ it('can be fetch specific group of media', function () {
5455
5556 $media = Media::get($ids);
5657
57 $this->assertTrue(is_array($media));
58 $this->assertTrue($media instanceof Collection);
5859 $this->assertTrue(count($media) === count($ids));
5960});
6061
@@ -114,7 +115,7 @@ it('can duplicate a media', function () {
114115});
115116
116117it('can delete a media', function () {
117 $media = Media::get();
118 $media = Media::get()->toArray();
118119
119120 $media = array_reverse($media);
120121 $response = Media::delete((int) $media[0]['media_id']);
tests/TagTest.phpmodified+6-5
Changes to tests/TagTest.php
@@ -1,5 +1,6 @@
11<?php
22
3use Illuminate\Support\Collection;
34use Meema\LaravelMeema\Facades\Folder;
45use Meema\LaravelMeema\Facades\Media;
56use Meema\LaravelMeema\Facades\Tag;
@@ -15,7 +16,7 @@ beforeEach(function () {
1516it('can fetch all tags', function () {
1617 $tags = Tag::get();
1718
18 $this->assertTrue(is_array($tags));
19 $this->assertTrue($tags instanceof Collection);
1920 $this->assertTrue(count($tags) > 0);
2021});
2122
@@ -24,7 +25,7 @@ it('can fetch specific group of tags', function () {
2425
2526 $tags = Tag::get($ids);
2627
27 $this->assertTrue(is_array($tags));
28 $this->assertTrue($tags instanceof Collection);
2829 $this->assertTrue(count($tags) === count($ids));
2930});
3031
@@ -50,7 +51,7 @@ it('can fetch all media tags', function () {
5051 $media = Media::find(1);
5152 $tags = $media->tags()->get();
5253
53 $this->assertTrue(is_array($tags));
54 $this->assertTrue($tags instanceof Collection);
5455 $this->assertTrue(count($tags[0]) > 0);
5556});
5657
@@ -59,12 +60,12 @@ it('can fetch all folder tags', function () {
5960
6061 $tags = $folder->tags()->get();
6162
62 $this->assertTrue(is_array($tags));
63 $this->assertTrue($tags instanceof Collection);
6364 $this->assertTrue(count($tags[0]) > 0);
6465});
6566
6667it('can delete a tag', function () {
67 $tags = Tag::get();
68 $tags = Tag::get()->toArray();
6869
6970 $tags = array_reverse($tags);
7071 $response = Tag::delete($tags[0]['id']);