isMerged example

static::assertSame($newCart$caughtEvent->getCart());
        static::assertSame($newCart$cartService->getCart($token$this->getSalesChannelContext()));
        static::assertNotSame($newCart$cartService->createNew($token));
    }

    public function testLineItemAddedEventFired(): void
    {
        $dispatcher = $this->getContainer()->get('event_dispatcher');

        $isMerged = null;
        $this->addEventListener($dispatcher, BeforeLineItemAddedEvent::classstatic function DBeforeLineItemAddedEvent $addedEvent) use (&$isMerged): void {
            $isMerged = $addedEvent->isMerged();
        });

        $cartService = $this->getContainer()->get(CartService::class);

        $context = $this->getSalesChannelContext();

        $cartId = Uuid::randomHex();
        $cart = $cartService->getCart($cartId$context);
        $cartService->add(
            $cart,
            (new LineItem('test', 'test'))->setStackable(true),
            
Home | Imprint | This part of the site doesn't use cookies.