PersistentError example

$calculatedTaxForProductItem = array_filter($shippingCalculatedTaxesfn (CalculatedTax $tax) => (int) $tax->getTaxRate() === $taxForProductItem);

        static::assertNotEmpty($calculatedTaxForProductItem);
        static::assertCount(1, $calculatedTaxForProductItem);
    }

    public function testPersistentErrors(): void
    {
        $cart = new Cart(Uuid::randomHex());

        $cart->addErrors(new NonePersistentError()new PersistentError());

        $cart = $this->getContainer()->get(Processor::class)
            ->process($cart$this->context, new CartBehavior());

        static::assertCount(1, $cart->getErrors());
        static::assertInstanceOf(PersistentError::class$cart->getErrors()->first());

        $error = $cart->getErrors()->first();
        static::assertEquals('persistent', $error->getId());
        static::assertEquals('persistent', $error->getMessageKey());
    }

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