Skip to content

Commit 4e1ac23

Browse files
authored
Added three getter methods for values returned in the Standard Insights API (#247)
* Added three extra values as methods for Insights standard API response * Updated Insights Standard PHPUnit test to test for the new values returned
1 parent 54068b2 commit 4e1ac23

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/Insights/Standard.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ public function getPorted()
1818
return $this->data['ported'];
1919
}
2020

21+
public function getRefundPrice()
22+
{
23+
return $this->data['refund_price'];
24+
}
25+
26+
public function getRequestPrice()
27+
{
28+
return $this->data['request_price'];
29+
}
30+
31+
public function getRemainingBalance()
32+
{
33+
return $this->data['remaining_balance'];
34+
}
35+
2136
public function getRoaming()
2237
{
2338
return $this->data['roaming'];

test/Insights/StandardTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class StandardTest extends TestCase
2020
*/
2121
public function testArrayAccess($standard, $inputData)
2222
{
23+
$this->assertEquals($inputData['refund_price'], @$standard['refund_price']);
24+
$this->assertEquals($inputData['request_price'], @$standard['request_price']);
25+
$this->assertEquals($inputData['remaining_balance'], @$standard['remaining_balance']);
2326
$this->assertEquals($inputData['current_carrier'], @$standard['current_carrier']);
2427
$this->assertEquals($inputData['original_carrier'], @$standard['original_carrier']);
2528
$this->assertEquals($inputData['ported'], @$standard['ported']);
@@ -31,6 +34,9 @@ public function testArrayAccess($standard, $inputData)
3134
*/
3235
public function testObjectAccess($standard, $inputData)
3336
{
37+
$this->assertEquals($inputData['refund_price'], @$standard->getRefundPrice());
38+
$this->assertEquals($inputData['request_price'], @$standard->getRequestPrice());
39+
$this->assertEquals($inputData['remaining_balance'], @$standard->getRemainingBalance());
3440
$this->assertEquals($inputData['current_carrier'], $standard->getCurrentCarrier());
3541
$this->assertEquals($inputData['original_carrier'], $standard->getOriginalCarrier());
3642
$this->assertEquals($inputData['ported'], $standard->getPorted());
@@ -57,6 +63,9 @@ public function standardTestProvider()
5763
'network_type' => 'mobile',
5864
],
5965
'ported' => 'assumed_ported',
66+
'request_price' => '0.00500000',
67+
'refund_price' => '0.00500000',
68+
'remaining_balance' => '26.294675',
6069
'roaming' =>
6170
[
6271
'status' => 'unknown',

test/Insights/responses/standard.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"country_name": "United Kingdom",
1010
"country_prefix": "44",
1111
"request_price": "0.00500000",
12+
"refund_price": "0.00500000",
1213
"remaining_balance": "26.294675",
1314
"current_carrier": {
1415
"network_code": "23420",
@@ -26,4 +27,4 @@
2627
"roaming": {
2728
"status": "unknown"
2829
}
29-
}
30+
}

0 commit comments

Comments
 (0)