33
44namespace TK \Test \Unit \Factory ;
55
6+ use TK \SDK \Exception \InvalidArgumentException ;
67use TK \SDK \ValueObject \Factory \CalculateAwardMilesWithTaxParametersFactory ;
78use TK \SDK \ValueObject \CalculateAwardMilesWithTaxParameters ;
89
@@ -26,7 +27,7 @@ protected function _after()
2627 * @test
2728 * @throws \Exception
2829 */
29- public function shouldReturnCalculateAwardMilesWithTaxParameters () : void
30+ public function shouldReturnCalculateAwardMilesWithTaxParametersObjectSuccessfully () : void
3031 {
3132 $ json =<<<JSON
3233{
@@ -44,4 +45,46 @@ public function shouldReturnCalculateAwardMilesWithTaxParameters() : void
4445 $ this ->assertInstanceOf (CalculateAwardMilesWithTaxParameters::class, $ parameterObject );
4546 $ this ->assertEquals (json_decode ($ json , true ), $ parameterObject ->getValue ());
4647 }
48+
49+ /**
50+ * @test
51+ */
52+ public function shouldFailForInvalidAwardTypeSuccessfully () : void
53+ {
54+ $ this ->expectException (InvalidArgumentException::class);
55+ $ json =<<<JSON
56+ {
57+ "awardType": "Z",
58+ "wantMoreMiles": "T",
59+ "isOneWay": "T",
60+ "departureOrigin": "IST",
61+ "departureDestination": "FRA",
62+ "departureDateDay": 12,
63+ "departureDateMonth": 11,
64+ "departureDateYear": 2017
65+ }
66+ JSON ;
67+ $ parameterObject = CalculateAwardMilesWithTaxParametersFactory::createFromJson ($ json );
68+ }
69+
70+ /**
71+ * @test
72+ */
73+ public function shouldFailForInvalidIataCodeSuccessfully () : void
74+ {
75+ //$this->expectException(InvalidArgumentException::class);
76+ $ json =<<<JSON
77+ {
78+ "awardType": "E",
79+ "wantMoreMiles": "T",
80+ "isOneWay": "T",
81+ "departureOrigin": "ICAO",
82+ "departureDestination": "FRA",
83+ "departureDateDay": 12,
84+ "departureDateMonth": 11,
85+ "departureDateYear": 2017
86+ }
87+ JSON ;
88+ $ parameterObject = CalculateAwardMilesWithTaxParametersFactory::createFromJson ($ json );
89+ }
4790}
0 commit comments