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:----Hx3XFViUkmg8eLwxXw9x0h4dbB61Ff97+c/zFsPH1JxcHYpVKOf9bygqG6CcSO4/vOgBN4LSkd/ro5uCIHXckRsySInF/NUoR9rK6xsbxhKMlWm9r4+GudR9YEVuTsfPNLCyxQLmP7zAl2dRlI3XjZw2NR7SFNAyRydEP8bmahxW5W7ViB082LILp0lHpgdNdqtVAopGC+kHQJfMpYy0uk81AusfOOmB2slhNUFgOIkvKbrpLWQc3rb1JmCMRoXicB2Day9QoJrKxbh18dZ4FNHE0e9GjsPoxLRtSieJPl/rEhqxSV8GzgUXIVwPFGIDnumjIYiSF6PdlFecgDo9HIPlWPX+WKNGY9x3GKJtGYlRummscar597NqWsl1n+LIXdfHkZ2uAScFgRij7Zfg49K9dh1kOSKuErv6tClKMoLHdQO4BTEYTzOHIHW0FQtf/KcWRnjKdHt3UXlQCGu83OhzYauLvkhNmovc900XVaNaQMOoBeCnCv42GyvvtRwUJtoJ76KGe76Q1e/Jiqyi3ciRMMP8joVHKYeuZ3XCMKRKjf5ah6S7hkF+mayGrQdF7zzw8K7rUUoHu4t0zWcvB6p//tH8aI/FI4frewqxrkkzQjwS7Y0dc9jHEntjUl6TUdusxoDOUYyrQeZnZ09mCKUvMhRzIMuQ0mzD0ymGJRA=----ATTACHMENT:----NTM0NDc2MDgzNjM2NTEyMCA1NTE3NTc0NDUyNzgxMTg2IDczNTE4MDU1OTkxMTMxMTQ=