From 8823cbf9c4062f5ba62a2512ccf82f043f4d310f Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sun, 7 Jun 2020 08:49:53 +0000
Subject: [PATCH] Ensure that empty arrays are returned as empty arrays

---
 tests/src/Util/JSonLDTest.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tests/src/Util/JSonLDTest.php b/tests/src/Util/JSonLDTest.php
index 41fb93bbe3..94c7952b5c 100644
--- a/tests/src/Util/JSonLDTest.php
+++ b/tests/src/Util/JSonLDTest.php
@@ -98,6 +98,14 @@ class JsonLDTest extends TestCase
 		$this->assertSame('', $data);
 	}
 
+	public function testFetchElementKeyFoundEmptyArray()
+	{
+		$object = ['field' => ['content' => []]];
+
+		$data = JsonLD::fetchElement($object, 'field', 'content');
+		$this->assertSame([], $data);
+	}
+
 	public function testFetchElementFoundID()
 	{
 		$object = ['field' => ['field2' => 'value2', '@id' => 'value', 'field3' => 'value3']];
@@ -130,7 +138,7 @@ class JsonLDTest extends TestCase
 		$this->assertNull($data);
 	}
 
-	public function testFetchElementTypeWithoutType()
+	public function testFetchElementKeyWithoutType()
 	{
 		$object = ['source' => ['content' => 'body', 'mediaType' => 'text/bbcode']];
 
-- 
2.39.5