diff --git a/tests/ZendTest/Validator/ValidatorChainTest.php b/tests/ZendTest/Validator/ValidatorChainTest.php index c3500d9fc87..b7180e944e2 100644 --- a/tests/ZendTest/Validator/ValidatorChainTest.php +++ b/tests/ZendTest/Validator/ValidatorChainTest.php @@ -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();