Ensure that empty arrays are returned as empty arrays
This commit is contained in:
parent
8868bc3b55
commit
8823cbf9c4
1 changed files with 9 additions and 1 deletions
|
@ -98,6 +98,14 @@ class JsonLDTest extends TestCase
|
||||||
$this->assertSame('', $data);
|
$this->assertSame('', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFetchElementKeyFoundEmptyArray()
|
||||||
|
{
|
||||||
|
$object = ['field' => ['content' => []]];
|
||||||
|
|
||||||
|
$data = JsonLD::fetchElement($object, 'field', 'content');
|
||||||
|
$this->assertSame([], $data);
|
||||||
|
}
|
||||||
|
|
||||||
public function testFetchElementFoundID()
|
public function testFetchElementFoundID()
|
||||||
{
|
{
|
||||||
$object = ['field' => ['field2' => 'value2', '@id' => 'value', 'field3' => 'value3']];
|
$object = ['field' => ['field2' => 'value2', '@id' => 'value', 'field3' => 'value3']];
|
||||||
|
@ -130,7 +138,7 @@ class JsonLDTest extends TestCase
|
||||||
$this->assertNull($data);
|
$this->assertNull($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFetchElementTypeWithoutType()
|
public function testFetchElementKeyWithoutType()
|
||||||
{
|
{
|
||||||
$object = ['source' => ['content' => 'body', 'mediaType' => 'text/bbcode']];
|
$object = ['source' => ['content' => 'body', 'mediaType' => 'text/bbcode']];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue