Test nested object field access

This commit is contained in:
Jeremy Dormitzer 2018-12-12 13:26:39 -05:00
parent bc06810432
commit c3a7e89713

View File

@ -1134,5 +1134,25 @@ class ObjectsServiceTest extends SQLiteTestCase
$this->expectException( BadMethodCallException::class );
unset( $object['content'] );
}
public function testNestedObjectArrayAccess()
{
$fields = array(
'id' => 'https://example.com/notes/1',
'type' => 'Note',
'content' => 'This is a note',
'attributedTo' => array(
'id' => 'https://example.com/actor/1'
),
);
$now = $this->getTime( 'create' );
$object = $this->objectsService->createObject( $fields );
$this->assertEquals( $object['content'], 'This is a note' );
$this->assertInstanceOf( ActivityPubObject::class, $object['attributedTo'] );
$this->assertEquals(
$object['attributedTo']['id'], 'https://example.com/actor/1'
);
}
}
?>