also looking at this
Collection Response
#5
7 files
+42
-51
src/MeemaFacade.phpdeleted+0-21
| @@ -1,21 +0,0 @@ | ||
| 1 | <?php | |
| 2 | ||
| 3 | namespace Meema\LaravelMeema; | |
| 4 | ||
| 5 | use Illuminate\Support\Facades\Facade; | |
| 6 | ||
| 7 | /** | |
| 8 | * @see \Meema\LaravelMeema\MeemaClass | |
| 9 | */ | |
| 10 | class MeemaFacade extends Facade | |
| 11 | { | |
| 12 | /** | |
| 13 | * Get the registered name of the component. | |
| 14 | * | |
| 15 | * @return string | |
| 16 | */ | |
| 17 | protected static function getFacadeAccessor() | |
| 18 | { | |
| 19 | return 'meema'; | |
| 20 | } | |
| 21 | } | |
| @@ -53,7 +53,10 @@ class MeemaServiceProvider extends ServiceProvider | ||
| 53 | 53 | protected function registerMeemaClient() |
| 54 | 54 | { |
| 55 | 55 | $this->app->singleton('meema', function ($app) { |
| 56 | $config = ['base_url' => config('meema.meema_test_url')]; | |
| 56 | $config = [ | |
| 57 | 'base_url' => config('meema.meema_test_url'), | |
| 58 | 'to_collection' => config('meema.to_collection'), | |
| 59 | ]; | |
| 57 | 60 | |
| 58 | 61 | return new Client(config('meema.api_key'), $config); |
| 59 | 62 | }); |
| @@ -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,8 +14,8 @@ 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(count($favorites) > 0); | |
| 17 | $this->assertTrue($favorites instanceof Collection); | |
| 18 | $this->assertTrue($favorites->count() > 0); | |
| 18 | 19 | }); |
| 19 | 20 | |
| 20 | 21 | it('can fetch specific group of favorites', function () { |
| @@ -22,8 +23,8 @@ 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(count($favorites) === count($ids)); | |
| 26 | $this->assertTrue($favorites instanceof Collection); | |
| 27 | $this->assertTrue($favorites->count() === count($ids)); | |
| 27 | 28 | }); |
| 28 | 29 | |
| 29 | 30 | it('can find a single favorite', function () { |
| @@ -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,8 +14,8 @@ 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(count($folders) > 0); | |
| 17 | $this->assertTrue($folders instanceof Collection); | |
| 18 | $this->assertTrue($folders->count() > 0); | |
| 18 | 19 | }); |
| 19 | 20 | |
| 20 | 21 | it('can search a folder', function () { |
| @@ -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,8 +34,8 @@ 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(count($folders) === count($ids)); | |
| 37 | $this->assertTrue($folders instanceof Collection); | |
| 38 | $this->assertTrue($folders->count() === count($ids)); | |
| 38 | 39 | }); |
| 39 | 40 | |
| 40 | 41 | it('can find a single folder', function () { |
| @@ -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,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']); |
| @@ -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 fetch all tags', function () { |
| 16 | 17 | $tags = Tag::get(); |
| 17 | 18 | |
| 18 | $this->assertTrue(is_array($tags)); | |
| 19 | $this->assertTrue(count($tags) > 0); | |
| 19 | $this->assertTrue($tags instanceof Collection); | |
| 20 | $this->assertTrue($tags->count() > 0); | |
| 20 | 21 | }); |
| 21 | 22 | |
| 22 | 23 | it('can fetch specific group of tags', function () { |
| @@ -24,8 +25,8 @@ 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(count($tags) === count($ids)); | |
| 28 | $this->assertTrue($tags instanceof Collection); | |
| 29 | $this->assertTrue($tags->count() === count($ids)); | |
| 29 | 30 | }); |
| 30 | 31 | |
| 31 | 32 | it('can find a single tag', function () { |
| @@ -50,8 +51,8 @@ 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(count($tags[0]) > 0); | |
| 54 | $this->assertTrue($tags instanceof Collection); | |
| 55 | $this->assertTrue($tags->count() >= 0); | |
| 55 | 56 | }); |
| 56 | 57 | |
| 57 | 58 | it('can fetch all folder tags', function () { |
| @@ -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']); |