ReviewOS

also looking at this

meemalabs/meema-client-php

Remove "data" in array response

#47
Merged glennmichael123 wants to merge remove-data-array into main
5 files +40 -34
tests/MeemaTagTest.phpmodified+6-6
Changes to tests/MeemaTagTest.php
@@ -20,7 +20,7 @@ it('can fetch specific group of tags', function () {
2020 $tags = $this->client->tags()->get($ids);
2121
2222 $this->assertTrue(is_array($tags));
23 $this->assertTrue(count($tags['data']) === count($ids));
23 $this->assertTrue(count($tags) === count($ids));
2424});
2525
2626it('can find a single tag', function () {
@@ -29,7 +29,7 @@ it('can find a single tag', function () {
2929 $tags = $this->client->tags()->find($id)->toArray();
3030
3131 $this->assertTrue(is_array($tags));
32 $this->assertTrue(count($tags) === 1);
32 $this->assertTrue(array_key_exists('id', $tags));
3333});
3434
3535it('can update a tag', function () {
@@ -38,13 +38,13 @@ it('can update a tag', function () {
3838 $tags = $this->client->tags()->update(7, $color);
3939
4040 $this->assertTrue(is_array($tags));
41 $this->assertTrue($tags['data']['color'] === $color);
41 $this->assertTrue($tags['color'] === $color);
4242});
4343
4444it('can delete a tag', function () {
4545 $tags = $this->client->tags()->get();
4646
47 $tags = array_reverse($tags['data']);
47 $tags = array_reverse($tags);
4848 $response = $this->client->tags()->delete($tags[0]['id']);
4949
5050 $this->assertTrue(is_null($response));
@@ -55,7 +55,7 @@ it('can fetch all media tags', function () {
5555 $tags = $media->tags()->get();
5656
5757 $this->assertTrue(is_array($tags));
58 $this->assertTrue(count($tags['data'][0]) > 0);
58 $this->assertTrue(count($tags[0]) > 0);
5959});
6060
6161it('can fetch all folder tags', function () {
@@ -63,5 +63,5 @@ it('can fetch all folder tags', function () {
6363 $tags = $folder->tags()->get();
6464
6565 $this->assertTrue(is_array($tags));
66 $this->assertTrue(count($tags['data'][0]) > 0);
66 $this->assertTrue(count($tags[0]) > 0);
6767});