<?php

declare(strict_types=1);

namespace CpCreation\VitiCore\Tests\Cart;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Yaml;

final class PromoTranslationTest extends TestCase
{
    #[DataProvider('localeProvider')]
    public function testGenericInvalidPromoMessageNeedsNoCodeParameter(string $locale): void
    {
        $translations = Yaml::parseFile(sprintf(
            '%s/../../src/Bridge/Symfony/Bundle/Resources/translations/messages.%s.yaml',
            __DIR__,
            $locale,
        ));
        $message = $translations['cart']['promo']['invalid'] ?? null;

        self::assertIsString($message);
        self::assertStringNotContainsString('%code%', $message);
    }

    /**
     * @return iterable<string, array{string}>
     */
    public static function localeProvider(): iterable
    {
        yield 'English' => ['en'];
        yield 'French' => ['fr'];
        yield 'Dutch' => ['nl'];
    }
}
