ReviewOS

also looking at this

meemalabs/meema-client-php

Add More Tests

#42
Merged glennmichael123 wants to merge add-more-tests into main
6 files +170 -26
src/Models/Tag.phpmodified+13-19
Changes to src/Models/Tag.php
@@ -60,12 +60,14 @@ class Tag
6060 return $this->all();
6161 }
6262
63 if (! is_int($id)) {
64 throw new InvalidFormatException();
65 }
66
6763 $ids = is_array($id) ? $id : func_get_args();
6864
65 foreach ($ids as $id) {
66 if (! is_int($id)) {
67 throw new InvalidFormatException();
68 }
69 }
70
6971 return $this->client->request('GET', 'tags', ['tag_ids' => $ids]);
7072 }
7173
@@ -87,20 +89,6 @@ class Tag
8789 return new Response($this, $response);
8890 }
8991
90 /**
91 * Create folder.
92 *
93 * @param string $name
94 *
95 * @return array
96 */
97 public function create($name): array
98 {
99 $name = is_array($name) ? $name : compact('name');
100
101 return $this->client->request('POST', "tags/{$this->client->getAccessKey()}", $name);
102 }
103
10492 /**
10593 * Update folder.
10694 *
@@ -109,12 +97,18 @@ class Tag
10997 *
11098 * @return array
11199 */
112 public function update($id, $data): array
100 public function update($id, $color): array
113101 {
114102 if (! is_int($id)) {
115103 throw new InvalidFormatException();
116104 }
117105
106 $data = [
107 'color' => $color,
108 'tag_id' => $id,
109 'team_id' => 1,
110 ];
111
118112 return $this->client->request('PATCH', 'tags/color', $data);
119113 }
120114