@@ -128,6 +128,37 @@ public function shouldBeFunctional()
128128
129129 $ this ->assertEquals ('US ' , $ usContentRating ->getIso31661 ());
130130 $ this ->assertEquals ('TV-MA ' , $ usContentRating ->getRating ());
131+
132+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ this ->tv ->getWatchProviders ());
133+ $ this ->assertInstanceOf ('Tmdb\Model\Watch\Providers ' , $ this ->tv ->getWatchProviders ()->get ('US ' ));
134+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ this ->tv ->getWatchProviders ()->get ('US ' )->getFlatrate ());
135+
136+ $ watchProviders = $ this ->tv ->getWatchProviders ();
137+ $ this ->assertEquals (46 , count ($ watchProviders ));
138+ foreach ($ watchProviders as $ countryCode => $ countryWatchProviders ) {
139+ $ this ->assertEquals ($ countryCode , $ countryWatchProviders ->getIso31661 ());
140+ $ this ->assertNotEmpty ($ countryWatchProviders ->getLink ());
141+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ countryWatchProviders ->getFlatrate ());
142+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ countryWatchProviders ->getRent ());
143+ $ this ->assertInstanceOf ('Tmdb\Model\Common\GenericCollection ' , $ countryWatchProviders ->getBuy ());
144+
145+ $ watchProvidersByType = [
146+ 'flatrate ' => $ countryWatchProviders ->getFlatrate (),
147+ 'rent ' => $ countryWatchProviders ->getRent (),
148+ 'buy ' => $ countryWatchProviders ->getBuy (),
149+ ];
150+
151+ foreach ($ watchProvidersByType as $ type => $ typeWatchProviders ) {
152+ foreach ($ typeWatchProviders as $ watchProvider ) {
153+ $ this ->assertEquals ($ countryCode , $ watchProvider ->getIso31661 ());
154+ $ this ->assertTrue (is_int ($ watchProvider ->getId ()));
155+ $ this ->assertNotEmpty ($ watchProvider ->getName ());
156+ $ this ->assertNotEmpty ($ watchProvider ->getLogoPath ());
157+ $ this ->assertTrue (is_int ($ watchProvider ->getDisplayPriority ()));
158+ $ this ->assertEquals ($ type , $ watchProvider ->getType ());
159+ }
160+ }
161+ }
131162 }
132163
133164 /**
0 commit comments