From 5dd413b53713cf206506cc632f35b3458598a106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=A4fer?= Date: Sun, 4 Jan 2026 20:28:29 +0100 Subject: [PATCH] Remove test (excluded in phpunit.xml.dist) and fixtures because FilterRegistry does not exist anymore --- tests/Form/Filter/FilterRegistryTest.php | 113 ------------------ tests/Form/Filter/Fixtures/FooFilterType.php | 14 --- .../Form/Filter/Fixtures/FoobarFilterType.php | 13 -- .../Filter/Fixtures/InvalidFilterType.php | 13 -- 4 files changed, 153 deletions(-) delete mode 100644 tests/Form/Filter/FilterRegistryTest.php delete mode 100644 tests/Form/Filter/Fixtures/FooFilterType.php delete mode 100644 tests/Form/Filter/Fixtures/FoobarFilterType.php delete mode 100644 tests/Form/Filter/Fixtures/InvalidFilterType.php diff --git a/tests/Form/Filter/FilterRegistryTest.php b/tests/Form/Filter/FilterRegistryTest.php deleted file mode 100644 index 9e9660390d..0000000000 --- a/tests/Form/Filter/FilterRegistryTest.php +++ /dev/null @@ -1,113 +0,0 @@ - 'easyadmin.filter.type.foo', - ]; - $typeGuesser = $this->getMockBuilder(DoctrineOrmFilterTypeGuesser::class) - ->disableOriginalConstructor() - ->getMock() - ; - $this->filterRegistry = new FilterRegistry($typesMap, [$typeGuesser]); - } - - public function testHasType(): void - { - $this->assertTrue($this->filterRegistry->hasType('foo')); - $this->assertFalse($this->filterRegistry->hasType('bar')); - } - - public function testGetType(): void - { - $this->assertSame('easyadmin.filter.type.foo', $this->filterRegistry->getType('foo')); - } - - public function testGetInvalidType(): void - { - $this->setExpectedException(\Symfony\Component\Form\Exception\InvalidArgumentException::class); - - $this->filterRegistry->getType('bar'); - } - - public function testGetTypeGuesser(): void - { - $typeGuesser = $this->filterRegistry->getTypeGuesser(); - - $this->assertInstanceOf(FormTypeGuesserChain::class, $typeGuesser); - } - - public function testResolveType(): void - { - $filterType = new FooFilterType(); - $form = $this->createFilterForm($filterType); - - $this->assertSame($filterType, $this->filterRegistry->resolveType($form)); - } - - public function testResolveTypeThroughParents(): void - { - $fooFilterType = new FooFilterType(); - $foobarFilterType = new FoobarFilterType(); - $form = $this->createFilterForm($fooFilterType, $foobarFilterType); - - $this->assertSame($fooFilterType, $this->filterRegistry->resolveType($form)); - } - - public function testInvalidFilterType(): void - { - $this->setExpectedException(\Symfony\Component\Form\Exception\RuntimeException::class, 'Filter type "EasyCorp\\TestBundle\\EasyAdminBundle\\Tests\\Form\\Filter\\Fixtures\\InvalidFilterType" must implement "EasyCorp\\TestBundle\\EasyAdminBundle\\Form\\Filter\\Type\\FilterInterface".'); - - $filterType = new InvalidFilterType(); - $form = $this->createFilterForm($filterType); - - $this->filterRegistry->resolveType($form); - } - - private function createFilterForm(FormTypeInterface $filterType, ?FormTypeInterface $childFilterType = null) - { - $resolvedFormType = $this->getMockBuilder(ResolvedFormTypeInterface::class)->getMock(); - $resolvedFormType->method('getInnerType')->willReturn($filterType); - - if ($childFilterType) { - $childResolvedFormType = $this->getMockBuilder(ResolvedFormTypeInterface::class)->getMock(); - $childResolvedFormType->method('getInnerType')->willReturn($childFilterType); - $childResolvedFormType->method('getParent')->willReturn($resolvedFormType); - - $childFormConfig = $this->getMockBuilder(FormConfigInterface::class)->getMock(); - $childFormConfig->method('getType')->willReturn($childResolvedFormType); - - $childForm = $this->getMockBuilder(FormInterface::class)->getMock(); - $childForm->method('getConfig')->willReturn($childFormConfig); - - return $childForm; - } - - $formConfig = $this->getMockBuilder(FormConfigInterface::class)->getMock(); - $formConfig->method('getType')->willReturn($resolvedFormType); - - $form = $this->getMockBuilder(FormInterface::class)->getMock(); - $form->method('getConfig')->willReturn($formConfig); - - return $form; - } -} diff --git a/tests/Form/Filter/Fixtures/FooFilterType.php b/tests/Form/Filter/Fixtures/FooFilterType.php deleted file mode 100644 index 87b1f9bd24..0000000000 --- a/tests/Form/Filter/Fixtures/FooFilterType.php +++ /dev/null @@ -1,14 +0,0 @@ -