]> git.mxchange.org Git - friendica.git/commitdiff
Two more tests
authorMichael <heluecht@pirati.ca>
Sun, 7 Jun 2020 08:24:08 +0000 (08:24 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Jun 2020 08:24:08 +0000 (08:24 +0000)
tests/src/Util/JSonLDTest.php

index a8d4467f5ffbdbf93bf000afe44ad2189eab6669..1d9ebdc59819424facb5f5481bccf3662bb758af 100644 (file)
@@ -114,6 +114,22 @@ class JsonLDTest extends TestCase
                $this->assertSame('body', $data);
        }
 
+       public function testFetchElementTypeNotFound()
+       {
+               $object = ['source' => ['content' => 'body', 'mediaType' => 'text/html']];
+
+               $data = JsonLD::fetchElement($object, 'source', 'content', 'mediaType', 'text/bbcode');
+               $this->assertNull($data);
+       }
+
+       public function testFetchElementTypeWithoutType()
+       {
+               $object = ['source' => ['content' => 'body', 'mediaType' => 'text/bbcode']];
+
+               $data = JsonLD::fetchElement($object, 'source', 'content');
+               $this->assertSame('body', $data);
+       }
+
        public function testFetchElementTypeArray()
        {
                $object = ['source' => [['content' => 'body2', 'mediaType' => 'text/html'],