@@ -39,4 +39,38 @@ public function shouldGetResponseSuccessfully() : void
3939 $ this ->assertEquals ('SUCCESS ' , $ response ['response ' ]['status ' ]);
4040 $ this ->assertEquals ('TK-0000 ' , $ response ['response ' ]['code ' ]);
4141 }
42+
43+
44+ /**
45+ * @test
46+ * @expectedException \TK\SDK\Exception\InvalidArgumentException
47+ */
48+ public function shouldFailForInvalidAirportCode () : void
49+ {
50+ $ departureTime = gmdate ('Y-m-d H:i:s ' , strtotime ('+4 days ' ));
51+ $ originLocation = new ValueObject \Location ('IST ' , ValueObject \Location::MULTIPLE_AIRPORT_TRUE );
52+ $ destinationLocation = new ValueObject \Location ('JFK ' , ValueObject \Location::MULTIPLE_AIRPORT_TRUE );
53+ $ departureDateTime = new ValueObject \DepartureDateTime (
54+ new DateTimeImmutable ($ departureTime ),
55+ 'P3D ' ,
56+ 'P3D '
57+ );
58+ $ originDestinationInformation = new ValueObject \OriginDestinationInformation (
59+ $ departureDateTime ,
60+ $ originLocation ,
61+ $ destinationLocation
62+ );
63+ $ airScheduleRQ = (new ValueObject \AirScheduleRQ ($ originDestinationInformation ))
64+ ->withAirlineCode ('MK ' )
65+ ->withDirectAndNonStopOnlyInd ();
66+ $ getTimetableParameters = new ValueObject \GetTimetableParameters (
67+ $ airScheduleRQ ,
68+ ValueObject \GetTimetableParameters::SCHEDULE_TYPE_WEEKLY ,
69+ ValueObject \GetTimetableParameters::TRIP_TYPE_ONE_WAY
70+ );
71+ $ response = $ this ->client ->getTimetable ($ getTimetableParameters );
72+ $ this ->assertEquals (200 , $ response ['status ' ]);
73+ $ this ->assertEquals ('SUCCESS ' , $ response ['response ' ]['status ' ]);
74+ $ this ->assertEquals ('TK-0000 ' , $ response ['response ' ]['code ' ]);
75+ }
4276}
0 commit comments