also looking at this
Add More Tests
#42
6 files
+170
-26
| @@ -0,0 +1,67 @@ | ||
| 1 | <?php | |
| 2 | ||
| 3 | uses(Tests\ClientTest::class); | |
| 4 | ||
| 5 | beforeEach(function () { | |
| 6 | $this->initializeDotEnv(); | |
| 7 | $this->initializeClient(); | |
| 8 | }); | |
| 9 | ||
| 10 | it('can fetch all tags', function () { | |
| 11 | $tags = $this->client->tags()->get(); | |
| 12 | ||
| 13 | $this->assertTrue(is_array($tags)); | |
| 14 | $this->assertTrue(count($tags) > 0); | |
| 15 | }); | |
| 16 | ||
| 17 | it('can fetch specific group of tags', function () { | |
| 18 | $ids = [7, 8, 9]; | |
| 19 | ||
| 20 | $tags = $this->client->tags()->get($ids); | |
| 21 | ||
| 22 | $this->assertTrue(is_array($tags)); | |
| 23 | $this->assertTrue(count($tags['data']) === count($ids)); | |
| 24 | }); | |
| 25 | ||
| 26 | it('can find a single tag', function () { | |
| 27 | $id = 7; | |
| 28 | ||
| 29 | $tags = $this->client->tags()->find($id)->toArray(); | |
| 30 | ||
| 31 | $this->assertTrue(is_array($tags)); | |
| 32 | $this->assertTrue(count($tags) === 1); | |
| 33 | }); | |
| 34 | ||
| 35 | it('can update a tag', function () { | |
| 36 | $color = 'purple-600'; | |
| 37 | ||
| 38 | $tags = $this->client->tags()->update(7, $color); | |
| 39 | ||
| 40 | $this->assertTrue(is_array($tags)); | |
| 41 | $this->assertTrue($tags['data']['color'] === $color); | |
| 42 | }); | |
| 43 | ||
| 44 | it('can delete a tag', function () { | |
| 45 | $tags = $this->client->tags()->get(); | |
| 46 | ||
| 47 | $tags = array_reverse($tags['data']); | |
| 48 | $response = $this->client->tags()->delete($tags[0]['id']); | |
| 49 | ||
| 50 | $this->assertTrue(is_null($response)); | |
| 51 | }); | |
| 52 | ||
| 53 | it('can fetch all media tags', function () { | |
| 54 | $media = $this->client->media()->find(1); | |
| 55 | $tags = $media->tags()->get(); | |
| 56 | ||
| 57 | $this->assertTrue(is_array($tags)); | |
| 58 | $this->assertTrue(count($tags['data'][0]) > 0); | |
| 59 | }); | |
| 60 | ||
| 61 | it('can fetch all folder tags', function () { | |
| 62 | $folder = $this->client->folders()->find(1); | |
| 63 | $tags = $folder->tags()->get(); | |
| 64 | ||
| 65 | $this->assertTrue(is_array($tags)); | |
| 66 | $this->assertTrue(count($tags['data'][0]) > 0); | |
| 67 | }); | |