Merge pull request #9526 from MrPetovan/bug/9525-mastodon-emojis-tag

Restore expected implementation of JsonLD::fetchElementArray
This commit is contained in:
Michael Vogel 2020-11-12 05:47:46 +01:00 committed by GitHub
commit acae3df0a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 10 deletions

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 = [];