1111use Devscast \Pexels \Data \Photo ;
1212use Devscast \Pexels \Data \Photos ;
1313use Devscast \Pexels \Data \Videos ;
14+ use Devscast \Pexels \Data \Collection ;
1415use Devscast \Pexels \Data \Collections ;
1516use Devscast \Pexels \Data \CollectionMedia ;
1617use Symfony \Component \HttpClient \MockHttpClient ;
17- use Symfony \Contracts \HttpClient \HttpClientInterface ;
1818use Symfony \Component \HttpClient \Response \MockResponse ;
1919
2020/**
@@ -48,6 +48,7 @@ public function testSearchPhotos(): void
4848 $ photos = $ pexels ->searchPhotos ('westie dog ' );
4949
5050 $ this ->assertInstanceOf (Photos::class, $ photos );
51+ $ this ->assertContainsOnlyInstancesOf (Photo::class, $ photos ->photos );
5152 }
5253
5354 public function testSearchVideos (): void
@@ -57,6 +58,7 @@ public function testSearchVideos(): void
5758 $ videos = $ pexels ->searchVideos ('westie dog ' );
5859
5960 $ this ->assertInstanceOf (Videos::class, $ videos );
61+ $ this ->assertContainsOnlyInstancesOf (Video::class, $ videos ->videos );
6062 }
6163
6264 public function testPhoto (): void
@@ -84,6 +86,7 @@ public function testPopularVideos(): void
8486 $ videos = $ pexels ->popularVideos ();
8587
8688 $ this ->assertInstanceOf (Videos::class, $ videos );
89+ $ this ->assertContainsOnlyInstancesOf (Video::class, $ videos ->videos );
8790 }
8891
8992 public function curatedPhotos (): void
@@ -93,6 +96,7 @@ public function curatedPhotos(): void
9396 $ photos = $ pexels ->curatedPhotos ();
9497
9598 $ this ->assertInstanceOf (Photos::class, $ photos );
99+ $ this ->assertContainsOnlyInstancesOf (Photo::class, $ photos ->photos );
96100 }
97101
98102 public function testFeaturedCollections (): void
@@ -102,6 +106,7 @@ public function testFeaturedCollections(): void
102106 $ collections = $ pexels ->featuredCollections ();
103107
104108 $ this ->assertInstanceOf (Collections::class, $ collections );
109+ $ this ->assertContainsOnlyInstancesOf (Collection::class, $ collections ->collections );
105110 }
106111
107112 public function testCollections (): void
@@ -111,6 +116,7 @@ public function testCollections(): void
111116 $ collections = $ pexels ->collections ();
112117
113118 $ this ->assertInstanceOf (Collections::class, $ collections );
119+ $ this ->assertContainsOnlyInstancesOf (Collection::class, $ collections ->collections );
114120 }
115121
116122 public function testCollection (): void
@@ -120,5 +126,14 @@ public function testCollection(): void
120126 $ collections = $ pexels ->collection ("33 " );
121127
122128 $ this ->assertInstanceOf (CollectionMedia::class, $ collections );
129+ foreach ($ collections ->media as $ media ) {
130+ if ('photo ' === $ media ->type ) {
131+ $ this ->assertInstanceOf (Photo::class, $ media );
132+ }
133+
134+ if ('video ' === $ media ->type ) {
135+ $ this ->assertInstanceOf (Video::class, $ media );
136+ }
137+ }
123138 }
124139}
0 commit comments