]> git.mxchange.org Git - friendica.git/commitdiff
Ensure that empty arrays are returned as empty arrays
authorMichael <heluecht@pirati.ca>
Sun, 7 Jun 2020 08:49:53 +0000 (08:49 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Jun 2020 08:49:53 +0000 (08:49 +0000)
tests/src/Util/JSonLDTest.php

index 41fb93bbe345e37f937c88eddc915034f417fdd6..94c7952b5caa28d8e055b0d5e9aa114f42b27336 100644 (file)
@@ -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']];