diff --git a/src/Factory.php b/src/Factory.php index 5bc39463..8b66af22 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -39,12 +39,12 @@ class Factory */ public function __construct(InputFilterPluginManager $inputFilterManager = null) { + $this->defaultFilterChain = new FilterChain(); + $this->defaultValidatorChain = new ValidatorChain(); + if ($inputFilterManager) { $this->setInputFilterManager($inputFilterManager); } - - $this->defaultFilterChain = new FilterChain(); - $this->defaultValidatorChain = new ValidatorChain(); } /** diff --git a/test/FactoryTest.php b/test/FactoryTest.php index b2ccae95..a92d78e4 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -570,6 +570,13 @@ public function testSetInputFilterManagerWithoutServiceManager() $this->assertSame($inputFilterManager, $factory->getInputFilterManager()); } + public function testSetInputFilterManagerOnConstruct() + { + $inputFilterManager = new InputFilterPluginManager(); + $factory = new Factory($inputFilterManager); + $this->assertSame($inputFilterManager, $factory->getInputFilterManager()); + } + /** * @group 5691 *