From 1f36c655e13ed84cdd9c93f427f3c6d3c78891af Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 7 Jun 2020 08:24:08 +0000 Subject: [PATCH] Two more tests --- tests/src/Util/JSonLDTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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'], -- 2.39.5