<?php

declare(strict_types=1);

namespace CpCreation\VitiCore\Tests\Twig;

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

final class ChampagneTranslationTest extends TestCase
{
    #[DataProvider('localeProvider')]
    public function testChampagneLabelsAreTranslated(string $locale): void
    {
        $translations = Yaml::parseFile(sprintf(
            '%s/../../src/Bridge/Symfony/Bundle/Resources/translations/messages.%s.yaml',
            __DIR__,
            $locale,
        ));

        foreach (['assemblage', 'dosage', 'file'] as $key) {
            $message = $translations['collection']['champagne'][$key] ?? null;

            self::assertIsString($message, sprintf('Missing collection.champagne.%s for locale %s.', $key, $locale));
            self::assertNotSame('', trim($message));
            self::assertNotSame('collection.champagne.' . $key, $message);
        }
    }

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