File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
tests/Nexmo/Voice/Message Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ class Callback extends BaseCallback implements CallbackInterface
2020 'to ' ,
2121 'call-request ' ,
2222 'network-code ' ,
23- 'call-start ' ,
24- 'call-end '
2523 );
2624
2725 public function getId ()
@@ -61,11 +59,19 @@ public function getCreated()
6159
6260 public function getStart ()
6361 {
62+ if (!isset ($ this ->data ['call-start ' ])){
63+ return null ;
64+ }
65+
6466 return \DateTime::createFromFormat (self ::TIME_FORMAT , $ this ->data ['call-start ' ]);
6567 }
6668
6769 public function getEnd ()
6870 {
71+ if (!isset ($ this ->data ['call-end ' ])){
72+ return null ;
73+ }
74+
6975 return \DateTime::createFromFormat (self ::TIME_FORMAT , $ this ->data ['call-end ' ]);
7076 }
7177
Original file line number Diff line number Diff line change @@ -39,6 +39,16 @@ public function testSimpleValues()
3939 $ this ->assertEquals ($ this ->data ['to ' ], $ this ->callback ->getTo ());
4040 $ this ->assertEquals ($ this ->data ['network-code ' ], $ this ->callback ->getNetwork ());
4141 }
42+ public function testStartAndEndOptional ()
43+ {
44+ unset($ this ->data ['call-start ' ]);
45+ unset($ this ->data ['call-end ' ]);
46+
47+ $ this ->callback = new Callback ($ this ->data );
48+
49+ $ this ->assertNull ($ this ->callback ->getStart ());
50+ $ this ->assertNull ($ this ->callback ->getEnd ());
51+ }
4252
4353 public function testDateValues ()
4454 {
You can’t perform that action at this time.
0 commit comments