Added test for fetching arrays

This commit is contained in:
Michael 2020-06-06 14:16:27 +00:00
parent 95d997c79d
commit 699429ab08

View File

@ -37,6 +37,15 @@ class JsonLDTest extends TestCase
$this->assertNull($data); $this->assertNull($data);
} }
public function testFetchElementArrayFoundID()
{
$object = ['field' => ['value1', ['@id' => 'value2'], ['@id' => 'value3']]];
$data = JsonLD::fetchElementArray($object, 'field', '@id');
$this->assertSame(['value1', 'value2', 'value3'], $data);
}
public function testFetchElementNotFound() public function testFetchElementNotFound()
{ {
$object = []; $object = [];