From 28dcf6879bf953648cbcfc4bdf1b345ab2242318 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:35:06 +0600 Subject: [PATCH 01/28] Fixed Zend\Validator\LessThan::__construct --- src/LessThan.php | 2 ++ test/LessThanTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/LessThan.php b/src/LessThan.php index a230fcc27..b97dab63b 100644 --- a/src/LessThan.php +++ b/src/LessThan.php @@ -105,6 +105,8 @@ public function __construct($options = null) $this->setMax($options['max']) ->setInclusive($options['inclusive']); + + parent::__construct(); } /** diff --git a/test/LessThanTest.php b/test/LessThanTest.php index 9eaa5f399..fd833e725 100644 --- a/test/LessThanTest.php +++ b/test/LessThanTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -108,4 +109,40 @@ public function testGetInclusive() $validator = new Validator\LessThan(10); $this->assertEquals(false, $validator->getInclusive()); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\LessThan(10); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\LessThan(10); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From ce51096fc5e776c1735041c16a005b870a6342e7 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:35:33 +0600 Subject: [PATCH 02/28] Fixed Zend\Validator\Ip::__construct --- src/Ip.php | 2 ++ test/IpTest.php | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/Ip.php b/src/Ip.php index efbbdb21e..71e3daee8 100644 --- a/src/Ip.php +++ b/src/Ip.php @@ -76,6 +76,8 @@ public function __construct($options = array()) $options += $this->_options; $this->setOptions($options); + + parent::__construct(); } /** diff --git a/test/IpTest.php b/test/IpTest.php index dbf3f7377..eda069e68 100644 --- a/test/IpTest.php +++ b/test/IpTest.php @@ -24,6 +24,9 @@ */ namespace ZendTest\Validator; +use Zend\Validator, + ReflectionClass; + /** * Test helper */ @@ -260,4 +263,40 @@ public function testIPv4addressnotations() } } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 52b8d9e506b797c0bc6c7698ba63ebd0ba6efbc0 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:35:55 +0600 Subject: [PATCH 03/28] Fixed Zend\Validator\Int::__construct --- src/Int.php | 2 ++ test/IntTest.php | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/Int.php b/src/Int.php index b64cdcb76..fe68bd4bb 100644 --- a/src/Int.php +++ b/src/Int.php @@ -77,6 +77,8 @@ public function __construct($locale = null) if ($locale !== null) { $this->setLocale($locale); } + + parent::__construct(); } /** diff --git a/test/IntTest.php b/test/IntTest.php index 34c3cfdc2..1056fa632 100644 --- a/test/IntTest.php +++ b/test/IntTest.php @@ -23,8 +23,9 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; -use Zend\Locale; +use Zend\Validator, + Zend\Locale, + ReflectionClass; /** * Test helper @@ -138,4 +139,40 @@ public function testLocaleDetectsNoEnglishLocaleOnOtherSetLocale() $this->assertTrue($valid->isValid(1200)); $this->assertFalse($valid->isValid('1,200')); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 081c645c71e81c894bb3dbf4ce6be85db7b5d5b1 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:38:29 +0600 Subject: [PATCH 04/28] Fixed Zend\Validator\InArray::__construct --- src/InArray.php | 2 ++ test/InArrayTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/InArray.php b/src/InArray.php index 845104e58..c60806adc 100644 --- a/src/InArray.php +++ b/src/InArray.php @@ -103,6 +103,8 @@ public function __construct($options = null) if (array_key_exists('recursive', $options)) { $this->setRecursive($options['recursive']); } + + parent::__construct(); } /** diff --git a/test/InArrayTest.php b/test/InArrayTest.php index 1a470d1b5..8edc805c4 100644 --- a/test/InArrayTest.php +++ b/test/InArrayTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -203,4 +204,40 @@ public function testRecursiveStandalone() $validator->setRecursive(true); $this->assertTrue($validator->isValid('A')); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\InArray(array()); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\InArray(array()); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 7de81e2e8ae6bd76b77d01338c59fe29162c6fee Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:40:28 +0600 Subject: [PATCH 05/28] Fixed Zend\Validator\Identical::__construct --- src/Identical.php | 2 ++ test/IdenticalTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/Identical.php b/src/Identical.php index f73c2f16e..81d547e0a 100644 --- a/src/Identical.php +++ b/src/Identical.php @@ -84,6 +84,8 @@ public function __construct($token = null) } elseif (null !== $token) { $this->setToken($token); } + + parent::__construct(); } /** diff --git a/test/IdenticalTest.php b/test/IdenticalTest.php index 6c73934fa..08ab83d76 100644 --- a/test/IdenticalTest.php +++ b/test/IdenticalTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** Zend_Validator_Identical */ @@ -132,4 +133,40 @@ public function testValidatingNonStrictToken() $validator->setStrict(true); $this->assertFalse($validator->isValid(array('token' => '123'))); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\Identical(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\Identical(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From fa8bb3d0e048153f9a167beb94a33f7c9a7d4bdb Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:42:05 +0600 Subject: [PATCH 06/28] Fixed Zend\Validator\Iban::__construct --- src/Iban.php | 2 ++ test/IbanTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/Iban.php b/src/Iban.php index f6e009d46..65c74e402 100644 --- a/src/Iban.php +++ b/src/Iban.php @@ -137,6 +137,8 @@ public function __construct($locale = null) if ($locale !== null) { $this->setLocale($locale); } + + parent::__construct(); } /** diff --git a/test/IbanTest.php b/test/IbanTest.php index 360499f73..3e6c32fbb 100644 --- a/test/IbanTest.php +++ b/test/IbanTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * @category Zend @@ -87,4 +88,40 @@ public function testIbanDetectionWithoutLocale() $validator = new Validator\Iban(false); $this->assertTrue($validator->isValid('AT611904300234573201')); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\Iban(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\Iban(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 7135bbd2f5eab614a4a1eb1be5a6ba73e9e7df98 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:43:42 +0600 Subject: [PATCH 07/28] Fixed Zend\Validator\GreaterThan::__construct --- src/GreaterThan.php | 2 ++ test/GreaterThanTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/GreaterThan.php b/src/GreaterThan.php index c1a55cbff..f0f3b883e 100644 --- a/src/GreaterThan.php +++ b/src/GreaterThan.php @@ -103,6 +103,8 @@ public function __construct($options = null) $this->setMin($options['min']) ->setInclusive($options['inclusive']); + + parent::__construct(); } /** diff --git a/test/GreaterThanTest.php b/test/GreaterThanTest.php index cf8e3a811..5204ffb6f 100644 --- a/test/GreaterThanTest.php +++ b/test/GreaterThanTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -108,4 +109,40 @@ public function testGetInclusive() $validator = new Validator\GreaterThan(10); $this->assertEquals(false, $validator->getInclusive()); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\GreaterThan(1); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\GreaterThan(1); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From c9561d4b4d3f2ffa808fc20379de86bbcf12259a Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:46:17 +0600 Subject: [PATCH 08/28] Fixed Zend\Validator\Date::__construct --- src/Date.php | 2 ++ test/DateTest.php | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/Date.php b/src/Date.php index 348b3dbc7..231825b3a 100644 --- a/src/Date.php +++ b/src/Date.php @@ -106,6 +106,8 @@ public function __construct($options = array()) if (array_key_exists('locale', $options)) { $this->setLocale($options['locale']); } + + parent::__construct(); } /** diff --git a/test/DateTest.php b/test/DateTest.php index 0a9de738f..3cb99ca60 100644 --- a/test/DateTest.php +++ b/test/DateTest.php @@ -23,8 +23,9 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; -use Zend\Date; +use Zend\Validator, + Zend\Date, + ReflectionClass; /** * Test helper @@ -264,4 +265,40 @@ public function errorHandlerIgnore($errno, $errstr, $errfile, $errline, array $e { $this->_errorOccurred = true; } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From a1bf1c80e699f7237e4db1c98428ee91490e68b3 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 14:59:37 +0600 Subject: [PATCH 09/28] Fixed Zend\Validator\RecordExists, Zend\Validator\NoRecordExists --- src/Db/AbstractDb.php | 2 ++ test/Db/NoRecordExistsTest.php | 39 +++++++++++++++++++++++++++++++++- test/Db/RecordExistsTest.php | 39 +++++++++++++++++++++++++++++++++- 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/Db/AbstractDb.php b/src/Db/AbstractDb.php index 4242afc71..ab1703223 100644 --- a/src/Db/AbstractDb.php +++ b/src/Db/AbstractDb.php @@ -107,6 +107,8 @@ abstract class AbstractDb extends AbstractValidator */ public function __construct($options = null) { + parent::__construct(); + if ($options instanceof DBSelect) { $this->setSelect($options); return; diff --git a/test/Db/NoRecordExistsTest.php b/test/Db/NoRecordExistsTest.php index 213dfc249..7e3e249c6 100644 --- a/test/Db/NoRecordExistsTest.php +++ b/test/Db/NoRecordExistsTest.php @@ -26,7 +26,8 @@ use Zend\Db\Table\AbstractTable, Zend\Validator\Db\RecordExists as RecordExistsValidator, - Zend\Validator\Db\NoRecordExists as NoRecordExistsValidator; + Zend\Validator\Db\NoRecordExists as NoRecordExistsValidator, + ReflectionClass; /** @@ -223,4 +224,40 @@ public function testCreatesQueryBasedOnNamedOrPositionalAvailablity() $wherePart = $validator->getSelect()->getPart('where'); $this->assertEquals('("field1" = :value)', $wherePart[0]); } + + public function testEqualsMessageTemplates() + { + $validator = new NoRecordExistsValidator('users', 'field1'); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new NoRecordExistsValidator('users', 'field1'); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } diff --git a/test/Db/RecordExistsTest.php b/test/Db/RecordExistsTest.php index 945c4b614..25d7dd9f4 100644 --- a/test/Db/RecordExistsTest.php +++ b/test/Db/RecordExistsTest.php @@ -25,7 +25,8 @@ namespace ZendTest\Validator\Db; use Zend\Db\Table\AbstractTable, - Zend\Validator\Db\RecordExists as RecordExistsValidator; + Zend\Validator\Db\RecordExists as RecordExistsValidator, + ReflectionClass; /** * @category Zend @@ -212,4 +213,40 @@ public function testExcludeConstructor() $validator = new RecordExistsValidator('users', 'field1', 'id != 1'); $this->assertTrue($validator->isValid('value3')); } + + public function testEqualsMessageTemplates() + { + $validator = new RecordExistsValidator('users', 'field1'); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new RecordExistsValidator('users', 'field1'); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 4d225bb40cb418a24257ab6eda369d457238fd85 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:02:54 +0600 Subject: [PATCH 10/28] Added Alnum test --- test/AlnumTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/AlnumTest.php b/test/AlnumTest.php index c51034a23..5beb88dd6 100644 --- a/test/AlnumTest.php +++ b/test/AlnumTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -165,4 +166,40 @@ public function testIntegerValidation() { $this->assertTrue($this->_validator->isValid(1)); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 36ee5d5d7616a538165a35afed930c204093602f Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:03:43 +0600 Subject: [PATCH 11/28] Added Alpha test --- test/AlphaTest.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/AlphaTest.php b/test/AlphaTest.php index 29a3d8b2f..c2bd0faca 100644 --- a/test/AlphaTest.php +++ b/test/AlphaTest.php @@ -24,6 +24,8 @@ */ namespace ZendTest\Validator; +use ReflectionClass; + /** * Test helper */ @@ -131,4 +133,40 @@ public function testNonStringValidation() { $this->assertFalse($this->_validator->isValid(array(1 => 1))); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From a0c4549690be36da31d1724b6171e718bf9f234b Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:05:59 +0600 Subject: [PATCH 12/28] Added Barcode test --- test/BarcodeTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/BarcodeTest.php b/test/BarcodeTest.php index 3e533b8a1..7b1b1dddb 100644 --- a/test/BarcodeTest.php +++ b/test/BarcodeTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator\Barcode; +use Zend\Validator\Barcode, + ReflectionClass; /** * \Zend\Validator\Barcode @@ -469,4 +470,40 @@ public function testEan13ContainsOnlyNumeric() $barcode = new Barcode('ean13'); $this->assertFalse($barcode->isValid('3RH1131-1BB40')); } + + public function testEqualsMessageTemplates() + { + $validator = new Barcode('code25'); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Barcode('code25'); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From ce1d37b2c2861a404d7022141e0b050897b5e12e Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:07:18 +0600 Subject: [PATCH 13/28] Added BetweenTest test --- test/BetweenTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/BetweenTest.php b/test/BetweenTest.php index b0b089a0d..e6478220f 100644 --- a/test/BetweenTest.php +++ b/test/BetweenTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -118,4 +119,40 @@ public function testGetInclusive() $validator = new Validator\Between(array('min' => 1, 'max' => 10)); $this->assertEquals(true, $validator->getInclusive()); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\Between(array('min' => 1, 'max' => 10)); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\Between(array('min' => 1, 'max' => 10)); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 3589be6047d0584d557d35aca864d8f6cd4f41db Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:08:34 +0600 Subject: [PATCH 14/28] Added CallbackTest test --- test/CallbackTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/CallbackTest.php b/test/CallbackTest.php index 932f80cad..45f81e90c 100644 --- a/test/CallbackTest.php +++ b/test/CallbackTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * @category Zend @@ -90,6 +91,42 @@ public function testAddingValueOptions() $this->assertTrue($valid->isValid('test', 'something')); } + public function testEqualsMessageTemplates() + { + $validator = new Validator\Callback(array($this, 'objectCallback')); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\Callback(array($this, 'objectCallback')); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } + public function objectCallback($value) { return true; From 1d01172864d81d4dd1ad31b33d0b908b8d0ecb43 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:10:11 +0600 Subject: [PATCH 15/28] Added CreditCardTest test --- test/CreditCardTest.php | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/test/CreditCardTest.php b/test/CreditCardTest.php index eb41b334d..171e4eaf1 100644 --- a/test/CreditCardTest.php +++ b/test/CreditCardTest.php @@ -23,8 +23,9 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; -use Zend\Config; +use Zend\Validator, + Zend\Config, + ReflectionClass; /** * Test helper @@ -257,6 +258,42 @@ public function testMultiInstitute() { $message = $validator->getMessages(); $this->assertContains('not from an allowed institute', current($message)); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\CreditCard(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\CreditCard(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } public static function staticCallback($value) { From 9f341638cf7f320ba8e1a257458463b06286b663 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:11:19 +0600 Subject: [PATCH 16/28] Added DigitsTest test --- test/DigitsTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/DigitsTest.php b/test/DigitsTest.php index 777029570..68d98167d 100644 --- a/test/DigitsTest.php +++ b/test/DigitsTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -127,4 +128,40 @@ public function testNonStringValidation() { $this->assertFalse($this->_validator->isValid(array(1 => 1))); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 70eb7422cf4209c3454693668887223adea35fe8 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:12:40 +0600 Subject: [PATCH 17/28] Added EmailAddressTest test --- test/EmailAddressTest.php | 41 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/test/EmailAddressTest.php b/test/EmailAddressTest.php index b9a3ad596..70b2f37d0 100644 --- a/test/EmailAddressTest.php +++ b/test/EmailAddressTest.php @@ -23,8 +23,9 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; -use Zend\Validator\Hostname; +use Zend\Validator, + Zend\Validator\Hostname, + ReflectionClass; /** * @category Zend @@ -591,4 +592,40 @@ public function testGetMXRecord() $result = $validator->getMXRecord(); $this->assertTrue(!empty($result)); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 82ceac88bb17fa4d03b6f428b45254854eeb03db Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:14:07 +0600 Subject: [PATCH 18/28] Added FloatTest test --- test/FloatTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/FloatTest.php b/test/FloatTest.php index 59d84ebeb..a5826fbde 100644 --- a/test/FloatTest.php +++ b/test/FloatTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -223,4 +224,40 @@ public function testPhpLocaleEnStringType() $this->assertFalse($valid->isValid('1000,3')); $this->assertFalse($valid->isValid('1.000,3')); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 127da5b60b80686ba64504ea89deb40ba360bd63 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:14:41 +0600 Subject: [PATCH 19/28] Added HexTest test --- test/HexTest.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/HexTest.php b/test/HexTest.php index ebfce5c55..1700be8c6 100644 --- a/test/HexTest.php +++ b/test/HexTest.php @@ -24,6 +24,8 @@ */ namespace ZendTest\Validator; +use ReflectionClass; + /** * Test helper */ @@ -100,4 +102,40 @@ public function testNonStringValidation() { $this->assertFalse($this->_validator->isValid(array(1 => 1))); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 228fab960f129ea1c8816ef52d4bcae27c742f38 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:15:26 +0600 Subject: [PATCH 20/28] Added HostnameTest test --- test/HostnameTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/HostnameTest.php b/test/HostnameTest.php index 9ba5355f8..cc2f1c2e8 100644 --- a/test/HostnameTest.php +++ b/test/HostnameTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator\Hostname; +use Zend\Validator\Hostname, + ReflectionClass; /** * @category Zend @@ -462,4 +463,40 @@ public function testIDNSI() $this->assertTrue($validator->isValid('tàrø.si')); $this->assertFalse($validator->isValid('رات.si')); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From a433c6e2767e8ddad95c002b81273f1523aa2025 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:16:45 +0600 Subject: [PATCH 21/28] Added IsbnTest test --- test/IsbnTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/IsbnTest.php b/test/IsbnTest.php index 666378a78..ae6812c8a 100644 --- a/test/IsbnTest.php +++ b/test/IsbnTest.php @@ -22,7 +22,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** @@ -233,4 +234,40 @@ public function testInvalidTypeGiven() $this->assertFalse($validator->isValid((float) 1.2345)); $this->assertFalse($validator->isValid((object) 'Test')); } + + public function testEqualsMessageTemplates() + { + $validator = new Validator\Isbn(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = new Validator\Isbn(); + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 5d3b24cf34d80b2018eee96b876b2695dd6c6806 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:17:27 +0600 Subject: [PATCH 22/28] Added MessageTest test --- test/MessageTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/MessageTest.php b/test/MessageTest.php index b35c91c1c..be2503b3e 100644 --- a/test/MessageTest.php +++ b/test/MessageTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * @category Zend @@ -266,5 +267,41 @@ public function testGetMessageVariables() $messages = $this->_validator->getMessages(); $this->assertEquals('variables: %notvar% 4 8 ', current($messages)); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 9fdcbefb928d99ceb755cab20b43541344ae56d0 Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:18:06 +0600 Subject: [PATCH 23/28] Added NotEmptyTest test --- test/NotEmptyTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/NotEmptyTest.php b/test/NotEmptyTest.php index 945b8f0e3..31440c3c0 100644 --- a/test/NotEmptyTest.php +++ b/test/NotEmptyTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * @category Zend @@ -603,6 +604,42 @@ public function testArrayConfigNotationWithoutKey() $this->assertTrue($filter->isValid(array('xxx'))); $this->assertTrue($filter->isValid(null)); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } class ClassTest1 {} From 94c1fba398b343ac8f6ea1648380d4ce309cd89e Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:18:49 +0600 Subject: [PATCH 24/28] Added PostCodeTest test --- test/PostCodeTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/PostCodeTest.php b/test/PostCodeTest.php index a8fa56c40..703d0799a 100644 --- a/test/PostCodeTest.php +++ b/test/PostCodeTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * @see Zend_Validator_PostCode @@ -199,4 +200,40 @@ public function testServiceClass() $message = $this->_validator->getMessages(); $this->assertContains('not appear to be a postal code', $message['postcodeService']); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From 7dee6907eb685c9bb16b43742eb518bca5f4f69b Mon Sep 17 00:00:00 2001 From: dchusovitin Date: Wed, 23 Nov 2011 15:19:29 +0600 Subject: [PATCH 25/28] Added StringLengthTest test --- test/StringLengthTest.php | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/StringLengthTest.php b/test/StringLengthTest.php index 72e682522..2eaaf665f 100644 --- a/test/StringLengthTest.php +++ b/test/StringLengthTest.php @@ -23,7 +23,8 @@ * @namespace */ namespace ZendTest\Validator; -use Zend\Validator; +use Zend\Validator, + ReflectionClass; /** * Test helper @@ -173,4 +174,40 @@ public function testNonStringValidation() { $this->assertFalse($this->_validator->isValid(array(1 => 1))); } + + public function testEqualsMessageTemplates() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageTemplates')) { + return; + } + + $property = $reflection->getProperty('_messageTemplates'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageTemplates') + ); + } + + public function testEqualsMessageVariables() + { + $validator = $this->_validator; + $reflection = new ReflectionClass($validator); + + if(!$reflection->hasProperty('_messageVariables')) { + return; + } + + $property = $reflection->getProperty('_messageVariables'); + $property->setAccessible(true); + + $this->assertEquals( + $property->getValue($validator), + $validator->getOption('messageVariables') + ); + } } From a30bc1678131cb5f15096e70a375961c0b4da127 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 9 Jan 2012 11:29:12 -0600 Subject: [PATCH 26/28] Added @group annotations for new tests --- test/EmailAddressTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/EmailAddressTest.php b/test/EmailAddressTest.php index 17ebc3604..c19d02ba6 100644 --- a/test/EmailAddressTest.php +++ b/test/EmailAddressTest.php @@ -629,6 +629,9 @@ public function testEqualsMessageVariables() ); } + /** + * @group ZF2-130 + */ public function testUseMxCheckBasicValid() { $validator = new Validator\EmailAddress(array( @@ -655,6 +658,9 @@ public function testUseMxCheckBasicValid() } } + /** + * @group ZF2-130 + */ public function testUseMxRecordsBasicInvalid() { $validator = new Validator\EmailAddress(array( 'useMxCheck' => true, From 8e9ac90036cecea59ec3c6641f6bd434ea1ded17 Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Sun, 12 Feb 2012 22:56:52 +0100 Subject: [PATCH 27/28] added missing use of Traversable --- src/Ip.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Ip.php b/src/Ip.php index 0b78ab691..ff71f7f07 100644 --- a/src/Ip.php +++ b/src/Ip.php @@ -23,6 +23,8 @@ */ namespace Zend\Validator; +use Traversable; + /** * @uses \Zend\Validator\AbstractValidator * @uses \Zend\Validator\Exception @@ -76,7 +78,7 @@ public function __construct($options = array()) $options += $this->_options; $this->setOptions($options); - + parent::__construct(); } From da4caadee6c29e64af75a203aa4f3fde54175575 Mon Sep 17 00:00:00 2001 From: Thinkscape Date: Thu, 8 Mar 2012 17:29:22 +0100 Subject: [PATCH 28/28] Refactor Zend\Stdlib\ArrayTools to ArrayUtils, add missing headers. - ArrayTools will now be called ArrayUtils after an anonymous vote (http://framework.zend.com/wiki/display/ZFDEV2/POLL+-+Array+class+name). - Add missing Zend Framework headers to ArrayUtils class file and tests. --- src/AbstractValidator.php | 4 ++-- src/CreditCard.php | 4 ++-- src/Date.php | 4 ++-- src/File/IsCompressed.php | 4 ++-- src/File/IsImage.php | 4 ++-- src/File/MimeType.php | 4 ++-- src/Iban.php | 4 ++-- src/Identical.php | 4 ++-- src/Regex.php | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/AbstractValidator.php b/src/AbstractValidator.php index ad531a446..83917422b 100644 --- a/src/AbstractValidator.php +++ b/src/AbstractValidator.php @@ -24,7 +24,7 @@ namespace Zend\Validator; use Traversable, - Zend\Stdlib\ArrayTools, + Zend\Stdlib\ArrayUtils, Zend\Translator, Zend\Validator\Exception\InvalidArgumentException; @@ -82,7 +82,7 @@ public function __construct($options = null) { // The abstract constructor allows no scalar values if ($options instanceof Traversable) { - $options = ArrayTools::iteratorToArray($options); + $options = ArrayUtils::iteratorToArray($options); } if (isset($this->_messageTemplates)) { diff --git a/src/CreditCard.php b/src/CreditCard.php index 35493bd74..3639d5c90 100644 --- a/src/CreditCard.php +++ b/src/CreditCard.php @@ -21,7 +21,7 @@ namespace Zend\Validator; use Traversable, - Zend\Stdlib\ArrayTools; + Zend\Stdlib\ArrayUtils; /** * @uses \Zend\Validator\AbstractValidator @@ -158,7 +158,7 @@ class CreditCard extends AbstractValidator public function __construct($options = array()) { if ($options instanceof Traversable) { - $options = ArrayTools::iteratorToArray($options); + $options = ArrayUtils::iteratorToArray($options); } else if (!is_array($options)) { $options = func_get_args(); $temp['type'] = array_shift($options); diff --git a/src/Date.php b/src/Date.php index 6e3dbeefd..5d3d5c530 100644 --- a/src/Date.php +++ b/src/Date.php @@ -28,7 +28,7 @@ Zend\Locale\Format, Zend\Locale\Locale, Zend\Registry, - Zend\Stdlib\ArrayTools; + Zend\Stdlib\ArrayUtils; /** * @category Zend @@ -83,7 +83,7 @@ class Date extends AbstractValidator public function __construct($options = array()) { if ($options instanceof Traversable) { - $options = ArrayTools::iteratorToArray($options); + $options = ArrayUtils::iteratorToArray($options); } elseif (!is_array($options)) { $options = func_get_args(); $temp['format'] = array_shift($options); diff --git a/src/File/IsCompressed.php b/src/File/IsCompressed.php index 9fd13ae01..d0aac1969 100644 --- a/src/File/IsCompressed.php +++ b/src/File/IsCompressed.php @@ -21,7 +21,7 @@ namespace Zend\Validator\File; use Traversable, - Zend\Stdlib\ArrayTools; + Zend\Stdlib\ArrayUtils; /** * Validator which checks if the file already exists in the directory @@ -94,7 +94,7 @@ public function __construct($options = array()) ); if ($options instanceof Traversable) { - $options = ArrayTools::iteratorToArray($options); + $options = ArrayUtils::iteratorToArray($options); } if (empty($options)) { diff --git a/src/File/IsImage.php b/src/File/IsImage.php index 3f7351c83..2f8d1c598 100644 --- a/src/File/IsImage.php +++ b/src/File/IsImage.php @@ -21,7 +21,7 @@ namespace Zend\Validator\File; use Traversable, - Zend\Stdlib\ArrayTools; + Zend\Stdlib\ArrayUtils; /** * Validator which checks if the file already exists in the directory @@ -119,7 +119,7 @@ public function __construct($options = array()) ); if ($options instanceof Traversable) { - $options = ArrayTools::iteratorToArray($options); + $options = ArrayUtils::iteratorToArray($options); } if (empty($options)) { diff --git a/src/File/MimeType.php b/src/File/MimeType.php index b71d8d7e3..7b18254b8 100644 --- a/src/File/MimeType.php +++ b/src/File/MimeType.php @@ -25,7 +25,7 @@ use Traversable, Zend\Loader, - Zend\Stdlib\ArrayTools, + Zend\Stdlib\ArrayUtils, Zend\Validator\AbstractValidator, Zend\Validator\Exception; @@ -117,7 +117,7 @@ class MimeType extends AbstractValidator public function __construct($options = null) { if ($options instanceof Traversable) { - $options = ArrayTools::iteratorToArray($options); + $options = ArrayUtils::iteratorToArray($options); } elseif (is_string($options)) { $this->setMimeType($options); $options = array(); diff --git a/src/Iban.php b/src/Iban.php index e6b87b6e0..8c17c1ef7 100644 --- a/src/Iban.php +++ b/src/Iban.php @@ -23,7 +23,7 @@ use Traversable, Zend\Locale\Locale, Zend\Registry, - Zend\Stdlib\ArrayTools; + Zend\Stdlib\ArrayUtils; /** * Validates IBAN Numbers (International Bank Account Numbers) @@ -114,7 +114,7 @@ public function __construct($locale = null) { $options = array(); if ($locale instanceof Traversable) { - $locale = ArrayTools::iteratorToArray($locale); + $locale = ArrayUtils::iteratorToArray($locale); } if (is_array($locale)) { diff --git a/src/Identical.php b/src/Identical.php index 36f8a85c8..5b86cc08c 100644 --- a/src/Identical.php +++ b/src/Identical.php @@ -24,7 +24,7 @@ namespace Zend\Validator; use Traversable, - Zend\Stdlib\ArrayTools; + Zend\Stdlib\ArrayUtils; /** * @uses \Zend\Validator\AbstractValidator @@ -75,7 +75,7 @@ class Identical extends AbstractValidator public function __construct($token = null) { if ($token instanceof Traversable) { - $token = ArrayTools::iteratorToArray($token); + $token = ArrayUtils::iteratorToArray($token); } if (is_array($token) && array_key_exists('token', $token)) { diff --git a/src/Regex.php b/src/Regex.php index 2e1220d66..29c6667fc 100644 --- a/src/Regex.php +++ b/src/Regex.php @@ -24,7 +24,7 @@ namespace Zend\Validator; use Traversable, - Zend\Stdlib\ArrayTools; + Zend\Stdlib\ArrayUtils; /** * @uses \Zend\Validator\AbstractValidator @@ -79,7 +79,7 @@ public function __construct($pattern) } if ($pattern instanceof Traversable) { - $pattern = ArrayTools::iteratorToArray($pattern); + $pattern = ArrayUtils::iteratorToArray($pattern); } if (!is_array($pattern)) {