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

Commit

Permalink
Forward port #5883
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Willbanks committed Mar 3, 2014
2 parents fc34059 + be6e479 commit 4445997
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 0 additions & 1 deletion library/Zend/InputFilter/CollectionInputFilter.php
Expand Up @@ -159,7 +159,6 @@ public function isValid()
if ($this->isRequired) {
$valid = false;
}
return $valid;
}

if (count($this->collectionData) < $this->getCount()) {
Expand Down
25 changes: 25 additions & 0 deletions tests/ZendTest/InputFilter/InputFilterTest.php
Expand Up @@ -11,7 +11,9 @@

use PHPUnit_Framework_TestCase as TestCase;
use Zend\Filter;
use Zend\InputFilter\CollectionInputFilter;
use Zend\InputFilter\Factory;
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;

class InputFilterTest extends TestCase
Expand Down Expand Up @@ -43,4 +45,27 @@ public function testCanAddUsingSpecification()
$foo = $this->filter->get('foo');
$this->assertInstanceOf('Zend\InputFilter\InputInterface', $foo);
}

/**
* @group ZF2-5648
*/
public function testCountZeroValidateInternalInputWithCollectionInputFilter()
{
$collection = new CollectionInputFilter();
$collection->setCount(0)
->add(new Input(), 'name');
$this->filter->add($collection, 'people');

$data = array(
'people' => array(
array(
'name' => 'Wanderson',
),
),
);
$this->filter->setData($data);

$this->assertTrue($this->filter->isvalid());
$this->assertSame($data, $this->filter->getValues());
}
}

0 comments on commit 4445997

Please sign in to comment.