deliveryMock = $this->createMock(core_kernel_classes_Resource::class); $this->testResource = $this->createMock(core_kernel_classes_Resource::class); $this->deliveryMock->method('getUri')->willReturn(self::DELIVERY_URI); $this->deliveryMock->method('getOnePropertyValue')->willReturn($this->testResource); $this->testResource->method('getUri')->willReturn(self::TEST_URI); } public function testSerializeForWebhook(): void { $event = new DeliveryCreatedEvent($this->deliveryMock); $result = $event->serializeForWebhook(); $this->assertArrayHasKey('deliveryId', $result); $this->assertArrayHasKey('testId', $result); $this->assertEquals(self::DELIVERY_URI, $result['deliveryId']); $this->assertEquals(self::TEST_URI, $result['testId']); } public function testJsonSerialize(): void { $event = new DeliveryCreatedEvent($this->deliveryMock); $result = $event->jsonSerialize(); $this->assertArrayHasKey('delivery', $result); $this->assertEquals($result['delivery'], self::DELIVERY_URI); } public function testGetName(): void { $event = new DeliveryCreatedEvent($this->deliveryMock); $result = $event->getName(); $this->assertEquals($result, DeliveryCreatedEvent::class); } public function testGetWebhookEventName(): void { $event = new DeliveryCreatedEvent($this->deliveryMock); $result = $event->getWebhookEventName(); $this->assertEquals('DeliveryCreatedEvent', $result); } public function testGetUri(): void { $event = new DeliveryCreatedEvent($this->deliveryMock); $result = $event->getDeliveryUri(); $this->assertEquals(self::DELIVERY_URI, $result); } }