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/MediaTest.phpmodified+11-10
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,8 +16,8 @@ beforeEach(function () {
1516it('can be fetch all media', function () {
1617 $media = Media::get();
1718
18 $this->assertTrue(is_array($media));
19 $this->assertTrue(count($media) > 0);
19 $this->assertTrue($media instanceof Collection);
20 $this->assertTrue($media->count() > 0);
2021});
2122
2223it('can search a media', function () {
@@ -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,8 +36,8 @@ 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(count($media) > 0);
39 $this->assertTrue($media instanceof Collection);
40 $this->assertTrue($media->count() > 0);
4041});
4142
4243it('can be fetch all media for a folder', function () {
@@ -45,8 +46,8 @@ 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(count($media) > 0);
49 $this->assertTrue($media instanceof Collection);
50 $this->assertTrue($media->count() > 0);
5051});
5152
5253it('can be fetch specific group of media', function () {
@@ -54,8 +55,8 @@ 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(count($media) === count($ids));
58 $this->assertTrue($media instanceof Collection);
59 $this->assertTrue($media->count() === count($ids));
5960});
6061
6162it('can find a single media', function () {
@@ -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']);