mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
ucfirst object names part two (Folder/File)
Signed-off-by: mark_story <mark@mark-story.com>
This commit is contained in:
parent
621cb43e93
commit
dcc17f2091
5 changed files with 44 additions and 44 deletions
|
@ -121,11 +121,11 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$this->Task->execute();
|
||||
|
||||
$this->assertTrue(is_dir($this->Task->args[0]), 'No project dir');
|
||||
$file = new File($path . DS . 'webroot' . DS . 'index.php');
|
||||
$contents = $file->read();
|
||||
$File = new File($path . DS . 'webroot' . DS . 'index.php');
|
||||
$contents = $File->read();
|
||||
$this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
|
||||
$file = new File($path . DS . 'webroot' . DS . 'test.php');
|
||||
$contents = $file->read();
|
||||
$File = new File($path . DS . 'webroot' . DS . 'test.php');
|
||||
$contents = $File->read();
|
||||
$this->assertRegExp('/define\(\'CAKE_CORE_INCLUDE_PATH\', .*?DS/', $contents);
|
||||
}
|
||||
|
||||
|
@ -197,8 +197,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$result = $this->Task->securitySalt($path);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$file = new File($path . 'Config' . DS . 'core.php');
|
||||
$contents = $file->read();
|
||||
$File = new File($path . 'Config' . DS . 'core.php');
|
||||
$contents = $File->read();
|
||||
$this->assertNoPattern('/DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi/', $contents, 'Default Salt left behind. %s');
|
||||
}
|
||||
|
||||
|
@ -214,8 +214,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$result = $this->Task->securityCipherSeed($path);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$file = new File($path . 'Config' . DS . 'core.php');
|
||||
$contents = $file->read();
|
||||
$File = new File($path . 'Config' . DS . 'core.php');
|
||||
$contents = $File->read();
|
||||
$this->assertNoPattern('/76859309657453542496749683645/', $contents, 'Default CipherSeed left behind. %s');
|
||||
}
|
||||
|
||||
|
@ -230,11 +230,11 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$path = $this->Task->path . 'bake_test_app' . DS;
|
||||
$this->Task->corePath($path);
|
||||
|
||||
$file = new File($path . 'webroot' . DS . 'index.php');
|
||||
$contents = $file->read();
|
||||
$File = new File($path . 'webroot' . DS . 'index.php');
|
||||
$contents = $File->read();
|
||||
$this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', ROOT/', $contents);
|
||||
$file = new File($path . 'webroot' . DS . 'test.php');
|
||||
$contents = $file->read();
|
||||
$File = new File($path . 'webroot' . DS . 'test.php');
|
||||
$contents = $File->read();
|
||||
$this->assertNoPattern('/define\(\'CAKE_CORE_INCLUDE_PATH\', ROOT/', $contents);
|
||||
}
|
||||
|
||||
|
@ -256,8 +256,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$result = $this->Task->getPrefix();
|
||||
$this->assertEqual($result, 'super_duper_admin_');
|
||||
|
||||
$file = new File($this->Task->configPath . 'core.php');
|
||||
$file->delete();
|
||||
$File = new File($this->Task->configPath . 'core.php');
|
||||
$File->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,10 +266,10 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCakeAdmin() {
|
||||
$file = new File(APP . 'Config' . DS . 'core.php');
|
||||
$contents = $file->read();
|
||||
$file = new File(TMP . 'tests' . DS . 'core.php');
|
||||
$file->write($contents);
|
||||
$File = new File(APP . 'Config' . DS . 'core.php');
|
||||
$contents = $File->read();
|
||||
$File = new File(TMP . 'tests' . DS . 'core.php');
|
||||
$File->write($contents);
|
||||
|
||||
Configure::write('Routing.prefixes', null);
|
||||
$this->Task->configPath = TMP . 'tests' . DS;
|
||||
|
@ -277,7 +277,7 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$this->assertTrue($result);
|
||||
|
||||
$this->assertEqual(Configure::read('Routing.prefixes'), array('my_prefix'));
|
||||
$file->delete();
|
||||
$File->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -332,8 +332,8 @@ class ProjectTaskTest extends CakeTestCase {
|
|||
$result = $this->Task->consolePath($path);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$file = new File($path . 'Console' . DS . 'cake.php');
|
||||
$contents = $file->read();
|
||||
$File = new File($path . 'Console' . DS . 'cake.php');
|
||||
$contents = $File->read();
|
||||
$this->assertNoPattern('/__CAKE_PATH__/', $contents, 'Console path placeholder left behind.');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -428,9 +428,9 @@ class FileTest extends CakeTestCase {
|
|||
if (!file_exists($tmpFile)) {
|
||||
touch($tmpFile);
|
||||
}
|
||||
$file =& new File($tmpFile);
|
||||
$file->read();
|
||||
$this->assertTrue($file->delete());
|
||||
$File =& new File($tmpFile);
|
||||
$File->read();
|
||||
$this->assertTrue($File->delete());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -122,16 +122,16 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreation() {
|
||||
$folder = new Folder(TMP . 'tests');
|
||||
$result = $folder->create(TMP . 'tests' . DS . 'first' . DS . 'second' . DS . 'third');
|
||||
$Folder = new Folder(TMP . 'tests');
|
||||
$result = $Folder->create(TMP . 'tests' . DS . 'first' . DS . 'second' . DS . 'third');
|
||||
$this->assertTrue($result);
|
||||
|
||||
rmdir(TMP . 'tests' . DS . 'first' . DS . 'second' . DS . 'third');
|
||||
rmdir(TMP . 'tests' . DS . 'first' . DS . 'second');
|
||||
rmdir(TMP . 'tests' . DS . 'first');
|
||||
|
||||
$folder = new Folder(TMP . 'tests');
|
||||
$result = $folder->create(TMP . 'tests' . DS . 'first');
|
||||
$Folder = new Folder(TMP . 'tests');
|
||||
$result = $Folder->create(TMP . 'tests' . DS . 'first');
|
||||
$this->assertTrue($result);
|
||||
rmdir(TMP . 'tests' . DS . 'first');
|
||||
}
|
||||
|
@ -142,15 +142,15 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCreateWithTrailingDs() {
|
||||
$folder = new Folder(TMP);
|
||||
$Folder = new Folder(TMP);
|
||||
$path = TMP . 'tests' . DS . 'trailing' . DS . 'dir' . DS;
|
||||
$result = $folder->create($path);
|
||||
$result = $Folder->create($path);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$this->assertTrue(is_dir($path), 'Folder was not made');
|
||||
|
||||
$folder = new Folder(TMP . 'tests' . DS . 'trailing');
|
||||
$this->assertTrue($folder->delete());
|
||||
$Folder = new Folder(TMP . 'tests' . DS . 'trailing');
|
||||
$this->assertTrue($Folder->delete());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,8 +166,8 @@ class FolderTest extends CakeTestCase {
|
|||
chmod($path, '0444');
|
||||
|
||||
try {
|
||||
$folder = new Folder($path);
|
||||
$result = $folder->create($path . DS . 'two' . DS . 'three');
|
||||
$Folder = new Folder($path);
|
||||
$result = $Folder->create($path . DS . 'two' . DS . 'three');
|
||||
$this->assertFalse($result);
|
||||
} catch (PHPUnit_Framework_Error $e) {
|
||||
$this->assertTrue(true);
|
||||
|
@ -537,7 +537,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertSame($expected, $result);
|
||||
|
||||
$Folder->cd(TMP);
|
||||
$file = new File($Folder->pwd() . DS . 'paths.php', true);
|
||||
$File = new File($Folder->pwd() . DS . 'paths.php', true);
|
||||
$Folder->create($Folder->pwd() . DS . 'testme');
|
||||
$Folder->cd('testme');
|
||||
$result = $Folder->find('paths\.php');
|
||||
|
@ -551,7 +551,7 @@ class FolderTest extends CakeTestCase {
|
|||
|
||||
$Folder->cd(TMP);
|
||||
$Folder->delete($Folder->pwd() . DS . 'testme');
|
||||
$file->delete();
|
||||
$File->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -378,7 +378,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
App::uses('File', 'Utility');
|
||||
|
||||
$testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'img' . DS . '__cake_test_image.gif';
|
||||
$file = new File($testfile, true);
|
||||
$File = new File($testfile, true);
|
||||
|
||||
App::build(array(
|
||||
'views' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
||||
|
@ -662,7 +662,7 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
App::uses('File', 'Utility');
|
||||
|
||||
$testfile = WWW_ROOT . 'theme' . DS . 'test_theme' . DS . 'js' . DS . '__test_js.js';
|
||||
$file = new File($testfile, true);
|
||||
$File = new File($testfile, true);
|
||||
|
||||
App::build(array(
|
||||
'views' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
||||
|
@ -676,8 +676,8 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$folder = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
|
||||
$folder->delete();
|
||||
$Folder = new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
|
||||
$Folder->delete();
|
||||
App::build();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
|
|||
* @return void
|
||||
*/
|
||||
public function addTestDirectory($directory = '.') {
|
||||
$folder = new Folder($directory);
|
||||
list($dirs, $files) = $folder->read(true, true, true);
|
||||
$Folder = new Folder($directory);
|
||||
list($dirs, $files) = $Folder->read(true, true, true);
|
||||
|
||||
foreach ($files as $file) {
|
||||
$this->addTestFile($file);
|
||||
|
@ -44,8 +44,8 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
|
|||
* @return void
|
||||
*/
|
||||
public function addTestDirectoryRecursive($directory = '.') {
|
||||
$folder = new Folder($directory);
|
||||
$files = $folder->tree(null, false, 'files');
|
||||
$Folder = new Folder($directory);
|
||||
$files = $Folder->tree(null, false, 'files');
|
||||
|
||||
foreach ($files as $file) {
|
||||
$this->addTestFile($file);
|
||||
|
|
Loading…
Add table
Reference in a new issue