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

Commit

Permalink
Merge branch 'master' into ValidatorMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej Szendi committed Nov 4, 2013
Show file tree
Hide file tree
Showing 68 changed files with 105 additions and 269 deletions.
15 changes: 6 additions & 9 deletions src/EmailAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,12 @@ protected function validateLocalPart()
if (preg_match('/^[' . $atext . ']+(\x2e+[' . $atext . ']+)*$/', $this->localPart)) {
$result = true;
} else {
// Try quoted string format

// Quoted-string characters are: DQUOTE *([FWS] qtext/quoted-pair) [FWS] DQUOTE
// qtext: Non white space controls, and the rest of the US-ASCII characters not
// including "\" or the quote character
$noWsCtl = '\x01-\x08\x0b\x0c\x0e-\x1f\x7f';
$qtext = $noWsCtl . '\x21\x23-\x5b\x5d-\x7e';
$ws = '\x20\x09';
if (preg_match('/^\x22([' . $ws . $qtext . '])*[$ws]?\x22$/', $this->localPart)) {
// Try quoted string format (RFC 5321 Chapter 4.1.2)

// Quoted-string characters are: DQUOTE *(qtext/quoted-pair) DQUOTE
$qtext = '\x20-\x21\x23-\x5b\x5d-\x7e'; // %d32-33 / %d35-91 / %d93-126
$quotedPair = '\x20-\x7e'; // %d92 %d32-126
if (preg_match('/^"(['. $qtext .']|\x5c[' . $quotedPair . '])*"$/', $this->localPart)) {
$result = true;
} else {
$this->error(self::DOT_ATOM);
Expand Down
2 changes: 1 addition & 1 deletion src/File/Exists.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getDirectory($asArray = false)
$asArray = (bool) $asArray;
$directory = $this->options['directory'];
if ($asArray && isset($directory)) {
$directory = explode(',', (string)$directory);
$directory = explode(',', (string) $directory);
}

return $directory;
Expand Down
42 changes: 21 additions & 21 deletions src/File/MimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,31 +101,31 @@ public function __construct($options = null)
} elseif (is_string($options)) {
$this->setMimeType($options);
$options = array();
}

if (isset($options['magicFile'])) {
$this->setMagicFile($options['magicFile']);
unset($options['magicFile']);
}
} elseif (is_array($options)) {
if (isset($options['magicFile'])) {
$this->setMagicFile($options['magicFile']);
unset($options['magicFile']);
}

if (isset($options['enableHeaderCheck'])) {
$this->enableHeaderCheck($options['enableHeaderCheck']);
unset($options['enableHeaderCheck']);
}
if (isset($options['enableHeaderCheck'])) {
$this->enableHeaderCheck($options['enableHeaderCheck']);
unset($options['enableHeaderCheck']);
}

if (array_key_exists('mimeType', $options)) {
$this->setMimeType($options['mimeType']);
unset($options['mimeType']);
}
if (array_key_exists('mimeType', $options)) {
$this->setMimeType($options['mimeType']);
unset($options['mimeType']);
}

// Handle cases where mimetypes are interspersed with options, or
// options are simply an array of mime types
foreach (array_keys($options) as $key) {
if (!is_int($key)) {
continue;
// Handle cases where mimetypes are interspersed with options, or
// options are simply an array of mime types
foreach (array_keys($options) as $key) {
if (!is_int($key)) {
continue;
}
$this->addMimeType($options[$key]);
unset($options[$key]);
}
$this->addMimeType($options[$key]);
unset($options[$key]);
}

parent::__construct($options);
Expand Down
4 changes: 2 additions & 2 deletions src/Hostname.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public function getIdnCheck()
* @param bool $useIdnCheck Set to true to validate IDN domains
* @return Hostname
*/
public function useIdnCheck ($useIdnCheck)
public function useIdnCheck($useIdnCheck)
{
$this->options['useIdnCheck'] = (bool) $useIdnCheck;
return $this;
Expand All @@ -429,7 +429,7 @@ public function getTldCheck()
* @param bool $useTldCheck Set to true to validate TLD elements
* @return Hostname
*/
public function useTldCheck ($useTldCheck)
public function useTldCheck($useTldCheck)
{
$this->options['useTldCheck'] = (bool) $useTldCheck;
return $this;
Expand Down
16 changes: 12 additions & 4 deletions test/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;
Expand All @@ -16,9 +15,6 @@
use Zend\Validator\Hostname;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class AbstractTest extends \PHPUnit_Framework_TestCase
Expand Down Expand Up @@ -74,6 +70,10 @@ public function testGlobalDefaultTranslatorNullByDefault()

public function testErrorMessagesAreTranslatedWhenTranslatorPresent()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$loader = new TestAsset\ArrayTranslator();
$loader->translations = array(
'fooMessage' => 'This is the translated message for %value%',
Expand All @@ -92,6 +92,10 @@ public function testErrorMessagesAreTranslatedWhenTranslatorPresent()

public function testCanTranslateMessagesInsteadOfKeys()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$loader = new TestAsset\ArrayTranslator();
$loader->translations = array(
'%value% was passed' => 'This is the translated message for %value%',
Expand Down Expand Up @@ -153,6 +157,10 @@ public function testTranslatorEnabledPerDefault()

public function testCanDisableTranslator()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$loader = new TestAsset\ArrayTranslator();
$loader->translations = array(
'%value% was passed' => 'This is the translated message for %value%',
Expand Down
4 changes: 0 additions & 4 deletions test/BarcodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;
Expand All @@ -15,9 +14,6 @@
/**
* \Zend\Barcode
*
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class BarcodeTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/BetweenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;

use Zend\Validator\Between;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class BetweenTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/CallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;

use Zend\Validator\Callback;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class CallbackTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/CreditCardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;
Expand All @@ -14,9 +13,6 @@
use Zend\Validator\CreditCard;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class CreditCardTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/CsrfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;
Expand All @@ -17,9 +16,6 @@
/**
* Zend\Csrf
*
* @category Zend
* @package Zend
* @subpackage UnitTests
* @group Zend_Validator
*/
class CsrfTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/DateStepTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;
Expand All @@ -15,9 +14,6 @@
use DateInterval;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class DateStepTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/DateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;
Expand All @@ -15,9 +14,6 @@
use Zend\Validator;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class DateTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Db/NoRecordExistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator\Db;
Expand All @@ -15,9 +14,6 @@
use ArrayObject;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class NoRecordExistsTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/Db/RecordExistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator\Db;
Expand All @@ -18,9 +17,6 @@
use ZendTest\Db\TestAsset\TrustingSql92Platform;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class RecordExistsTest extends \PHPUnit_Framework_TestCase
Expand Down
4 changes: 0 additions & 4 deletions test/DigitsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Validator
*/

namespace ZendTest\Validator;

use Zend\Validator\Digits;

/**
* @category Zend
* @package Zend_Validator
* @subpackage UnitTests
* @group Zend_Validator
*/
class DigitsTest extends \PHPUnit_Framework_TestCase
Expand Down
Loading

0 comments on commit 838bdc9

Please sign in to comment.