Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#6046-input-from-inpu…
Browse files Browse the repository at this point in the history
…t-filter-manager'

Close zendframework/zendframework#6046
  • Loading branch information
Ocramius committed Apr 2, 2014
3 parents ea38fcc + bbb9b80 + 88872e2 commit ba3710b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/InputFilterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

/**
* Plugin manager implementation for input filters.
*
* @method InputFilterInterface|InputInterface get($name)
*/
class InputFilterPluginManager extends AbstractPluginManager
{
Expand Down Expand Up @@ -70,7 +72,7 @@ public function populateFactory($inputfilter)
*/
public function validatePlugin($plugin)
{
if ($plugin instanceof InputFilterInterface) {
if ($plugin instanceof InputFilterInterface || $plugin instanceof InputInterface) {
// Hook to perform various initialization, when the inputfilter is not created through the factory
if ($plugin instanceof InitializableInterface) {
$plugin->init();
Expand Down
20 changes: 20 additions & 0 deletions test/InputFilterManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,24 @@ public function testLoadingInvalidElementRaisesException()
$this->setExpectedException('Zend\InputFilter\Exception\RuntimeException');
$this->manager->get('test');
}

/**
* @covers Zend\InputFilter\InputFilterPluginManager::validatePlugin
*/
public function testAllowLoadingInstancesOfInputFilterInterface()
{
$inputFilter = $this->getMock('Zend\InputFilter\InputFilterInterface');

$this->assertNull($this->manager->validatePlugin($inputFilter));
}

/**
* @covers Zend\InputFilter\InputFilterPluginManager::validatePlugin
*/
public function testAllowLoadingInstancesOfInputInterface()
{
$input = $this->getMock('Zend\InputFilter\InputInterface');

$this->assertNull($this->manager->validatePlugin($input));
}
}

0 comments on commit ba3710b

Please sign in to comment.