diff --git a/lib/Cake/Test/Case/Utility/CakeNumberTest.php b/lib/Cake/Test/Case/Utility/CakeNumberTest.php index 7be848ef7..dc80e66da 100644 --- a/lib/Cake/Test/Case/Utility/CakeNumberTest.php +++ b/lib/Cake/Test/Case/Utility/CakeNumberTest.php @@ -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); } + } diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php index 7184aa42d..360a42a1b 100644 --- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php +++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php @@ -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); - } /** diff --git a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php index adb4ec012..e6c5ee20d 100644 --- a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php +++ b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php @@ -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); @@ -336,7 +336,7 @@ class ClassRegistryTest extends CakeTestCase { public function testInitAbstractClass() { ClassRegistry::init('ClassRegistryAbstractModel'); } - + /** * Test that you cannot init() an abstract class. A exception will be raised. * diff --git a/lib/Cake/Test/Case/Utility/DebuggerTest.php b/lib/Cake/Test/Case/Utility/DebuggerTest.php index 644a01a39..7344f9777 100644 --- a/lib/Cake/Test/Case/Utility/DebuggerTest.php +++ b/lib/Cake/Test/Case/Utility/DebuggerTest.php @@ -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; /** diff --git a/lib/Cake/Test/Case/Utility/FileTest.php b/lib/Cake/Test/Case/Utility/FileTest.php index 2b34fa589..eba7422f7 100644 --- a/lib/Cake/Test/Case/Utility/FileTest.php +++ b/lib/Cake/Test/Case/Utility/FileTest.php @@ -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()); } diff --git a/lib/Cake/Test/Case/Utility/FolderTest.php b/lib/Cake/Test/Case/Utility/FolderTest.php index fa251afba..9fa8f136e 100644 --- a/lib/Cake/Test/Case/Utility/FolderTest.php +++ b/lib/Cake/Test/Case/Utility/FolderTest.php @@ -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); @@ -285,7 +285,7 @@ class FolderTest extends CakeTestCase { $this->assertTrue($Folder->chmod($new, 0755, true)); $perms = substr(sprintf('%o', fileperms($new . DS . 'test2')), -4); $this->assertEquals($perms, '0755'); - + $this->assertTrue($Folder->chmod($new, 0744, true, array('skip_me.php', 'test2'))); $perms = substr(sprintf('%o', fileperms($new . DS . 'test2')), -4); @@ -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(); } + } diff --git a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php index 66db07fde..2d427a000 100644 --- a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php +++ b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php @@ -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 * @@ -525,7 +535,7 @@ class ObjectCollectionTest extends CakeTestCase { $result = ObjectCollection::normalizeObjectArray($components); $this->assertEquals($expected, $result); } - + /** * tests that passing an instance of CakeEvent to trigger will prepend the subject to the list of arguments * @@ -581,4 +591,5 @@ class ObjectCollectionTest extends CakeTestCase { $event->omitSubject = true; $this->assertTrue($this->Objects->trigger($event)); } -} \ No newline at end of file + +} diff --git a/lib/Cake/Test/Case/Utility/SanitizeTest.php b/lib/Cake/Test/Case/Utility/SanitizeTest.php index b09061eef..a1cb84d3b 100644 --- a/lib/Cake/Test/Case/Utility/SanitizeTest.php +++ b/lib/Cake/Test/Case/Utility/SanitizeTest.php @@ -331,8 +331,13 @@ class SanitizeTest extends CakeTestCase { $result = Sanitize::stripScripts($string); $this->assertEquals($expected, $result); - $string = '' . "\n" . '' . "\n" . '' . "\n" . ''; - $expected = "\n" . '' . "\n" . ''."\n".''; + $string = '' . "\n" . + '' . "\n" . + '' . "\n" . + ''; + $expected = "\n" . '' . "\n" . + '' . "\n" . + ''; $result = Sanitize::stripScripts($string); $this->assertEquals($expected, $result); @@ -390,7 +395,7 @@ HTML; */ public function testStripAll() { $string = '"/>'; - $expected ='"/>'; + $expected = '"/>'; $result = Sanitize::stripAll($string); $this->assertEquals($expected, $result); @@ -404,14 +409,13 @@ HTML; $result = Sanitize::stripAll($string); $this->assertEquals($expected, $result); - $string = ''."\n". - "
This is ok \t\n text
\n". - ''."\n". - ''; + $string = '' . "\n" . + "This is ok \t\n text
\n" . + '' . "\n" . + ''; $expected = 'This is ok text
'; $result = Sanitize::stripAll($string); $this->assertEquals($expected, $result); - } /** diff --git a/lib/Cake/Test/Case/Utility/StringTest.php b/lib/Cake/Test/Case/Utility/StringTest.php index 6d764b17c..2c8f40ea4 100644 --- a/lib/Cake/Test/Case/Utility/StringTest.php +++ b/lib/Cake/Test/Case/Utility/StringTest.php @@ -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)), "Extra dates have been announced for this year's...
"); $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. $result = $this->Text->highlight($text, $phrases, array('format' => array('\1', '\1'))); $expected = 'This is a test text'; $this->assertEquals($expected, $result); - } /** diff --git a/lib/Cake/Test/Case/Utility/ValidationTest.php b/lib/Cake/Test/Case/Utility/ValidationTest.php index e658b68e4..9763e9caa 100644 --- a/lib/Cake/Test/Case/Utility/ValidationTest.php +++ b/lib/Cake/Test/Case/Utility/ValidationTest.php @@ -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)); } /** diff --git a/lib/Cake/Test/Case/Utility/XmlTest.php b/lib/Cake/Test/Case/Utility/XmlTest.php index 5edccf29f..5c2cebd44 100644 --- a/lib/Cake/Test/Case/Utility/XmlTest.php +++ b/lib/Cake/Test/Case/Utility/XmlTest.php @@ -865,7 +865,7 @@ class XmlTest extends CakeTestCase { $expected .= '