TaxProviderRegistry example

$collection = new TaxProviderCollection([$taxProvider]);

        $result = new EntitySearchResult(
            TaxProviderDefinition::ENTITY_NAME,
            1,
            $collection,
            null,
            new Criteria(),
            Context::createDefaultContext()
        );

        $taxProviderRegistry = new TaxProviderRegistry([
            new TestConstantTaxRateProvider(),
        ]);

        $repo = static::createMock(EntityRepository::class);
        $repo->method('search')->willReturn($result);

        $processor = new TaxProviderProcessor(
            $repo,
            static::createMock(LoggerInterface::class),
            $this->adjustment,
            $taxProviderRegistry,
            
/** * @package checkout * * @internal * * @covers \Shopware\Core\Checkout\Cart\TaxProvider\TaxProviderRegistry */
class TaxProviderRegistryTest extends TestCase
{
    public function testProviderRegistered(): void
    {
        $registry = new TaxProviderRegistry(
            [new TestConstantTaxRateProvider()]
        );

        static::assertTrue($registry->has(TestConstantTaxRateProvider::class));
        static::assertInstanceOf(TestConstantTaxRateProvider::class$registry->get(TestConstantTaxRateProvider::class));

        static::assertFalse($registry->has(TestEmptyTaxProvider::class));
    }

    public function testProviderNotFound(): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.