diff --git a/src/Filter.php b/src/Filter.php index 03b674c..858047e 100644 --- a/src/Filter.php +++ b/src/Filter.php @@ -25,7 +25,6 @@ public function __construct( * Perform actual filtering. You need to pass an identifying name. * You'll get an array with name of fields as keys and the filtered values * as values (except for "_sort" key, which holds info for sorting). - * You need to call saveFilter() before calling this method. * * @return array */ @@ -33,9 +32,6 @@ public function filter(string $name): array { $filter = []; $fname = $name.$this->getSession()->getId(); - if (!isset($this->forms[$fname])) { - throw new \UnexpectedValueException(\sprintf('No filter found for "%s". Did you call saveFilter()?', $name)); - } /** @var array|null $values */ $values = $this->getSession()->get('filter.'.$name); if (null !== $values) { diff --git a/tests/FilterTest.php b/tests/FilterTest.php index b1080e4..3ff6aa5 100644 --- a/tests/FilterTest.php +++ b/tests/FilterTest.php @@ -29,12 +29,6 @@ protected function setUp(): void $this->filter = new Filter($this->factory, $stack); } - public function testFilterWithoutSaveFilterShouldThrowException(): void - { - $this->expectException(\UnexpectedValueException::class); - $this->filter->filter('foo'); - } - public function testFilter(): void { $this->filter->saveFilter(StubFormType::class, 'foo'); @@ -79,7 +73,6 @@ public function testFormViewWithoutPreviousForm(): void public function testSort(): void { $this->filter->sort('foo', 'bar'); - $this->filter->saveFilter(StubFormType::class, 'foo'); $filter = $this->filter->filter('foo'); self::assertArrayHasKey('_sort', $filter); }