From 699429ab08071cb2be3a107224f6398cab91b094 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 Jun 2020 14:16:27 +0000 Subject: [PATCH] Added test for fetching arrays --- tests/src/Util/JSonLDTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/src/Util/JSonLDTest.php b/tests/src/Util/JSonLDTest.php index 1cb1bb1f9..617e771f4 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 = [];