<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CmsBundle\Tests\Filter;

use Ferienpass\CmsBundle\Filter\OfferListFilter;
use PHPUnit\Framework\TestCase;

final class OfferListFilterTest extends TestCase
{
    public function testGetFilterNamesReturnsEmptyArrayWhenNoFilters(): void
    {
        $filter = new OfferListFilter([]);

        self::assertSame([], $filter->getFilterNames());
    }

    public function testHumanReadableReturnsEmptyByDefault(): void
    {
        $filter = new OfferListFilter([]);

        self::assertSame([], $filter->humanReadable());
    }

    public function testGetBlockPrefixReturnsEmptyString(): void
    {
        $filter = new OfferListFilter([]);

        self::assertSame('', $filter->getBlockPrefix());
    }

    public function testGetFilterNamesReturnsKeyedNames(): void
    {
        $filterA = $this->createMock(\Ferienpass\CmsBundle\Filter\Type\FilterType::class);
        $filterB = $this->createMock(\Ferienpass\CmsBundle\Filter\Type\FilterType::class);

        $filter = new OfferListFilter(new \ArrayIterator(['age' => $filterA, 'name' => $filterB]));

        self::assertSame(['age', 'name'], $filter->getFilterNames());
    }
}
