<?php

declare(strict_types=1);



namespace Sonata\AdminBundle\Tests\Form\Type;

use Sonata\AdminBundle\Form\Type\Filter\DateTimeRangeType;
use Sonata\CoreBundle\Form\Type\DateTimeRangeType as FormDateTimeRangeType;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;

class DateTimeRangeTypeTest extends TypeTestCase
{
    public function testGetDefaultOptions(): void
    {
        $stub = $this->getMockForAbstractClass(TranslatorInterface::class);

        $type = new DateTimeRangeType($stub);

        $optionResolver = new OptionsResolver();

        $type->configureOptions($optionResolver);

        $options = $optionResolver->resolve();

        $expected = [
            'field_type' => FormDateTimeRangeType::class,
            'field_options' => ['date_format' => 'yyyy-MM-dd'],
        ];
        $this->assertSame($expected, $options);
    }
}
