From: Michael Date: Sat, 6 Jun 2020 14:16:27 +0000 (+0000) Subject: Added test for fetching arrays X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=699429ab08071cb2be3a107224f6398cab91b094;p=friendica.git Added test for fetching arrays --- diff --git a/tests/src/Util/JSonLDTest.php b/tests/src/Util/JSonLDTest.php index 1cb1bb1f9b..617e771f49 100644 --- a/tests/src/Util/JSonLDTest.php +++ b/tests/src/Util/JSonLDTest.php @@ -37,6 +37,15 @@ class JsonLDTest extends TestCase $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() { $object = [];