TaxProviderCollection example

return $taxProviders;
    }

    /** * @param array<TaxProvider> $providers * * @return EntitySearchResult<TaxProviderCollection> */
    private function existingProviders(array $providers = [], ?string $appId = null, ?string $appName = null): EntitySearchResult
    {
        $result = new TaxProviderCollection();

        foreach ($providers as $provider) {
            $taxProvider = new TaxProviderEntity();
            $taxProvider->setId($this->ids->get('tax-provider-' . $provider->getIdentifier()));
            $taxProvider->setActive(true);
            $taxProvider->setName($provider->getName());
            $taxProvider->setIdentifier(
                \sprintf('app\\%s_%s', $appName ?? self::META_APP_NAME, $provider->getIdentifier()),
            );

            $result->add($taxProvider);

            
$salesChannelContext = static::createMock(SalesChannelContext::class);
        $salesChannelContext
            ->method('getTotalRounding')
            ->willReturn(new CashRoundingConfig(2, 0.01, true));

        $taxProvider = new TaxProviderEntity();
        $taxProvider->setId(Uuid::randomHex());
        $taxProvider->setActive(true);
        $taxProvider->setPriority(1);
        $taxProvider->setIdentifier(TestConstantTaxRateProvider::class);

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

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

        $taxProviderRegistry = new TaxProviderRegistry([
            
Home | Imprint | This part of the site doesn't use cookies.