Skip to content

Commit 2188d01

Browse files
committed
Issue #82: fix the wrapping if dataset is empty
1 parent 7c79952 commit 2188d01

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Api/Operator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ protected function _getItems($structClass, $infoTag, $field = null, $value = nul
9393
if (!is_null($filter) && !$filter($xmlResult->data->$infoTag)) {
9494
continue;
9595
}
96+
if (!isset($xmlResult->data) || !isset($xmlResult->data->$infoTag)) {
97+
continue;
98+
}
9699
$items[] = new $structClass($xmlResult->data->$infoTag);
97100
}
98101

tests/SiteTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,10 @@ public function testGetAll()
104104
static::$_client->site()->delete('id', $site->id);
105105
static::$_client->site()->delete('id', $site2->id);
106106
}
107+
108+
public function testGetAllWithoutSites()
109+
{
110+
$sitesInfo = static::$_client->site()->getAll();
111+
$this->assertEmpty($sitesInfo);
112+
}
107113
}

0 commit comments

Comments
 (0)