Skip to content

Commit ccb37de

Browse files
committed
make /_api/aqlfunctions a bit more forwards-compatible
1 parent 5c71768 commit ccb37de

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/ArangoDBClient/AqlUserFunction.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ public function getRegisteredUserFunctions($namespace = null)
195195
}
196196
$response = $this->_connection->get($url);
197197

198-
return $response->getJson();
198+
$data = $response->getJson();
199+
if (isset($data['result'])) {
200+
return $data['result'];
201+
}
202+
return $data;
199203
}
200204

201205

tests/AqlUserFunctionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function filter($list)
6262
{
6363
$result = [];
6464
foreach ($list as $value) {
65-
if (strpos($value['name'], 'phpTestFunctions') === 0) {
65+
if (strpos(@$value['name'], 'phpTestFunctions') === 0) {
6666
$result[] = $value;
6767
}
6868
}
@@ -93,7 +93,6 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithInitialConfig()
9393
);
9494
$list = $this->filter($userFunction->getRegisteredUserFunctions());
9595

96-
9796
static::assertCount(1, $list, 'List returned did not return expected 1 attribute (This might happen, if tests are run in parallel)');
9897
static::assertTrue(
9998
$list[0]['name'] === $name && $list[0]['code'] === $code,

0 commit comments

Comments
 (0)