@@ -111,6 +111,9 @@ public function shouldBeFunctional()
111111 $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ this ->movie ->getSimilar ());
112112 $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ this ->movie ->getRecommendations ());
113113 $ this ->assertInstanceOf ('Tmdb\Model\Collection\Videos ' , $ this ->movie ->getVideos ());
114+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ this ->movie ->getWatchProviders ());
115+ $ this ->assertInstanceOf ('Tmdb\Model\Watch\Providers ' , $ this ->movie ->getWatchProviders ()->get ('US ' ));
116+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ this ->movie ->getWatchProviders ()->get ('US ' )->getFlatrate ());
114117
115118 /** @var Release[] $releases */
116119 $ releases = $ this ->movie ->getReleases ()->getAll ();
@@ -125,6 +128,33 @@ public function shouldBeFunctional()
125128 $ this ->assertInstanceOf (\DateTime::class, $ release_date ->getReleaseDate ());
126129 $ this ->assertTrue (is_int ($ release_date ->getType ()));
127130 }
131+
132+ $ watchProviders = $ this ->movie ->getWatchProviders ();
133+ $ this ->assertEquals (38 , count ($ watchProviders ));
134+ foreach ($ watchProviders as $ countryCode => $ countryWatchProviders ) {
135+ $ this ->assertEquals ($ countryCode , $ countryWatchProviders ->getIso31661 ());
136+ $ this ->assertNotEmpty ($ countryWatchProviders ->getLink ());
137+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ countryWatchProviders ->getFlatrate ());
138+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ countryWatchProviders ->getRent ());
139+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ countryWatchProviders ->getBuy ());
140+
141+ $ watchProvidersByType = [
142+ 'flatrate ' => $ countryWatchProviders ->getFlatrate (),
143+ 'rent ' => $ countryWatchProviders ->getRent (),
144+ 'buy ' => $ countryWatchProviders ->getBuy (),
145+ ];
146+
147+ foreach ($ watchProvidersByType as $ type => $ typeWatchProviders ) {
148+ foreach ($ typeWatchProviders as $ watchProvider ) {
149+ $ this ->assertEquals ($ countryCode , $ watchProvider ->getIso31661 ());
150+ $ this ->assertTrue (is_int ($ watchProvider ->getId ()));
151+ $ this ->assertNotEmpty ($ watchProvider ->getName ());
152+ $ this ->assertNotEmpty ($ watchProvider ->getLogoPath ());
153+ $ this ->assertTrue (is_int ($ watchProvider ->getDisplayPriority ()));
154+ $ this ->assertEquals ($ type , $ watchProvider ->getType ());
155+ }
156+ }
157+ }
128158 }
129159
130160 /**
0 commit comments