Skip to content

Commit 9d134fb

Browse files
committed
Fix #116: correct handling of empty resellers list
1 parent ce25ff4 commit 9d134fb

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/Api/Operator/Reseller.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ public function getAll($field = null, $value = null): array
6969

7070
$items = [];
7171
foreach ($response->xpath('//result') as $xmlResult) {
72+
if (!$xmlResult->data) {
73+
continue;
74+
}
75+
7276
$item = new Struct\GeneralInfo($xmlResult->data);
7377
$item->id = (int) $xmlResult->id;
7478
$items[] = $item;

tests/CustomerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ public function testGetAll()
8585
static::$client->customer()->delete('login', 'customer-b');
8686
}
8787

88+
public function testGetAllEmpty()
89+
{
90+
$customersInfo = static::$client->customer()->getAll();
91+
$this->assertCount(0, $customersInfo);
92+
}
93+
8894
public function testEnable()
8995
{
9096
$customer = static::$client->customer()->create($this->customerProperties);

tests/ResellerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,10 @@ public function testGetAll()
7474
static::$client->reseller()->delete('login', 'reseller-a');
7575
static::$client->reseller()->delete('login', 'reseller-b');
7676
}
77+
78+
public function testGetAllEmpty()
79+
{
80+
$resellersInfo = static::$client->reseller()->getAll();
81+
$this->assertCount(0, $resellersInfo);
82+
}
7783
}

0 commit comments

Comments
 (0)