Skip to content

Commit 00b10e5

Browse files
committed
Expand test to cover the non-JSON format
Make sure the change does not break the non-JSON version of the output.
1 parent fe9db94 commit 00b10e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/Mf2/CombinedMicroformatsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,16 @@ public function testMf2DoesNotParseRelTag() {
423423
*/
424424
public function testEmptyPropertiesObjectInJSONMode() {
425425
$input = '<div class="h-feed"><div class="h-entry"></div></div>';
426+
// Try in JSON-mode: expect the raw PHP to be an stdClass instance that serializes to an empty object.
426427
$parser = new Parser($input, null, true);
427428
$output = $parser->parse();
428429
$this->assertInstanceOf('\stdClass', $output['items'][0]['properties']);
429430
$this->assertSame('{}', json_encode($output['items'][0]['properties']));
431+
// Repeat in non-JSON-mode: expect the raw PHP to be an array. Check that its serialization is not what we need for mf2 JSON.
432+
$parser = new Parser($input, null, false);
433+
$output = $parser->parse();
434+
$this->assertInternalType('array', $output['items'][0]['properties']);
435+
$this->assertSame('[]', json_encode($output['items'][0]['properties']));
430436
}
431437

432438
}

0 commit comments

Comments
 (0)