From: Michael Date: Sun, 7 Jun 2020 08:24:08 +0000 (+0000) Subject: Two more tests X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1f36c655e13ed84cdd9c93f427f3c6d3c78891af;p=friendica.git Two more tests --- diff --git a/tests/src/Util/JSonLDTest.php b/tests/src/Util/JSonLDTest.php index a8d4467f5f..1d9ebdc598 100644 --- a/tests/src/Util/JSonLDTest.php +++ b/tests/src/Util/JSonLDTest.php @@ -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'],