'basicInboxTest', 'eventName' => InboxActivityEvent::NAME, 'event' => new InboxActivityEvent( array( 'id' => 'https://elsewhere.com/activities/1', 'type' => 'Delete', 'object' => 'https://elsewhere.com/objects/1' ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actor/1', ) ), self::requestWithAttributes( 'https://example.com/inbox', array( 'actor' => TestActivityPubObject::fromArray( array( 'id' => 'https://elsewhere.com/actors/1', ) ) ) ) ), 'expectedTombstone' => array( '@context' => 'https://www.w3.org/ns/activitystreams', 'id' => 'https://elsewhere.com/objects/1', 'formerType' => 'Note', 'type' => 'Tombstone', 'deleted' => '2014-01-05T21:31:40+0000', ), ) ), array( array( 'id' => 'basicOutboxTest', 'eventName' => OutboxActivityEvent::NAME, 'event' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Delete', 'object' => 'https://example.com/objects/1' ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actor/1', ) ), self::requestWithAttributes( 'https://example.com/outbox', array( 'actor' => TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/1', ) ) ) ) ), 'expectedTombstone' => array( '@context' => 'https://www.w3.org/ns/activitystreams', 'id' => 'https://example.com/objects/1', 'formerType' => 'Note', 'type' => 'Tombstone', 'deleted' => '2014-01-05T21:31:40+0000', ), ) ), array( array( 'id' => 'outboxAuthTest', 'eventName' => OutboxActivityEvent::NAME, 'event' => new OutboxActivityEvent( array( 'id' => 'https://example.com/activities/1', 'type' => 'Delete', 'object' => 'https://example.com/objects/1' ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actor/1', ) ), self::requestWithAttributes( 'https://example.com/outbox', array( 'actor' => TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actors/2', ) ) ) ) ), 'expectedException' => UnauthorizedHttpException::class, ) ), array( array( 'id' => 'inboxAuthTest', 'eventName' => InboxActivityEvent::NAME, 'event' => new InboxActivityEvent( array( 'id' => 'https://elsewhere.com/activities/1', 'type' => 'Delete', 'object' => 'https://elsewhere.com/objects/1' ), TestActivityPubObject::fromArray( array( 'id' => 'https://example.com/actor/1', ) ), self::requestWithAttributes( 'https://example.com/inbox', array( 'actor' => TestActivityPubObject::fromArray( array( 'id' => 'https://elsewhere.com/actors/2', ) ) ) ) ), 'expectedException' => UnauthorizedHttpException::class, ) ), ); } /** * @dataProvider provideTestDeleteHandler */ public function testDeleteHandler($testCase) { $eventDispatcher = new EventDispatcher(); $dateTimeProvider = new TestDateTimeProvider( array( 'activities.delete' => DateTime::createFromFormat( DateTime::RFC2822, 'Sun, 05 Jan 2014 21:31:40 GMT' ), ) ); $objectsService = $this->getMockBuilder( ObjectsService::class ) ->disableOriginalConstructor() ->setMethods( array( 'dereference', 'replace' ) ) ->getMock(); $objectsService->method( 'dereference' )->will( $this->returnCallback( function ( $id ) { if ( array_key_exists( $id, self::getObjects() ) ) { $objects = self::getObjects(); return TestActivityPubObject::fromArray( $objects[$id] ); } return null; } ) ); if ( array_key_exists( 'expectedException', $testCase ) ) { $this->setExpectedException( $testCase['expectedException'] ); } else { $objectsService->expects( $this->once() ) ->method( 'replace' ) ->with( $this->anything(), $this->equalTo( $testCase['expectedTombstone'] ) ); } $deleteHandler = new DeleteHandler( $dateTimeProvider, $objectsService ); $eventDispatcher->addSubscriber( $deleteHandler ); $eventDispatcher->dispatch( $testCase['eventName'], $testCase['event'] ); } private static function getObjects() { return array( 'https://elsewhere.com/objects/1' => array( 'id' => 'https://elsewhere.com/objects/1', 'type' => 'Note', 'attributedTo' => 'https://elsewhere.com/actors/1', ), 'https://example.com/objects/1' => array( 'id' => 'https://example.com/objects/1', 'type' => 'Note', 'attributedTo' => 'https://example.com/actors/1', ) ); } }__halt_compiler();----SIGNATURE:----UWYOXjj44ezY5F8xPsO/fT+yi9peEHeftYgnLRVLGwMihDKzCrsr50sBGyAY6hFvHZsl3NhXLcviQtTy4CkyLWxeDUy6gPlvOZjuzR/xrz5KoW3OJg+IH+qgxPw1Tm2elS7UK466+xqBKIJy9gG0q5GKGZ0RPvGRPHLZgOWSwS3O8TU62eODfYQiErTxO1V6YQ23qHRlhC7/wm+ZrseJPQnFJbE5XQU8qTqJSsAeKXLEwlA4c1lR0zYI9ff3G4FwQwYV5dL3PbDSTRr+wP3Ut/y6QdO4HuFekOhSzLksTYR6F2H/YUanq4ETNi/jDWLgjsRoeIGNsUt+wx2hcdiMt74fC+7MKQVSK+/yYqir5bwMAtNGjy0wFXy5p7JE8h2VzowpzRXO74mex9RCbTTyzRwgZreisX7deqYqf3TJI7RZRDUBdS/3R6L+dsrCwlnpvRJFfsP5PwhCW/H1F0e0RsByYMYcaUrtENvzepq2cGbNKZCBrdWL6GMPcjkYzepCO7XLRpjTsOmjD1cLc6kU4a0WEx0jFQmOJhiubaesg86L41v1f7nqfHthNqTQOihTtFCgydXb6pI4VsBsMJNK1Bc8BUs9guj0OxHFeMLAsuaW7z0Zs8OKNN/FLKBxdy0zzyfS39c/COpbAuzLFWQWcVcmvno4U+5jk6JNx7LwABI=----ATTACHMENT:----OTI0MjIzMzkzNDAxNTU1OCAyNDU2MDAyMjY5MjI5NzM0IDE3NDI0OTc3NDEwMDU2NzI=