mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix most coding standards issues in Test/Case/Utility
This commit is contained in:
parent
4e94ebe710
commit
1efee89169
11 changed files with 217 additions and 198 deletions
|
@ -108,7 +108,7 @@ class CakeNumberTest extends CakeTestCase {
|
|||
$expected = '100 100 100,00€';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(1000.45, NULL, array('after' => 'øre', 'before' => 'Kr. ', 'decimals' => ',', 'thousands' => '.'));
|
||||
$result = $this->Number->currency(1000.45, null, array('after' => 'øre', 'before' => 'Kr. ', 'decimals' => ',', 'thousands' => '.'));
|
||||
$expected = 'Kr. 1.000,45';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
@ -116,7 +116,7 @@ class CakeNumberTest extends CakeTestCase {
|
|||
$expected = '50c';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->currency(0.5, NULL, array('after' => 'øre'));
|
||||
$result = $this->Number->currency(0.5, null, array('after' => 'øre'));
|
||||
$expected = '50øre';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
@ -247,7 +247,6 @@ class CakeNumberTest extends CakeTestCase {
|
|||
$result = $this->Number->currency($value, 'GBP', array('negative' => '-'));
|
||||
$expected = '-£100,100,100.00';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -400,39 +399,39 @@ class CakeNumberTest extends CakeTestCase {
|
|||
$expected = '1 KB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*512);
|
||||
$result = $this->Number->toReadableSize(1024 * 512);
|
||||
$expected = '512 KB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024-1);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 - 1);
|
||||
$expected = '1.00 MB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024*512);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 * 512);
|
||||
$expected = '512.00 MB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024*1024-1);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 - 1);
|
||||
$expected = '1.00 GB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024*1024*512);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 512);
|
||||
$expected = '512.00 GB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024*1024*1024-1);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 - 1);
|
||||
$expected = '1.00 TB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024*1024*1024*512);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 512);
|
||||
$expected = '512.00 TB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024*1024*1024*1024-1);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 1024 - 1);
|
||||
$expected = '1024.00 TB';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->Number->toReadableSize(1024*1024*1024*1024*1024*1024);
|
||||
$result = $this->Number->toReadableSize(1024 * 1024 * 1024 * 1024 * 1024 * 1024);
|
||||
$expected = (1024 * 1024) . '.00 TB';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
@ -459,4 +458,5 @@ class CakeNumberTest extends CakeTestCase {
|
|||
$expected = '0.0000%';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ class CakeTimeTest extends CakeTestCase {
|
|||
$hours = 0;
|
||||
$minutes = 0;
|
||||
$seconds = 0;
|
||||
$relative_date = '';
|
||||
$relativeDate = '';
|
||||
|
||||
// Trying to take into account the number of days in a month
|
||||
$month = date('m') - $months;
|
||||
|
@ -137,43 +137,43 @@ class CakeTimeTest extends CakeTestCase {
|
|||
|
||||
if ($years > 0) {
|
||||
// years and months and days
|
||||
$relative_date .= ($relative_date ? ', -' : '-') . $years . ' year' . ($years > 1 ? 's' : '');
|
||||
$relative_date .= $months > 0 ? ($relative_date ? ', -' : '-') . $months . ' month' . ($months > 1 ? 's' : '') : '';
|
||||
$relative_date .= $weeks > 0 ? ($relative_date ? ', -' : '-') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relative_date .= $days > 0 ? ($relative_date ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', -' : '-') . $years . ' year' . ($years > 1 ? 's' : '');
|
||||
$relativeDate .= $months > 0 ? ($relativeDate ? ', -' : '-') . $months . ' month' . ($months > 1 ? 's' : '') : '';
|
||||
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', -' : '-') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relativeDate .= $days > 0 ? ($relativeDate ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
} elseif (abs($months) > 0) {
|
||||
// months, weeks and days
|
||||
$relative_date .= ($relative_date ? ', -' : '-') . $months . ' month' . ($months > 1 ? 's' : '');
|
||||
$relative_date .= $weeks > 0 ? ($relative_date ? ', -' : '-') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relative_date .= $days > 0 ? ($relative_date ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', -' : '-') . $months . ' month' . ($months > 1 ? 's' : '');
|
||||
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', -' : '-') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relativeDate .= $days > 0 ? ($relativeDate ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
} elseif (abs($weeks) > 0) {
|
||||
// weeks and days
|
||||
$relative_date .= ($relative_date ? ', -' : '-') . $weeks . ' week' . ($weeks > 1 ? 's' : '');
|
||||
$relative_date .= $days > 0 ? ($relative_date ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', -' : '-') . $weeks . ' week' . ($weeks > 1 ? 's' : '');
|
||||
$relativeDate .= $days > 0 ? ($relativeDate ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
} elseif (abs($days) > 0) {
|
||||
// days and hours
|
||||
$relative_date .= ($relative_date ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '');
|
||||
$relative_date .= $hours > 0 ? ($relative_date ? ', -' : '-') . $hours . ' hour' . ($hours > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', -' : '-') . $days . ' day' . ($days > 1 ? 's' : '');
|
||||
$relativeDate .= $hours > 0 ? ($relativeDate ? ', -' : '-') . $hours . ' hour' . ($hours > 1 ? 's' : '') : '';
|
||||
} elseif (abs($hours) > 0) {
|
||||
// hours and minutes
|
||||
$relative_date .= ($relative_date ? ', -' : '-') . $hours . ' hour' . ($hours > 1 ? 's' : '');
|
||||
$relative_date .= $minutes > 0 ? ($relative_date ? ', -' : '-') . $minutes . ' minute' . ($minutes > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', -' : '-') . $hours . ' hour' . ($hours > 1 ? 's' : '');
|
||||
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', -' : '-') . $minutes . ' minute' . ($minutes > 1 ? 's' : '') : '';
|
||||
} elseif (abs($minutes) > 0) {
|
||||
// minutes only
|
||||
$relative_date .= ($relative_date ? ', -' : '-') . $minutes . ' minute' . ($minutes > 1 ? 's' : '');
|
||||
$relativeDate .= ($relativeDate ? ', -' : '-') . $minutes . ' minute' . ($minutes > 1 ? 's' : '');
|
||||
} else {
|
||||
// seconds only
|
||||
$relative_date .= ($relative_date ? ', -' : '-') . $seconds . ' second' . ($seconds != 1 ? 's' : '');
|
||||
$relativeDate .= ($relativeDate ? ', -' : '-') . $seconds . ' second' . ($seconds != 1 ? 's' : '');
|
||||
}
|
||||
|
||||
if (date('j/n/y', strtotime(str_replace(',', '', $relative_date))) != '1/1/70') {
|
||||
$result = $this->Time->timeAgoInWords(strtotime(str_replace(',', '', $relative_date)), array('end' => '8 years'), true);
|
||||
if ($relative_date == '0 seconds') {
|
||||
$relative_date = '0 seconds ago';
|
||||
if (date('j/n/y', strtotime(str_replace(',', '', $relativeDate))) != '1/1/70') {
|
||||
$result = $this->Time->timeAgoInWords(strtotime(str_replace(',', '', $relativeDate)), array('end' => '8 years'), true);
|
||||
if ($relativeDate == '0 seconds') {
|
||||
$relativeDate = '0 seconds ago';
|
||||
}
|
||||
|
||||
$relative_date = str_replace('-', '', $relative_date) . ' ago';
|
||||
$this->assertEquals($result, $relative_date);
|
||||
$relativeDate = str_replace('-', '', $relativeDate) . ' ago';
|
||||
$this->assertEquals($result, $relativeDate);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -187,47 +187,47 @@ class CakeTimeTest extends CakeTestCase {
|
|||
$minutes = 0;
|
||||
$seconds = 0;
|
||||
|
||||
$relative_date = '';
|
||||
$relativeDate = '';
|
||||
|
||||
if ($years > 0) {
|
||||
// years and months and days
|
||||
$relative_date .= ($relative_date ? ', ' : '') . $years . ' year' . ($years > 1 ? 's' : '');
|
||||
$relative_date .= $months > 0 ? ($relative_date ? ', ' : '') . $months . ' month' . ($months > 1 ? 's' : '') : '';
|
||||
$relative_date .= $weeks > 0 ? ($relative_date ? ', ' : '') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', ' : '') . $years . ' year' . ($years > 1 ? 's' : '');
|
||||
$relativeDate .= $months > 0 ? ($relativeDate ? ', ' : '') . $months . ' month' . ($months > 1 ? 's' : '') : '';
|
||||
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
} elseif (abs($months) > 0) {
|
||||
// months, weeks and days
|
||||
$relative_date .= ($relative_date ? ', ' : '') . $months . ' month' . ($months > 1 ? 's' : '');
|
||||
$relative_date .= $weeks > 0 ? ($relative_date ? ', ' : '') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', ' : '') . $months . ' month' . ($months > 1 ? 's' : '');
|
||||
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' week' . ($weeks > 1 ? 's' : '') : '';
|
||||
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
} elseif (abs($weeks) > 0) {
|
||||
// weeks and days
|
||||
$relative_date .= ($relative_date ? ', ' : '') . $weeks . ' week' . ($weeks > 1 ? 's' : '');
|
||||
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', ' : '') . $weeks . ' week' . ($weeks > 1 ? 's' : '');
|
||||
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '') : '';
|
||||
} elseif (abs($days) > 0) {
|
||||
// days and hours
|
||||
$relative_date .= ($relative_date ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '');
|
||||
$relative_date .= $hours > 0 ? ($relative_date ? ', ' : '') . $hours . ' hour' . ($hours > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', ' : '') . $days . ' day' . ($days > 1 ? 's' : '');
|
||||
$relativeDate .= $hours > 0 ? ($relativeDate ? ', ' : '') . $hours . ' hour' . ($hours > 1 ? 's' : '') : '';
|
||||
} elseif (abs($hours) > 0) {
|
||||
// hours and minutes
|
||||
$relative_date .= ($relative_date ? ', ' : '') . $hours . ' hour' . ($hours > 1 ? 's' : '');
|
||||
$relative_date .= $minutes > 0 ? ($relative_date ? ', ' : '') . $minutes . ' minute' . ($minutes > 1 ? 's' : '') : '';
|
||||
$relativeDate .= ($relativeDate ? ', ' : '') . $hours . ' hour' . ($hours > 1 ? 's' : '');
|
||||
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', ' : '') . $minutes . ' minute' . ($minutes > 1 ? 's' : '') : '';
|
||||
} elseif (abs($minutes) > 0) {
|
||||
// minutes only
|
||||
$relative_date .= ($relative_date ? ', ' : '') . $minutes . ' minute' . ($minutes > 1 ? 's' : '');
|
||||
$relativeDate .= ($relativeDate ? ', ' : '') . $minutes . ' minute' . ($minutes > 1 ? 's' : '');
|
||||
} else {
|
||||
// seconds only
|
||||
$relative_date .= ($relative_date ? ', ' : '') . $seconds . ' second' . ($seconds != 1 ? 's' : '');
|
||||
$relativeDate .= ($relativeDate ? ', ' : '') . $seconds . ' second' . ($seconds != 1 ? 's' : '');
|
||||
}
|
||||
|
||||
if (date('j/n/y', strtotime(str_replace(',', '', $relative_date))) != '1/1/70') {
|
||||
$result = $this->Time->timeAgoInWords(strtotime(str_replace(',', '', $relative_date)), array('end' => '8 years'), true);
|
||||
if ($relative_date == '0 seconds') {
|
||||
$relative_date = '0 seconds ago';
|
||||
if (date('j/n/y', strtotime(str_replace(',', '', $relativeDate))) != '1/1/70') {
|
||||
$result = $this->Time->timeAgoInWords(strtotime(str_replace(',', '', $relativeDate)), array('end' => '8 years'), true);
|
||||
if ($relativeDate == '0 seconds') {
|
||||
$relativeDate = '0 seconds ago';
|
||||
}
|
||||
|
||||
$relative_date = str_replace('-', '', $relative_date) . '';
|
||||
$this->assertEquals($result, $relative_date);
|
||||
$relativeDate = str_replace('-', '', $relativeDate) . '';
|
||||
$this->assertEquals($result, $relativeDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ class CakeTimeTest extends CakeTestCase {
|
|||
$begin = time();
|
||||
$end = time() + DAY;
|
||||
$field = 'my_field';
|
||||
$expected = '(my_field >= \''.date('Y-m-d', $begin).' 00:00:00\') AND (my_field <= \''.date('Y-m-d', $end).' 23:59:59\')';
|
||||
$expected = '(my_field >= \'' . date('Y-m-d', $begin) . ' 00:00:00\') AND (my_field <= \'' . date('Y-m-d', $end) . ' 23:59:59\')';
|
||||
$this->assertEquals($expected, $this->Time->daysAsSql($begin, $end, $field));
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ class CakeTimeTest extends CakeTestCase {
|
|||
public function testDayAsSql() {
|
||||
$time = time();
|
||||
$field = 'my_field';
|
||||
$expected = '(my_field >= \''.date('Y-m-d', $time).' 00:00:00\') AND (my_field <= \''.date('Y-m-d', $time).' 23:59:59\')';
|
||||
$expected = '(my_field >= \'' . date('Y-m-d', $time) . ' 00:00:00\') AND (my_field <= \'' . date('Y-m-d', $time) . ' 23:59:59\')';
|
||||
$this->assertEquals($expected, $this->Time->dayAsSql($time, $field));
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,6 @@ class CakeTimeTest extends CakeTestCase {
|
|||
$this->assertFalse($result);
|
||||
$result = $this->Time->isThisMonth(mktime(0, 0, 0, date('m'), mt_rand(1, 28), date('Y') + mt_rand(1, 12)));
|
||||
$this->assertFalse($result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -122,7 +122,7 @@ class RegisterCategory extends ClassRegisterModel {
|
|||
*/
|
||||
public $name = 'RegisterCategory';
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* RegisterPrefixedDs class
|
||||
*
|
||||
* @package Cake.Test.Case.Utility
|
||||
|
@ -142,7 +142,8 @@ class RegisterPrefixedDs extends ClassRegisterModel {
|
|||
*/
|
||||
abstract class ClassRegistryAbstractModel extends ClassRegisterModel {
|
||||
|
||||
abstract function doSomething();
|
||||
public abstract function doSomething();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,6 +152,7 @@ abstract class ClassRegistryAbstractModel extends ClassRegisterModel {
|
|||
interface ClassRegistryInterfaceTest {
|
||||
|
||||
public function doSomething();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,7 +168,6 @@ class ClassRegistryTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testAddModel() {
|
||||
|
||||
$Tag = ClassRegistry::init('RegisterArticleTag');
|
||||
$this->assertTrue(is_a($Tag, 'RegisterArticleTag'));
|
||||
|
||||
|
@ -183,7 +184,6 @@ class ClassRegistryTest extends CakeTestCase {
|
|||
$NewTag = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
|
||||
$this->assertTrue(is_a($Tag, 'RegisterArticleTag'));
|
||||
|
||||
|
||||
$NewTagCopy = ClassRegistry::init(array('class' => 'RegisterArticleTag', 'alias' => 'NewTag'));
|
||||
|
||||
$this->assertNotSame($Tag, $NewTag);
|
||||
|
|
|
@ -29,13 +29,13 @@ class DebuggerTestCaseDebugger extends Debugger {
|
|||
/**
|
||||
* DebuggerTest class
|
||||
*
|
||||
* !!! Be careful with changing code below as it may
|
||||
* !!! change line numbers which are used in the tests
|
||||
*
|
||||
* @package Cake.Test.Case.Utility
|
||||
*/
|
||||
class DebuggerTest extends CakeTestCase {
|
||||
// !!!
|
||||
// !!! Be careful with changing code below as it may
|
||||
// !!! change line numbers which are used in the tests
|
||||
// !!!
|
||||
|
||||
protected $_restoreError = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -76,7 +76,7 @@ class FileTest extends CakeTestCase {
|
|||
'dirname' => dirname(__FILE__),
|
||||
'basename' => basename(__FILE__),
|
||||
'extension' => 'php',
|
||||
'filename' =>'FileTest',
|
||||
'filename' => 'FileTest',
|
||||
'filesize' => filesize($file),
|
||||
'mime' => 'text/x-php'
|
||||
);
|
||||
|
@ -179,7 +179,7 @@ class FileTest extends CakeTestCase {
|
|||
$this->assertEquals($expecting, $result);
|
||||
|
||||
$result = $this->File->offset();
|
||||
$expecting = 5+3;
|
||||
$expecting = 5 + 3;
|
||||
$this->assertSame($result, $expecting);
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreate() {
|
||||
$tmpFile = TMP.'tests' . DS . 'cakephp.file.test.tmp';
|
||||
$tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp';
|
||||
$File = new File($tmpFile, true, 0777);
|
||||
$this->assertTrue($File->exists());
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertTrue($result);
|
||||
|
||||
$result = $Folder->realpath('Test/');
|
||||
$this->assertEquals($result, $path . DS .'Test' . DS);
|
||||
$this->assertEquals($result, $path . DS . 'Test' . DS);
|
||||
|
||||
$result = $Folder->inPath('Test' . DS);
|
||||
$this->assertTrue($result);
|
||||
|
@ -406,27 +406,27 @@ class FolderTest extends CakeTestCase {
|
|||
array(
|
||||
CAKE . 'Config',
|
||||
CAKE . 'Config' . DS . 'unicode',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding'
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding'
|
||||
),
|
||||
array(
|
||||
CAKE . 'Config' . DS . 'config.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0080_00ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0100_017f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0180_024F.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0250_02af.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0370_03ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0400_04ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0500_052f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0530_058f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '1e00_1eff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '1f00_1fff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2100_214f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2150_218f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2460_24ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2c00_2c5f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2c60_2c7f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2c80_2cff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . 'ff00_ffef.php'
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0080_00ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0100_017f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0180_024F.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0250_02af.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0370_03ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0400_04ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0500_052f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '0530_058f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '1e00_1eff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '1f00_1fff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2100_214f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2150_218f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2460_24ff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2c00_2c5f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2c60_2c7f.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . '2c80_2cff.php',
|
||||
CAKE . 'Config' . DS . 'unicode' . DS . 'casefolding' . DS . 'ff00_ffef.php'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -809,46 +809,46 @@ class FolderTest extends CakeTestCase {
|
|||
*/
|
||||
public function testCopy() {
|
||||
$path = TMP . 'folder_test';
|
||||
$folder1 = $path . DS . 'folder1';
|
||||
$folder2 = $folder1 . DS . 'folder2';
|
||||
$folder3 = $path . DS . 'folder3';
|
||||
$file1 = $folder1 . DS . 'file1.php';
|
||||
$file2 = $folder2 . DS . 'file2.php';
|
||||
$folderOne = $path . DS . 'folder1';
|
||||
$folderTwo = $folderOne . DS . 'folder2';
|
||||
$folderThree = $path . DS . 'folder3';
|
||||
$fileOne = $folderOne . DS . 'file1.php';
|
||||
$fileTwo = $folderTwo . DS . 'file2.php';
|
||||
|
||||
new Folder($path, true);
|
||||
new Folder($folder1, true);
|
||||
new Folder($folder2, true);
|
||||
new Folder($folder3, true);
|
||||
touch($file1);
|
||||
touch($file2);
|
||||
new Folder($folderOne, true);
|
||||
new Folder($folderTwo, true);
|
||||
new Folder($folderThree, true);
|
||||
touch($fileOne);
|
||||
touch($fileTwo);
|
||||
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->copy($folder3);
|
||||
$Folder = new Folder($folderOne);
|
||||
$result = $Folder->copy($folderThree);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'folder2' . DS . 'file2.php'));
|
||||
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder = new Folder($folderThree);
|
||||
$Folder->delete();
|
||||
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->copy($folder3);
|
||||
$Folder = new Folder($folderOne);
|
||||
$result = $Folder->copy($folderThree);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'folder2' . DS . 'file2.php'));
|
||||
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder = new Folder($folderThree);
|
||||
$Folder->delete();
|
||||
|
||||
new Folder($folder3, true);
|
||||
new Folder($folder3 . DS . 'folder2', true);
|
||||
file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched');
|
||||
new Folder($folderThree, true);
|
||||
new Folder($folderThree . DS . 'folder2', true);
|
||||
file_put_contents($folderThree . DS . 'folder2' . DS . 'file2.php', 'untouched');
|
||||
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->copy($folder3);
|
||||
$Folder = new Folder($folderOne);
|
||||
$result = $Folder->copy($folderThree);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertEquals(file_get_contents($folder3 . DS . 'folder2' . DS . 'file2.php'), 'untouched');
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
|
||||
$this->assertEquals(file_get_contents($folderThree . DS . 'folder2' . DS . 'file2.php'), 'untouched');
|
||||
|
||||
$Folder = new Folder($path);
|
||||
$Folder->delete();
|
||||
|
@ -866,68 +866,69 @@ class FolderTest extends CakeTestCase {
|
|||
*/
|
||||
public function testMove() {
|
||||
$path = TMP . 'folder_test';
|
||||
$folder1 = $path . DS . 'folder1';
|
||||
$folder2 = $folder1 . DS . 'folder2';
|
||||
$folder3 = $path . DS . 'folder3';
|
||||
$file1 = $folder1 . DS . 'file1.php';
|
||||
$file2 = $folder2 . DS . 'file2.php';
|
||||
$folderOne = $path . DS . 'folder1';
|
||||
$folderTwo = $folderOne . DS . 'folder2';
|
||||
$folderThree = $path . DS . 'folder3';
|
||||
$fileOne = $folderOne . DS . 'file1.php';
|
||||
$fileTwo = $folderTwo . DS . 'file2.php';
|
||||
|
||||
new Folder($path, true);
|
||||
new Folder($folder1, true);
|
||||
new Folder($folder2, true);
|
||||
new Folder($folder3, true);
|
||||
touch($file1);
|
||||
touch($file2);
|
||||
new Folder($folderOne, true);
|
||||
new Folder($folderTwo, true);
|
||||
new Folder($folderThree, true);
|
||||
touch($fileOne);
|
||||
touch($fileTwo);
|
||||
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->move($folder3);
|
||||
$Folder = new Folder($folderOne);
|
||||
$result = $Folder->move($folderThree);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertTrue(is_dir($folder3 . DS . 'folder2'));
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
|
||||
$this->assertFalse(file_exists($file1));
|
||||
$this->assertFalse(file_exists($folder2));
|
||||
$this->assertFalse(file_exists($file2));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
|
||||
$this->assertTrue(is_dir($folderThree . DS . 'folder2'));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'folder2' . DS . 'file2.php'));
|
||||
$this->assertFalse(file_exists($fileOne));
|
||||
$this->assertFalse(file_exists($folderTwo));
|
||||
$this->assertFalse(file_exists($fileTwo));
|
||||
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder = new Folder($folderThree);
|
||||
$Folder->delete();
|
||||
|
||||
new Folder($folder1, true);
|
||||
new Folder($folder2, true);
|
||||
touch($file1);
|
||||
touch($file2);
|
||||
new Folder($folderOne, true);
|
||||
new Folder($folderTwo, true);
|
||||
touch($fileOne);
|
||||
touch($fileTwo);
|
||||
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->move($folder3);
|
||||
$Folder = new Folder($folderOne);
|
||||
$result = $Folder->move($folderThree);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertTrue(is_dir($folder3 . DS . 'folder2'));
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
|
||||
$this->assertFalse(file_exists($file1));
|
||||
$this->assertFalse(file_exists($folder2));
|
||||
$this->assertFalse(file_exists($file2));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
|
||||
$this->assertTrue(is_dir($folderThree . DS . 'folder2'));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'folder2' . DS . 'file2.php'));
|
||||
$this->assertFalse(file_exists($fileOne));
|
||||
$this->assertFalse(file_exists($folderTwo));
|
||||
$this->assertFalse(file_exists($fileTwo));
|
||||
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder = new Folder($folderThree);
|
||||
$Folder->delete();
|
||||
|
||||
new Folder($folder1, true);
|
||||
new Folder($folder2, true);
|
||||
new Folder($folder3, true);
|
||||
new Folder($folder3 . DS . 'folder2', true);
|
||||
touch($file1);
|
||||
touch($file2);
|
||||
file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched');
|
||||
new Folder($folderOne, true);
|
||||
new Folder($folderTwo, true);
|
||||
new Folder($folderThree, true);
|
||||
new Folder($folderThree . DS . 'folder2', true);
|
||||
touch($fileOne);
|
||||
touch($fileTwo);
|
||||
file_put_contents($folderThree . DS . 'folder2' . DS . 'file2.php', 'untouched');
|
||||
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->move($folder3);
|
||||
$Folder = new Folder($folderOne);
|
||||
$result = $Folder->move($folderThree);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertEquals(file_get_contents($folder3 . DS . 'folder2' . DS . 'file2.php'), 'untouched');
|
||||
$this->assertFalse(file_exists($file1));
|
||||
$this->assertFalse(file_exists($folder2));
|
||||
$this->assertFalse(file_exists($file2));
|
||||
$this->assertTrue(file_exists($folderThree . DS . 'file1.php'));
|
||||
$this->assertEquals(file_get_contents($folderThree . DS . 'folder2' . DS . 'file2.php'), 'untouched');
|
||||
$this->assertFalse(file_exists($fileOne));
|
||||
$this->assertFalse(file_exists($folderTwo));
|
||||
$this->assertFalse(file_exists($fileTwo));
|
||||
|
||||
$Folder = new Folder($path);
|
||||
$Folder->delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ App::uses('CakeEvent', 'Event');
|
|||
* A generic object class
|
||||
*/
|
||||
class GenericObject {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -34,33 +35,40 @@ class GenericObject {
|
|||
$this->_Collection = $collection;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* First Extension of Generic Object
|
||||
*/
|
||||
class FirstGenericObject extends GenericObject {
|
||||
|
||||
/**
|
||||
* A generic callback
|
||||
*/
|
||||
public function callback() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Second Extension of Generic Object
|
||||
*/
|
||||
class SecondGenericObject extends GenericObject {
|
||||
|
||||
public function callback() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Third Extension of Generic Object
|
||||
*/
|
||||
class ThirdGenericObject extends GenericObject {
|
||||
|
||||
public function callback() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,9 +96,11 @@ class GenericObjectCollection extends ObjectCollection {
|
|||
}
|
||||
return $this->_loaded[$name];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ObjectCollectionTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
|
@ -581,4 +591,5 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$event->omitSubject = true;
|
||||
$this->assertTrue($this->Objects->trigger($event));
|
||||
}
|
||||
|
||||
}
|
|
@ -331,8 +331,13 @@ class SanitizeTest extends CakeTestCase {
|
|||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$string = '<link href="/css/styles.css" media="screen" rel="stylesheet" />' . "\n" . '<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
|
||||
$expected = "\n" . '<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />'."\n".'<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
|
||||
$string = '<link href="/css/styles.css" media="screen" rel="stylesheet" />' . "\n" .
|
||||
'<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" .
|
||||
'<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />' . "\n" .
|
||||
'<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
|
||||
$expected = "\n" . '<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" .
|
||||
'<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />' . "\n" .
|
||||
'<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
@ -390,7 +395,7 @@ HTML;
|
|||
*/
|
||||
public function testStripAll() {
|
||||
$string = '<img """><script>alert("xss")</script>"/>';
|
||||
$expected ='"/>';
|
||||
$expected = '"/>';
|
||||
$result = Sanitize::stripAll($string);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
|
@ -404,14 +409,13 @@ HTML;
|
|||
$result = Sanitize::stripAll($string);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$string = '<img src="http://google.com/images/logo.gif" onload="window.location=\'http://sam.com/\'" />'."\n".
|
||||
"<p>This is ok \t\n text</p>\n".
|
||||
'<link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" title="my sheet" charset="utf-8">'."\n".
|
||||
'<script src="xss.js" type="text/javascript" charset="utf-8"></script>';
|
||||
$string = '<img src="http://google.com/images/logo.gif" onload="window.location=\'http://sam.com/\'" />' . "\n" .
|
||||
"<p>This is ok \t\n text</p>\n" .
|
||||
'<link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" title="my sheet" charset="utf-8">' . "\n" .
|
||||
'<script src="xss.js" type="text/javascript" charset="utf-8"></script>';
|
||||
$expected = '<p>This is ok text</p>';
|
||||
$result = Sanitize::stripAll($string);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ class StringTest extends CakeTestCase {
|
|||
public function testUuidGeneration() {
|
||||
$result = String::uuid();
|
||||
$pattern = "/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/";
|
||||
$match = (bool) preg_match($pattern, $result);
|
||||
$match = (bool)preg_match($pattern, $result);
|
||||
$this->assertTrue($match);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class StringTest extends CakeTestCase {
|
|||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$result = String::uuid();
|
||||
$match = (bool) preg_match($pattern, $result);
|
||||
$match = (bool)preg_match($pattern, $result);
|
||||
$this->assertTrue($match);
|
||||
$this->assertFalse(in_array($result, $check));
|
||||
$check[] = $result;
|
||||
|
@ -393,7 +393,7 @@ TEXT;
|
|||
$this->assertSame($this->Text->truncate($text6, 57, array('exact' => false, 'html' => true)), "<p><strong>Extra dates have been announced for this year's...</strong></p>");
|
||||
$this->assertSame($this->Text->truncate($text7, 255), $text7);
|
||||
$this->assertSame($this->Text->truncate($text7, 15), 'El moño está...');
|
||||
$this->assertSame($this->Text->truncate($text8, 15), 'Vive la R'.chr(195).chr(169).'pu...');
|
||||
$this->assertSame($this->Text->truncate($text8, 15), 'Vive la R' . chr(195) . chr(169) . 'pu...');
|
||||
$this->assertSame($this->Text->truncate($text9, 10), 'НОПРСТУ...');
|
||||
$this->assertSame($this->Text->truncate($text10, 30), 'http://example.com/somethin...');
|
||||
|
||||
|
@ -509,7 +509,6 @@ podeís adquirirla.</span></p>
|
|||
$result = $this->Text->highlight($text, $phrases, array('format' => array('<b>\1</b>', '<em>\1</em>')));
|
||||
$expected = '<b>This</b> is a test <em>text</em>';
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,9 +31,10 @@ class CustomValidator {
|
|||
* @param string $email
|
||||
* @return boolean
|
||||
*/
|
||||
static function customValidate($check) {
|
||||
public static function customValidate($check) {
|
||||
return (bool)preg_match('/^[0-9]{3}$/', $check);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,13 +45,14 @@ class CustomValidator {
|
|||
* @package Cake.Test.Case.Utility
|
||||
*/
|
||||
class TestNlValidation {
|
||||
|
||||
/**
|
||||
* postal function, for testing postal pass through.
|
||||
*
|
||||
* @param string $check
|
||||
* @return void
|
||||
*/
|
||||
static function postal($check) {
|
||||
public static function postal($check) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -59,9 +61,10 @@ class TestNlValidation {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
static function ssn($check) {
|
||||
public static function ssn($check) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,15 +75,17 @@ class TestNlValidation {
|
|||
* @package Cake.Test.Case.Utility
|
||||
*/
|
||||
class TestDeValidation {
|
||||
|
||||
/**
|
||||
* phone function, for testing phone pass through.
|
||||
*
|
||||
* @param string $check
|
||||
* @return void
|
||||
*/
|
||||
static function phone($check) {
|
||||
public static function phone($check) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,7 +123,7 @@ class ValidationTest extends CakeTestCase {
|
|||
public function testNotEmpty() {
|
||||
$this->assertTrue(Validation::notEmpty('abcdefg'));
|
||||
$this->assertTrue(Validation::notEmpty('fasdf '));
|
||||
$this->assertTrue(Validation::notEmpty('fooo'.chr(243).'blabla'));
|
||||
$this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla'));
|
||||
$this->assertTrue(Validation::notEmpty('abçďĕʑʘπй'));
|
||||
$this->assertTrue(Validation::notEmpty('José'));
|
||||
$this->assertTrue(Validation::notEmpty('é'));
|
||||
|
@ -136,7 +141,7 @@ class ValidationTest extends CakeTestCase {
|
|||
Configure::write('App.encoding', 'ISO-8859-1');
|
||||
$this->assertTrue(Validation::notEmpty('abcdefg'));
|
||||
$this->assertTrue(Validation::notEmpty('fasdf '));
|
||||
$this->assertTrue(Validation::notEmpty('fooo'.chr(243).'blabla'));
|
||||
$this->assertTrue(Validation::notEmpty('fooo' . chr(243) . 'blabla'));
|
||||
$this->assertTrue(Validation::notEmpty('abçďĕʑʘπй'));
|
||||
$this->assertTrue(Validation::notEmpty('José'));
|
||||
$this->assertTrue(Validation::notEmpty(utf8_decode('José')));
|
||||
|
@ -184,8 +189,8 @@ class ValidationTest extends CakeTestCase {
|
|||
$this->assertFalse(Validation::alphaNumeric(array('check' => "\n")));
|
||||
$this->assertFalse(Validation::alphaNumeric(array('check' => "\t")));
|
||||
$this->assertFalse(Validation::alphaNumeric(array('check' => "\r")));
|
||||
$this->assertFalse(Validation::alphaNumeric(array('check' => ' ')));
|
||||
$this->assertFalse(Validation::alphaNumeric(array('check' => '')));
|
||||
$this->assertFalse(Validation::alphaNumeric(array('check' => ' ')));
|
||||
$this->assertFalse(Validation::alphaNumeric(array('check' => '')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -930,7 +935,7 @@ class ValidationTest extends CakeTestCase {
|
|||
$this->assertTrue(Validation::comparison(array('check1' => 6, 'operator' => '<', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'greater or equal', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => '>=', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'greater or equal','check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => 'greater or equal','check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 7, 'operator' => '>=', 'check2' => 6)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 6, 'operator' => 'less or equal', 'check2' => 7)));
|
||||
$this->assertTrue(Validation::comparison(array('check1' => 6, 'operator' => '<=', 'check2' => 7)));
|
||||
|
@ -949,7 +954,7 @@ class ValidationTest extends CakeTestCase {
|
|||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => 'less or equal', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '<=', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => 'equal to', 'check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '==','check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '==','check2' => 6)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => 'not equal', 'check2' => 7)));
|
||||
$this->assertFalse(Validation::comparison(array('check1' => 7, 'operator' => '!=', 'check2' => 7)));
|
||||
}
|
||||
|
@ -1498,21 +1503,21 @@ class ValidationTest extends CakeTestCase {
|
|||
*/
|
||||
public function testDecimalWithPlaces() {
|
||||
$this->assertTrue(Validation::decimal('.27', '2'));
|
||||
$this->assertTrue(Validation::decimal(.27, 2));
|
||||
$this->assertTrue(Validation::decimal(-.27, 2));
|
||||
$this->assertTrue(Validation::decimal(+.27, 2));
|
||||
$this->assertTrue(Validation::decimal('.277', '3'));
|
||||
$this->assertTrue(Validation::decimal(.277, 3));
|
||||
$this->assertTrue(Validation::decimal(-.277, 3));
|
||||
$this->assertTrue(Validation::decimal(+.277, 3));
|
||||
$this->assertTrue(Validation::decimal(0.27, 2));
|
||||
$this->assertTrue(Validation::decimal(-0.27, 2));
|
||||
$this->assertTrue(Validation::decimal(0.27, 2));
|
||||
$this->assertTrue(Validation::decimal('0.277', '3'));
|
||||
$this->assertTrue(Validation::decimal(0.277, 3));
|
||||
$this->assertTrue(Validation::decimal(-0.277, 3));
|
||||
$this->assertTrue(Validation::decimal(0.277, 3));
|
||||
$this->assertTrue(Validation::decimal('1234.5678', '4'));
|
||||
$this->assertTrue(Validation::decimal(1234.5678, 4));
|
||||
$this->assertTrue(Validation::decimal(-1234.5678, 4));
|
||||
$this->assertTrue(Validation::decimal(+1234.5678, 4));
|
||||
$this->assertTrue(Validation::decimal(1234.5678, 4));
|
||||
$this->assertFalse(Validation::decimal('1234.5678', '3'));
|
||||
$this->assertFalse(Validation::decimal(1234.5678, 3));
|
||||
$this->assertFalse(Validation::decimal(-1234.5678, 3));
|
||||
$this->assertFalse(Validation::decimal(+1234.5678, 3));
|
||||
$this->assertFalse(Validation::decimal(1234.5678, 3));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue