Merge remote-tracking branch 'origin/master' into 2.3

This commit is contained in:
Jose Lorenzo Rodriguez 2012-12-01 23:19:53 +01:00
commit 0f5fa290ed
6 changed files with 19 additions and 3 deletions

View file

@ -928,6 +928,9 @@ class HashTest extends CakeTestCase {
* @return void
*/
public function testSort() {
$result = Hash::sort(array(), '{n}.name', 'asc');
$this->assertEquals(array(), $result);
$a = array(
0 => array(
'Person' => array('name' => 'Jeff'),

View file

@ -225,6 +225,9 @@ class SetTest extends CakeTestCase {
* @return void
*/
public function testSort() {
$result = Set::sort(array(), '{n}.name', 'asc');
$this->assertEquals(array(), $result);
$a = array(
0 => array('Person' => array('name' => 'Jeff'), 'Friend' => array(array('name' => 'Nate'))),
1 => array('Person' => array('name' => 'Tracy'),'Friend' => array(array('name' => 'Lindsay')))

View file

@ -1655,6 +1655,11 @@ class ValidationTest extends CakeTestCase {
$this->assertTrue(Validation::email('abc@example.travel'));
$this->assertTrue(Validation::email('someone@st.t-com.hr'));
// gTLD's
$this->assertTrue(Validation::email('example@host.local'));
$this->assertTrue(Validation::email('example@x.org'));
$this->assertTrue(Validation::email('example@host.xxx'));
// strange, but technically valid email addresses
$this->assertTrue(Validation::email('S=postmaster/OU=rz/P=uni-frankfurt/A=d400/C=de@gateway.d400.de'));
$this->assertTrue(Validation::email('customer/department=shipping@example.com'));
@ -1669,7 +1674,6 @@ class ValidationTest extends CakeTestCase {
$this->assertFalse(Validation::email('abc.@example.com'));
$this->assertFalse(Validation::email('abc@example..com'));
$this->assertFalse(Validation::email('abc@example.com.a'));
$this->assertFalse(Validation::email('abc@example.toolong'));
$this->assertFalse(Validation::email('abc;@example.com'));
$this->assertFalse(Validation::email('abc@example.com;'));
$this->assertFalse(Validation::email('abc@efg@example.com'));
@ -1839,11 +1843,11 @@ class ValidationTest extends CakeTestCase {
$this->assertTrue(Validation::url('http://example.com/~userdir/'));
$this->assertTrue(Validation::url('http://underscore_subdomain.example.org'));
$this->assertTrue(Validation::url('http://_jabber._tcp.gmail.com'));
$this->assertTrue(Validation::url('http://www.domain.longttldnotallowed'));
$this->assertFalse(Validation::url('ftps://256.168.0.1/pub/cake'));
$this->assertFalse(Validation::url('ftp://256.168.0.1/pub/cake'));
$this->assertFalse(Validation::url('http://w_w.domain.co_m'));
$this->assertFalse(Validation::url('http://www.domain.12com'));
$this->assertFalse(Validation::url('http://www.domain.longttldnotallowed'));
$this->assertFalse(Validation::url('http://www.-invaliddomain.tld'));
$this->assertFalse(Validation::url('http://www.domain.-invalidtld'));
$this->assertFalse(Validation::url('http://this-domain-is-too-loooooong-by-icann-rules-maximum-length-is-63.com'));

View file

@ -732,6 +732,9 @@ class Hash {
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::sort
*/
public static function sort(array $data, $path, $dir, $type = 'regular') {
if (empty($data)) {
return array();
}
$originalKeys = array_keys($data);
$numeric = is_numeric(implode('', $originalKeys));
if ($numeric) {

View file

@ -956,6 +956,9 @@ class Set {
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::sort
*/
public static function sort($data, $path, $dir) {
if (empty($data)) {
return $data;
}
$originalKeys = array_keys($data);
$numeric = false;
if (is_numeric(implode('', $originalKeys))) {

View file

@ -39,7 +39,7 @@ class Validation {
* @var array
*/
protected static $_pattern = array(
'hostname' => '(?:[-_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,4}|museum|travel)'
'hostname' => '(?:[-_a-z0-9][-_a-z0-9]*\.)*(?:[a-z0-9][-a-z0-9]{0,62})\.(?:(?:[a-z]{2}\.)?[a-z]{2,})'
);
/**