TestConstantTaxRateProvider example


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
    {
        $registry = new TaxProviderRegistry(
            [
$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,
            static::createMock(TaxProviderPayloadService::class)
        );
Home | Imprint | This part of the site doesn't use cookies.