@@ -38,9 +38,9 @@ protected function setUp(): void
3838 public function testExpirations_success ()
3939 {
4040 $ mocked_response = [
41- 's ' => 'ok ' ,
42- 'expirations ' => ['2022-09-23 ' , '2022-09-30 ' ],
43- 'updated ' => 1663704000
41+ 's ' => 'ok ' ,
42+ 'expirations ' => ['2022-09-23 ' , '2022-09-30 ' ],
43+ 'updated ' => 1663704000
4444 ];
4545 $ this ->setMockResponses ([new Response (200 , [], json_encode ($ mocked_response ))]);
4646
@@ -60,7 +60,7 @@ public function testExpirations_success()
6060 public function testExpirations_noData_success ()
6161 {
6262 $ mocked_response = [
63- 's ' => 'no_data ' ,
63+ 's ' => 'no_data ' ,
6464 'nextTime ' => 1663704000 ,
6565 'prevTime ' => 1663705000
6666 ];
@@ -70,15 +70,15 @@ public function testExpirations_noData_success()
7070
7171 // Verify that the response is an object of the correct type.
7272 $ this ->assertInstanceOf (Expirations::class, $ response );
73- $ this ->assertFalse ( isset ( $ response ->expirations ) );
73+ $ this ->assertEmpty ( $ response ->expirations );
7474 $ this ->assertEquals (Carbon::parse ($ mocked_response ['nextTime ' ]), $ response ->next_time );
7575 $ this ->assertEquals (Carbon::parse ($ mocked_response ['prevTime ' ]), $ response ->prev_time );
7676 }
7777
7878 public function testLookup_success ()
7979 {
8080 $ mocked_response = [
81- 's ' => 'no_data ' ,
81+ 's ' => 'no_data ' ,
8282 'optionSymbol ' => 'AAPL230728C00200000 ' ,
8383 ];
8484 $ this ->setMockResponses ([new Response (200 , [], json_encode ($ mocked_response ))]);
@@ -92,8 +92,50 @@ public function testLookup_success()
9292
9393 public function testStrikes_success ()
9494 {
95- // Stub
96- $ this ->assertInstanceOf (Strikes::class, $ this ->client ->options ->strikes ());
95+ $ mocked_response = [
96+ 's ' => 'ok ' ,
97+ 'updated ' => 1663704000 ,
98+ 'dates ' => [
99+ '2023-01-20 ' => [
100+ 30.0 ,
101+ 35.0
102+ ]
103+ ]
104+ ];
105+ $ this ->setMockResponses ([new Response (200 , [], json_encode ($ mocked_response ))]);
106+
107+ $ response = $ this ->client ->options ->strikes (
108+ symbol: 'AAPL ' ,
109+ expiration: Carbon::parse ('2023-01-20 ' ),
110+ date: Carbon::parse ('2023-01-03 ' ),
111+ );
112+
113+ // Verify that the response is an object of the correct type.
114+ $ this ->assertInstanceOf (Strikes::class, $ response );
115+ $ this ->assertEquals (Carbon::parse ($ mocked_response ['updated ' ]), $ response ->updated );
116+ $ this ->assertEquals ((array )$ mocked_response ['dates ' ], $ response ->dates );
117+ }
118+
119+ public function testStrikes_noData_success ()
120+ {
121+ $ mocked_response = [
122+ 's ' => 'no_data ' ,
123+ 'nextTime ' => 1663704000 ,
124+ 'prevTime ' => 1663705000
125+ ];
126+ $ this ->setMockResponses ([new Response (200 , [], json_encode ($ mocked_response ))]);
127+
128+ $ response = $ this ->client ->options ->strikes (
129+ symbol: 'AAPL ' ,
130+ expiration: Carbon::parse ('2023-01-20 ' ),
131+ date: Carbon::parse ('2023-01-03 ' ),
132+ );
133+
134+ // Verify that the response is an object of the correct type.
135+ $ this ->assertInstanceOf (Strikes::class, $ response );
136+ $ this ->assertEmpty ($ response ->dates );
137+ $ this ->assertEquals (Carbon::parse ($ mocked_response ['nextTime ' ]), $ response ->next_time );
138+ $ this ->assertEquals (Carbon::parse ($ mocked_response ['prevTime ' ]), $ response ->prev_time );
97139 }
98140
99141 public function testQuotes_success ()
0 commit comments