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:----T7FYkeoKPbn9Yg41qUUKxItcmCl+5tN7rsEs/utndT0O3P6tHHcqEvmK9FYPYoPFOTPvYWovUUawWQ+cW9GYwWI2D1wYgChVGIb9YG+49UY4asCMX2n3PcQrDoTPyNDAY4+QgNkkbD18sgSNzFIR114d8909i5kobtnov+HkhqA2goa2AGaXoCP5TP2BiwEDOeG5fculPonuZMYA6T6V90ZEkHKQ4c7UKDgFiJVKXcyS0dkpPJ437yHQwUO/00rJ91fPJQ6OkmXzbNi4KeGKFc/iqH3FKcrg4xknuCv0nb9wzFLNhbbP2OC97brRLKHAtmcvpwpWDe7qD5oJkR4OpsLBBHdpXRWzFUKFFKplinfWMyPfMKzTZkDUHfGC/B95z4XkJL86fZ9KGgn8teA6Enhv3rS748iGsG1toF50giJwnWP6JK1pYFp3qf64y0efKYrErv5yBxwttGKpeCQ9dhE1/7MVfKPPtm1+w6kWMW4PO0gMXyMP7YjnCSD6t1a2C8Kg+WxPWx+4AkljUTwHGoyNQy+OTAOoCS4JlnxHYM5+ghTMFLrccw6AxpbIa7ZQdMkmeBsyM283lVO8BaL3b8h67MN+WzVklyLyVjVpq+/R/FE+rrpSnMayihkvej/PJMBOw9CLT/AW1AsKiAYsFMbke+uiN1A8ESCvvnc50QM=----ATTACHMENT:----NDg0MTA2NjY4NjM2MTE0NyAyNjI0ODQyNzgwMDQ3MzEgMjQyNDAxNTMyNTA4NTYyNw==