Skip to content

Commit

Permalink
Merge branch 'hotfix/4788'
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Jul 19, 2013
2 parents f333bd5 + 3fd7e3d commit 68691c0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions library/Zend/InputFilter/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public function createInputFilter($inputFilterSpecification)
$inputFilter = $this->getInputFilterManager()->get($type);

if ($inputFilter instanceof CollectionInputFilter) {
$inputFilter->setFactory($this);
if (isset($inputFilterSpecification['input_filter'])) {
$inputFilter->setInputFilter($inputFilterSpecification['input_filter']);
}
Expand Down
12 changes: 12 additions & 0 deletions tests/ZendTest/InputFilter/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;
use Zend\Validator;
use ZendTest\InputFilter\TestAsset\CustomFactory;

class FactoryTest extends TestCase
{
Expand Down Expand Up @@ -515,4 +516,15 @@ public function testConflictNameWithInputFilterType()
$this->assertInstanceOf('Zend\InputFilter\InputFilter', $inputFilter);
$this->assertTrue($inputFilter->has('type'));
}

public function testCustomFactoryInCollection()
{
$factory = new CustomFactory();
/** @var \Zend\InputFilter\CollectionInputFilter $inputFilter */
$inputFilter = $factory->createInputFilter(array(
'type' => 'collection',
'input_filter' => new InputFilter(),
));
$this->assertInstanceOf('ZendTest\InputFilter\TestAsset\CustomFactory', $inputFilter->getFactory());
}
}
16 changes: 16 additions & 0 deletions tests/ZendTest/InputFilter/TestAsset/CustomFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace ZendTest\InputFilter\TestAsset;

use Zend\InputFilter\Factory;

class CustomFactory extends Factory
{
}

0 comments on commit 68691c0

Please sign in to comment.