mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge remote-tracking branch 'origin/master' into 2.3
This commit is contained in:
commit
0f5fa290ed
6 changed files with 19 additions and 3 deletions
|
@ -928,6 +928,9 @@ class HashTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSort() {
|
public function testSort() {
|
||||||
|
$result = Hash::sort(array(), '{n}.name', 'asc');
|
||||||
|
$this->assertEquals(array(), $result);
|
||||||
|
|
||||||
$a = array(
|
$a = array(
|
||||||
0 => array(
|
0 => array(
|
||||||
'Person' => array('name' => 'Jeff'),
|
'Person' => array('name' => 'Jeff'),
|
||||||
|
|
|
@ -225,6 +225,9 @@ class SetTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSort() {
|
public function testSort() {
|
||||||
|
$result = Set::sort(array(), '{n}.name', 'asc');
|
||||||
|
$this->assertEquals(array(), $result);
|
||||||
|
|
||||||
$a = array(
|
$a = array(
|
||||||
0 => array('Person' => array('name' => 'Jeff'), 'Friend' => array(array('name' => 'Nate'))),
|
0 => array('Person' => array('name' => 'Jeff'), 'Friend' => array(array('name' => 'Nate'))),
|
||||||
1 => array('Person' => array('name' => 'Tracy'),'Friend' => array(array('name' => 'Lindsay')))
|
1 => array('Person' => array('name' => 'Tracy'),'Friend' => array(array('name' => 'Lindsay')))
|
||||||
|
|
|
@ -1655,6 +1655,11 @@ class ValidationTest extends CakeTestCase {
|
||||||
$this->assertTrue(Validation::email('abc@example.travel'));
|
$this->assertTrue(Validation::email('abc@example.travel'));
|
||||||
$this->assertTrue(Validation::email('someone@st.t-com.hr'));
|
$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
|
// 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('S=postmaster/OU=rz/P=uni-frankfurt/A=d400/C=de@gateway.d400.de'));
|
||||||
$this->assertTrue(Validation::email('customer/department=shipping@example.com'));
|
$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'));
|
$this->assertFalse(Validation::email('abc@example..com'));
|
||||||
$this->assertFalse(Validation::email('abc@example.com.a'));
|
$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@example.com;'));
|
$this->assertFalse(Validation::email('abc@example.com;'));
|
||||||
$this->assertFalse(Validation::email('abc@efg@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://example.com/~userdir/'));
|
||||||
$this->assertTrue(Validation::url('http://underscore_subdomain.example.org'));
|
$this->assertTrue(Validation::url('http://underscore_subdomain.example.org'));
|
||||||
$this->assertTrue(Validation::url('http://_jabber._tcp.gmail.com'));
|
$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('ftps://256.168.0.1/pub/cake'));
|
||||||
$this->assertFalse(Validation::url('ftp://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://w_w.domain.co_m'));
|
||||||
$this->assertFalse(Validation::url('http://www.domain.12com'));
|
$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.-invaliddomain.tld'));
|
||||||
$this->assertFalse(Validation::url('http://www.domain.-invalidtld'));
|
$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'));
|
$this->assertFalse(Validation::url('http://this-domain-is-too-loooooong-by-icann-rules-maximum-length-is-63.com'));
|
||||||
|
|
|
@ -732,6 +732,9 @@ class Hash {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::sort
|
* @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') {
|
public static function sort(array $data, $path, $dir, $type = 'regular') {
|
||||||
|
if (empty($data)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$originalKeys = array_keys($data);
|
$originalKeys = array_keys($data);
|
||||||
$numeric = is_numeric(implode('', $originalKeys));
|
$numeric = is_numeric(implode('', $originalKeys));
|
||||||
if ($numeric) {
|
if ($numeric) {
|
||||||
|
|
|
@ -956,6 +956,9 @@ class Set {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::sort
|
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::sort
|
||||||
*/
|
*/
|
||||||
public static function sort($data, $path, $dir) {
|
public static function sort($data, $path, $dir) {
|
||||||
|
if (empty($data)) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
$originalKeys = array_keys($data);
|
$originalKeys = array_keys($data);
|
||||||
$numeric = false;
|
$numeric = false;
|
||||||
if (is_numeric(implode('', $originalKeys))) {
|
if (is_numeric(implode('', $originalKeys))) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Validation {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected static $_pattern = 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,})'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue