<?php

declare(strict_types=1);

namespace Ferienpass\AdminBundle\Tests\Form\Extension;

use Ferienpass\AdminBundle\Form\Extension\Form\SectionExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class FormSectionExtensionTest extends TestCase
{
    public function testGetExtendedTypesIsNotEmpty(): void
    {
        $types = iterator_to_array(SectionExtension::getExtendedTypes());

        self::assertNotEmpty($types);
    }

    public function testConfigureOptionsDefinesDisplaySection(): void
    {
        $ext = new SectionExtension();
        $resolver = new OptionsResolver();

        $ext->configureOptions($resolver);

        $resolved = $resolver->resolve([]);
        self::assertNull($resolved['display_section']);
    }

    public function testConfigureOptionsAllowsStringDisplaySection(): void
    {
        $ext = new SectionExtension();
        $resolver = new OptionsResolver();

        $ext->configureOptions($resolver);

        $resolved = $resolver->resolve(['display_section' => 'personal']);
        self::assertSame('personal', $resolved['display_section']);
    }
}
