Added new test for JsonLD::fetchElementArray type matching
This commit is contained in:
parent
fa003eaa84
commit
9e4a0bf212
|
@ -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 = [];
|
||||
|
|
Loading…
Reference in a new issue