use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\Loader\FilterChoiceLoaderDecorator;
use Symfony\Component\Form\Tests\Fixtures\ArrayChoiceLoader;
class FilterChoiceLoaderDecoratorTest extends TestCase
{ public function testLoadChoiceList() { $filter =
fn ($choice) => 0 ===
$choice % 2;
$loader =
new FilterChoiceLoaderDecorator(new ArrayChoiceLoader(range(1, 4
)),
$filter);
$this->
assertEquals(new ArrayChoiceList([1 => 2, 3 => 4
]),
$loader->
loadChoiceList());
} public function testLoadChoiceListWithGroupedChoices() { $filter =
fn ($choice) =>
$choice < 9 && 0 ===
$choice % 2;
$loader =
new FilterChoiceLoaderDecorator(new ArrayChoiceLoader(['units' =>
range(1, 9
), 'tens' =>
range(10, 90, 10
)]),
$filter);
$this->
assertEquals(new ArrayChoiceList([