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\Folder; |
| 4 | 5 | use Meema\LaravelMeema\Facades\Media; |
| 5 | 6 | use Meema\LaravelMeema\Facades\Tag; |
| @@ -15,8 +16,8 @@ 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(count($media) > 0); | |
| 19 | $this->assertTrue($media instanceof Collection); | |
| 20 | $this->assertTrue($media->count() > 0); | |
| 20 | 21 | }); |
| 21 | 22 | |
| 22 | 23 | it('can search a media', function () { |
| @@ -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,8 +36,8 @@ 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(count($media) > 0); | |
| 39 | $this->assertTrue($media instanceof Collection); | |
| 40 | $this->assertTrue($media->count() > 0); | |
| 40 | 41 | }); |
| 41 | 42 | |
| 42 | 43 | it('can be fetch all media for a folder', function () { |
| @@ -45,8 +46,8 @@ 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(count($media) > 0); | |
| 49 | $this->assertTrue($media instanceof Collection); | |
| 50 | $this->assertTrue($media->count() > 0); | |
| 50 | 51 | }); |
| 51 | 52 | |
| 52 | 53 | it('can be fetch specific group of media', function () { |
| @@ -54,8 +55,8 @@ 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(count($media) === count($ids)); | |
| 58 | $this->assertTrue($media instanceof Collection); | |
| 59 | $this->assertTrue($media->count() === count($ids)); | |
| 59 | 60 | }); |
| 60 | 61 | |
| 61 | 62 | it('can find a single media', function () { |
| @@ -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']); |