• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pgrimaud / instagram-user-feed / 7311167597

23 Dec 2023 11:55PM UTC coverage: 92.348% (-0.2%) from 92.522%
7311167597

push

github

web-flow
Do not hydrate media or IGTV loaded with profile data (#362)

* Mark IMAP client test as skipped when IMAP extension is not loaded

This prevents having the test suite fail on platforms when the extension
is not loaded.  The test is marked as skipped so the developer knows
that the full test suite was not run

* Add a convenience script to run unit tests with "composer test"

* Do not hydrate media or IGTV loaded with profile data

Instagram no longer reliably returns medias or IGTVs with the call to
get profile information.  Instead, the user must explicitly make a call
to `\Instagram\Api::getMoreMedias` in order to fetch medias or to
`getMoreIgtvs` to fetch IGTVs

1 of 2 new or added lines in 1 file covered. (50.0%)

3 existing lines in 2 files now uncovered.

2124 of 2300 relevant lines covered (92.35%)

15.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.5
/src/Instagram/Model/Profile.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Instagram\Model;
6

7
class Profile
8
{
9
    /**
10
     * @var int
11
     */
12
    private $id;
13

14
    /**
15
     * @var string
16
     */
17
    private $id32Bit;
18

19
    /**
20
     * @var string
21
     */
22
    private $userName;
23

24
    /**
25
     * @var string
26
     */
27
    private $fullName;
28

29
    /**
30
     * @var string
31
     */
32
    private $biography;
33

34
    /**
35
     * @var int
36
     */
37
    private $followers;
38

39
    /**
40
     * @var int
41
     */
42
    private $following;
43

44
    /**
45
     * @var string
46
     */
47
    private $profilePicture;
48

49
    /**
50
     * @var string
51
     */
52
    private $externalUrl;
53

54
    /**
55
     * @var bool
56
     */
57
    private $private;
58

59
    /**
60
     * @var bool
61
     */
62
    private $verified;
63

64
    /**
65
     * @var int
66
     */
67
    private $mediaCount = 0;
68

69
    /**
70
     * @var Media[]
71
     */
72
    private $medias = [];
73

74
    /**
75
     * @var bool
76
     */
77
    private $hasMoreMedias = false;
78

79
    /**
80
     * @var string
81
     */
82
    private $endCursor = null;
83

84
    /**
85
     * @var Media[]
86
     */
87
    private $igtvs = [];
88

89
    /**
90
     * @var bool
91
     */
92
    private $hasMoreIgtvs = false;
93

94
    /**
95
     * @var string
96
     */
97
    private $endCursorIgtvs = null;
98

99
    /**
100
     * @return string
101
     */
102
    public function getUserName(): string
103
    {
104
        return $this->userName;
10✔
105
    }
106

107
    /**
108
     * @param string $userName
109
     */
110
    public function setUserName(string $userName): void
111
    {
112
        $this->userName = $userName;
55✔
113
    }
11✔
114

115
    /**
116
     * @return string
117
     */
118
    public function getFullName(): string
119
    {
120
        return $this->fullName;
5✔
121
    }
122

123
    /**
124
     * @param string $fullName
125
     */
126
    public function setFullName(string $fullName): void
127
    {
128
        $this->fullName = $fullName;
55✔
129
    }
11✔
130

131
    /**
132
     * @return string
133
     */
134
    public function getBiography(): string
135
    {
136
        return $this->biography;
5✔
137
    }
138

139
    /**
140
     * @param string $biography
141
     */
142
    public function setBiography(string $biography): void
143
    {
144
        $this->biography = $biography;
45✔
145
    }
9✔
146

147
    /**
148
     * @return int
149
     */
150
    public function getFollowers(): int
151

152
    {
153
        return $this->followers;
5✔
154
    }
155

156
    /**
157
     * @param int $followers
158
     */
159
    public function setFollowers(int $followers): void
160
    {
161
        $this->followers = $followers;
55✔
162
    }
11✔
163

164
    /**
165
     * @return int
166
     */
167
    public function getFollowing(): int
168
    {
169
        return $this->following;
5✔
170
    }
171

172
    /**
173
     * @param int $following
174
     */
175
    public function setFollowing(int $following): void
176
    {
177
        $this->following = $following;
45✔
178
    }
9✔
179

180
    /**
181
     * @return string
182
     */
183
    public function getProfilePicture(): string
184
    {
185
        return $this->profilePicture;
10✔
186
    }
187

188
    /**
189
     * @param string $profilePicture
190
     */
191
    public function setProfilePicture(string $profilePicture): void
192
    {
193
        $this->profilePicture = $profilePicture;
45✔
194
    }
9✔
195

196
    /**
197
     * @return string
198
     */
199
    public function getExternalUrl(): ?string
200
    {
201
        return $this->externalUrl;
5✔
202
    }
203

204
    /**
205
     * @param string $externalUrl
206
     */
207
    public function setExternalUrl(?string $externalUrl): void
208
    {
209
        $this->externalUrl = $externalUrl;
45✔
210
    }
9✔
211

212
    /**
213
     * @return bool
214
     */
215
    public function isPrivate(): bool
216
    {
217
        return $this->private;
5✔
218
    }
219

220
    /**
221
     * @param bool $private
222
     */
223
    public function setPrivate(bool $private): void
224
    {
225
        $this->private = $private;
55✔
226
    }
11✔
227

228
    /**
229
     * @return bool
230
     */
231
    public function isVerified(): bool
232
    {
233
        return $this->verified;
5✔
234
    }
235

236
    /**
237
     * @param bool $verified
238
     */
239
    public function setVerified(bool $verified): void
240
    {
241
        $this->verified = $verified;
55✔
242
    }
11✔
243

244
    /**
245
     * @return int
246
     */
247
    public function getId(): int
248
    {
249
        return $this->id;
50✔
250
    }
251

252
    /**
253
     * @param int $id
254
     */
255
    public function setId(int $id): void
256
    {
257
        $this->id = $id;
65✔
258
    }
13✔
259

260
    /**
261
     * @return int
262
     */
263
    public function getMediaCount(): int
264
    {
265
        return $this->mediaCount;
5✔
266
    }
267

268
    /**
269
     * @param int $mediaCount
270
     */
271
    public function setMediaCount(int $mediaCount): void
272
    {
273
        $this->mediaCount = $mediaCount;
55✔
274
    }
11✔
275

276
    /**
277
     * @return Media[]
278
     */
279
    public function getMedias(): array
280
    {
281
        return $this->medias;
10✔
282
    }
283

284
    /**
285
     * @param Media $media
286
     */
287
    public function addMedia(Media $media): void
288
    {
289
        $this->medias[] = $media;
15✔
290
    }
3✔
291

292
    /**
293
     * @param bool $hasMoreMedias
294
     */
295
    public function setHasMoreMedias(bool $hasMoreMedias): void
296
    {
297
        $this->hasMoreMedias = $hasMoreMedias;
15✔
298
    }
3✔
299

300
    /**
301
     * @return bool
302
     */
303
    public function hasMoreMedias(): bool
304
    {
305
        return $this->hasMoreMedias;
5✔
306
    }
307

308
    /**
309
     * @param string|null $endCursor
310
     */
311
    public function setEndCursor(?string $endCursor): void
312
    {
313
        $this->endCursor = $endCursor;
15✔
314
    }
3✔
315

316
    /**
317
     * @return string|null
318
     */
319
    public function getEndCursor(): ?string
320
    {
321
        return $this->endCursor;
20✔
322
    }
323

324
    /**
325
     * @param Media[] $medias
326
     */
327
    public function setMedias(array $medias): void
328
    {
329
        $this->medias = $medias;
15✔
330
    }
3✔
331

332
    /**
333
     * @return array
334
     */
335
    public function toArray(): array
336
    {
337
        return [
4✔
338
            'id'             => $this->id,
5✔
339
            'userName'       => $this->userName,
5✔
340
            'fullName'       => $this->fullName,
5✔
341
            'biography'      => $this->biography,
5✔
342
            'followers'      => $this->followers,
5✔
343
            'following'      => $this->following,
5✔
344
            'profilePicture' => $this->profilePicture,
5✔
345
            'externalUrl'    => $this->externalUrl,
5✔
346
            'private'        => $this->private,
5✔
347
            'verified'       => $this->verified,
5✔
348
            'mediaCount'     => $this->mediaCount,
5✔
349
            'medias'         => array_map(function ($media) {
4✔
UNCOV
350
                return $media->toArray();
×
351
            }, $this->medias),
5✔
352
            'igtvs'         => array_map(function ($igtv) {
4✔
UNCOV
353
                return $igtv->toArray();
×
354
            }, $this->igtvs),
5✔
355
            'hasMoreMedias'  => $this->hasMoreMedias,
5✔
356
            'endCursor'      => $this->endCursor,
5✔
357
        ];
4✔
358
    }
359

360
    /**
361
     * @return array
362
     */
363
    public function __serialize(): array
364
    {
365
        return $this->toArray();
5✔
366
    }
367

368
    /**
369
     * @return string
370
     */
371
    public function getId32Bit(): string
372
    {
373
        return $this->id32Bit;
5✔
374
    }
375

376
    /**
377
     * @param string $id32Bit
378
     */
379
    public function setId32Bit(string $id32Bit): void
380
    {
381
        $this->id32Bit = $id32Bit;
40✔
382
    }
8✔
383

384
    /**
385
     * @param Media[] $igtvs
386
     */
387
    public function setIgtv(array $igtvs): void
388
    {
389
        $this->igtvs = $igtvs;
5✔
390
    }
1✔
391

392
    /**
393
     * @return Media[]
394
     */
395
    public function getIgtvs(): array
396
    {
397
        return $this->igtvs;
5✔
398
    }
399

400
    /**
401
     * @param Media $igtv
402
     */
403
    public function addIgtv(Media $igtv): void
404
    {
405
        $this->igtvs[] = $igtv;
5✔
406
    }
1✔
407

408
    /**
409
     * @param bool $hasMoreIgtvs
410
     */
411
    public function setHasMoreIgtvs(bool $hasMoreIgtvs): void
412
    {
413
        $this->hasMoreIgtvs = $hasMoreIgtvs;
5✔
414
    }
1✔
415

416
    /**
417
     * @return bool
418
     */
419
    public function hasMoreIgtvs(): bool
420
    {
421
        return $this->hasMoreIgtvs;
5✔
422
    }
423

424
    /**
425
     * @return string
426
     */
427
    public function getEndCursorIgtvs(): ?string
428
    {
429
        return $this->endCursorIgtvs;
5✔
430
    }
431

432
    /**
433
     * @param string|null $endCursorIgtvs
434
     */
435
    public function setEndCursorIgtvs(?string $endCursorIgtvs): void
436
    {
437
        $this->endCursorIgtvs = $endCursorIgtvs;
5✔
438
    }
1✔
439
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc