Skip to content

Commit

Permalink
zendframework#6386 zendframework#6496 - ValidatorChain must be clon…
Browse files Browse the repository at this point in the history
…eable
  • Loading branch information
Ocramius committed Nov 22, 2014
1 parent ae6a7c6 commit 300a4b1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/ZendTest/Validator/ValidatorChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,26 @@ public function testMergeValidatorChains()
$this->assertCount(2, $this->validator->getValidators());
}

/**
* @group 6386
* @group 6496
*/
public function testValidatorChainIsCloneable()
{
$this->validator->attach(new NotEmpty());

$this->assertCount(1, $this->validator->getValidators());

$clonedValidatorChain = clone $this->validator;

$this->assertCount(1, $clonedValidatorChain->getValidators());

$clonedValidatorChain->attach(new NotEmpty());

$this->assertCount(1, $this->validator->getValidators());
$this->assertCount(2, $clonedValidatorChain->getValidators());
}

public function testCountGivesCountOfAttachedValidators()
{
$this->populateValidatorChain();
Expand Down

0 comments on commit 300a4b1

Please sign in to comment.