Added new test for JsonLD::fetchElementArray type matching

This commit is contained in:
Hypolite Petovan 2020-11-11 11:19:27 -05:00
parent fa003eaa84
commit 9e4a0bf212

View file

@ -62,6 +62,7 @@ class JsonLDTest extends TestCase
$data = JsonLD::fetchElementArray($object, 'field', '@id');
self::assertSame(['value3', 'value4'], $data);
}
public function testFetchElementArrayFoundArrays()
{
$object = ['field' => [['subfield11' => 'value11', 'subfield12' => 'value12'],
@ -74,6 +75,17 @@ class JsonLDTest extends TestCase
self::assertSame($expect, $data);
}
public function testFetchElementArrayTypeValue()
{
$object = ['field' => [['subfield11' => 'value11', 'subfield12' => 'value12'],
['subfield21' => 'value21', 'subfield22' => 'value22']]];
$expect = [['subfield11' => 'value11', 'subfield12' => 'value12']];
$data = JsonLD::fetchElementArray($object, 'field', null, 'subfield11', 'value11');
self::assertSame($expect, $data);
}
public function testFetchElementNotFound()
{
$object = [];