insertProduct example

static::assertCount(1, $hookables);
        static::assertInstanceOf(HookableBusinessEvent::class$hookables[0]);
    }

    public function testCreatesHookableEntityInsert(): void
    {
        $id = Uuid::randomHex();

        /** @var EntityRepository $productRepository */
        $productRepository = $this->getContainer()->get('product.repository');
        $writtenEvent = $this->insertProduct($id$productRepository);

        $hookables = $this->hookableEventFactory->createHookablesFor($writtenEvent);

        static::assertCount(1, $hookables);
        $event = $hookables[0];
        static::assertEquals('product.written', $event->getName());

        $payload = $event->getWebhookPayload();
        static::assertCount(1, $payload);
        $actualUpdatedFields = $payload[0]['updatedFields'];
        unset($payload[0]['updatedFields']);

        
Home | Imprint | This part of the site doesn't use cookies.