Skip to content
Snippets Groups Projects
Commit a9542d6c authored by Demian Katz's avatar Demian Katz
Browse files

Merge branch 'release-4.1'

parents 6874c279 2a599827
Branches
Tags
No related merge requests found
...@@ -107,8 +107,10 @@ class Backend extends AbstractBackend ...@@ -107,8 +107,10 @@ class Backend extends AbstractBackend
$e $e
); );
} }
// Use array_values and array_filter to strip any nulls out of the
// response (these are present sometimes due to an apparent API bug)
$results = isset($response['data']) && is_array($response['data']) $results = isset($response['data']) && is_array($response['data'])
? $response['data'] : []; ? array_values(array_filter($response['data'])) : [];
$collection = $this->createRecordCollection( $collection = $this->createRecordCollection(
[ [
'offset' => $offset, 'offset' => $offset,
......
...@@ -49,7 +49,7 @@ class RecordCollectionFactoryTest extends TestCase ...@@ -49,7 +49,7 @@ class RecordCollectionFactoryTest extends TestCase
*/ */
public function testFactory() public function testFactory()
{ {
$resp = ['data' => [[], [], []]]; $resp = ['data' => [['id' => 1], ['id' => 2], ['id' => 3]]];
$fact = new RecordCollectionFactory(); $fact = new RecordCollectionFactory();
$coll = $fact->factory($resp); $coll = $fact->factory($resp);
$this->assertEquals(3, count($coll)); $this->assertEquals(3, count($coll));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment