eventDispatcher = new EventDispatcher(); $objectsService = $this->getMock( ObjectsService::class ); $idProvider = $this->getMock( IdProvider::class ); // TODO provision mocks $collectionsService = new CollectionsService( 4, $this->getMock( AuthService::class ), new ContextProvider(), $this->getMock( Client::class ), new SimpleDateTimeProvider(), $this->getMock( EntityManager::class ), $objectsService ); $createHandler = new CreateHandler( $objectsService, $idProvider, $collectionsService ); $this->eventDispatcher->addSubscriber( $createHandler ); } public function provideTestCreateHandler() { return array( array( array( 'id' => 'basicInboxTest', 'eventName' => InboxActivityEvent::NAME, 'event' => new InboxActivityEvent( array( 'id' => 'https://elsewhere.com/activities/1', 'type' => 'Create', 'actor' => 'https://elsewhere.com/actors/1', 'object' => array( 'id' => 'https://elsewhere.com/objects/1', 'type' => 'Note', ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://elsewhere.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/inbox', Request::METHOD_POST ) ), 'expectedEvent' => new InboxActivityEvent( array( 'id' => 'https://elsewhere.com/activities/1', 'type' => 'Create', 'actor' => 'https://elsewhere.com/actors/1', 'object' => array( 'id' => 'https://elsewhere.com/objects/1', 'type' => 'Note', ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://elsewhere.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/inbox', Request::METHOD_POST ) ), ) ), array( array( 'id' => 'basicOutboxTest', 'eventName' => OutboxActivityEvent::NAME, 'event' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Create', 'actor' => array( 'id' => 'https://example.com/actors/1' ), 'object' => array( 'id' => 'https://example.com/objects/1', 'type' => 'Note', ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/outbox', Request::METHOD_POST ) ), 'expectedEvent' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Create', 'actor' => array( 'id' => 'https://example.com/actors/1', ), 'object' => array( 'id' => 'https://example.com/objects/1', 'type' => 'Note', 'attributedTo' => 'https://example.com/actors/1' ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/outbox', Request::METHOD_POST ) ), ) ), array( array( 'id' => 'copiesAudienceOutboxTest', 'eventName' => OutboxActivityEvent::NAME, 'event' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Create', 'to' => 'https://www.w3.org/ns/activitystreams#Public', 'cc' => array( 'https://elsewhere.com/actors/2' ), 'audience' => 'https://elsewhere.com/actors/4', 'actor' => array( 'id' => 'https://example.com/actors/1' ), 'object' => array( 'id' => 'https://example.com/objects/1', 'type' => 'Note', 'to' => 'https://elsewhere.com/actors/1', 'cc' => 'https://elsewhere.com/actors/3', 'audience' => array( 'https://elsewhere.com/actors/5' ) ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/outbox', Request::METHOD_POST ) ), 'expectedEvent' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Create', 'to' => array( 'https://elsewhere.com/actors/1', 'https://www.w3.org/ns/activitystreams#Public', ), 'cc' => array( 'https://elsewhere.com/actors/2', 'https://elsewhere.com/actors/3', ), 'audience' => array( 'https://elsewhere.com/actors/5', 'https://elsewhere.com/actors/4', ), 'actor' => array( 'id' => 'https://example.com/actors/1', ), 'object' => array( 'id' => 'https://example.com/objects/1', 'type' => 'Note', 'attributedTo' => 'https://example.com/actors/1', 'to' => array( 'https://elsewhere.com/actors/1', 'https://www.w3.org/ns/activitystreams#Public', ), 'cc' => array( 'https://elsewhere.com/actors/2', 'https://elsewhere.com/actors/3', ), 'audience' => array( 'https://elsewhere.com/actors/5', 'https://elsewhere.com/actors/4', ), ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/outbox', Request::METHOD_POST ) ), ) ), array( array( 'id' => 'moreCopiesAudienceOutboxTest', 'eventName' => OutboxActivityEvent::NAME, 'event' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Create', 'to' => 'https://www.w3.org/ns/activitystreams#Public', 'cc' => array( 'https://elsewhere.com/actors/2' ), 'actor' => array( 'id' => 'https://example.com/actors/1' ), 'object' => array( 'id' => 'https://example.com/objects/1', 'type' => 'Note', 'cc' => array( 'https://elsewhere.com/actors/3' ), 'audience' => 'https://elsewhere.com/actors/5', ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/outbox', Request::METHOD_POST ) ), 'expectedEvent' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Create', 'to' => 'https://www.w3.org/ns/activitystreams#Public', 'cc' => array( 'https://elsewhere.com/actors/2', 'https://elsewhere.com/actors/3', ), 'audience' => 'https://elsewhere.com/actors/5', 'actor' => array( 'id' => 'https://example.com/actors/1', ), 'object' => array( 'id' => 'https://example.com/objects/1', 'type' => 'Note', 'attributedTo' => 'https://example.com/actors/1', 'to' => 'https://www.w3.org/ns/activitystreams#Public', 'cc' => array( 'https://elsewhere.com/actors/2', 'https://elsewhere.com/actors/3', ), 'audience' => 'https://elsewhere.com/actors/5', ), ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/1', 'type' => 'Person', ) ), Request::create( 'https://example.com/outbox', Request::METHOD_POST ) ), ) ), ); } /** * @dataProvider provideTestCreateHandler */ public function testCreateHandler($testCase) { $event = $testCase['event']; $this->eventDispatcher->dispatch( $testCase['eventName'], $event ); $this->assertEquals( $testCase['expectedEvent'], $event, "Error on test $testCase[id]" ); } }__halt_compiler();----SIGNATURE:----Mg0yTfKktu4AqatxgNcOBxzyurC33e4FdxalYfr05Z4uSQGrfRLgXceSN32AvejGxYBk/6lCc9IgTo5/dboFH6YJ7G5iTEkT19Sv10aRR04l7jNF+pTfillKH1j7dH8DfnL8HY7K+hZ+u1+EXAlwhKNSbhyVAmbxXFFYagGi29CeYNgyP7fX9vDP+yPVLCERfRCSQdlyMhEgi9RmCLVBbhhaz214xMLb8dlZ6Wp0gpRsLIUZQcFk8HrUxdlFSr62U5aSOt5RhVbLsMJqp0+cgpmg381HOOM10KUJO6SnEwNK2wYVhIY5tiIeWMv7cpNLVS6CdK/K6oGqIcuK2mH5Q6XdrUhof5GuxK7gpFRfQ6dsBwXhLOt5p3MxOy9pNAZxEvIyLEZtsKQdQivfzZA2DaPf1nl5P1oJ6lDOL/NFtybnJ7gVwmStz/y4G8LKEsrdnaKhaI72noNi9I1RdH8/ewCvwfI+A5y5CATodpYm6PAQi00+HlyMNfEqEh2+BCtw4LNoJGUlymZanEGYgXvl7/LxOs6pfOVowbg8OyFJu5KmSpf2jgFnNeJTlG9ce4DZ2ko9s3SoYmeSyhTnkjkkzkrOVKVPQphKtEBpz1ElBy7IGUFnslZa8koYVD3RGjqktcNtM7kG2+hSwDPN1/0LBP+DE9fjkCqi4zHa4Q6iaD0=----ATTACHMENT:----MzQxNTUxOTA2MjM3NDU5MCAzMzI2ODk5NzM2OTI0OTc1IDg2MjAzNDM4NTM5MTkyMDU=