From 300a4b1fdcc462d376536f97d9c2af42579242f0 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sat, 22 Nov 2014 05:49:13 +0100 Subject: [PATCH] #6386 #6496 - `ValidatorChain` must be cloneable --- .../ZendTest/Validator/ValidatorChainTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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();