File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 22
33use PHPUnit \Framework \TestCase ;
44use hmerritt \Imdb ;
5+ use hmerritt \Response ;
56
67class ImdbTest extends TestCase {
78
@@ -42,4 +43,22 @@ public function testFilmOptions()
4243 $ this ->assertEquals (0 , count ($ film ['technical_specs ' ]));
4344 }
4445
46+ public function test404Page ()
47+ {
48+ $ imdb = new Imdb ;
49+ $ response = new Response ;
50+
51+ $ film = $ imdb ->film ('ttest404 ' );
52+ $ search = $ imdb ->search ('ttest404040404004 ' , [ 'category ' => 'test404 ' ]);
53+
54+ $ emptyResponse = [
55+ 'film ' => $ response ->default ('film ' ),
56+ 'search ' => $ response ->default ('search ' ),
57+ ];
58+ $ emptyResponse ['film ' ]['id ' ] = 'ttest404 ' ;
59+
60+ $ this ->assertEquals ($ emptyResponse ['film ' ], $ film );
61+ $ this ->assertEquals ($ emptyResponse ['search ' ], $ search );
62+ }
63+
4564}
Original file line number Diff line number Diff line change 1414// Initialise Imdb
1515// Load film data
1616$ imdb = new Imdb ();
17- $ film = $ imdb ->film ($ q ); // tt0816692 tt8633464
17+ $ film = $ imdb ->search ($ q ); // tt0816692 tt8633464
1818
1919// Return loaded film data
2020echo json_encode ($ film , JSON_PRETTY_PRINT );
You can’t perform that action at this time.
0 commit comments