Merge branch '2.7' into 2.8

This commit is contained in:
mark_story 2015-12-24 16:20:27 -05:00
commit b5e64bbad5
3 changed files with 18 additions and 4 deletions

View file

@ -16,9 +16,6 @@
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
@echo.
@echo off
SET app=%0

View file

@ -301,6 +301,23 @@ class FileTest extends CakeTestCase {
$this->assertTrue($File->exists());
}
/**
* Tests the exists() method.
*
* @return void
*/
public function testExists() {
$tmpFile = TMP . 'tests/cakephp.file.test.tmp';
$file = new File($tmpFile, true, 0777);
$this->assertTrue($file->exists(), 'absolute path should exist');
$file = new File('file://' . $tmpFile, false);
$this->assertTrue($file->exists(), 'file:// should exist.');
$file = new File('/something/bad', false);
$this->assertFalse($file->exists(), 'missing file should not exist.');
}
/**
* testOpeningNonExistentFileCreatesIt method
*

View file

@ -821,13 +821,13 @@ class Folder {
* @link http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.html#Folder::realpath
*/
public function realpath($path) {
$path = str_replace('/', DS, trim($path));
if (strpos($path, '..') === false) {
if (!Folder::isAbsolute($path)) {
$path = Folder::addPathElement($this->path, $path);
}
return $path;
}
$path = str_replace('/', DS, trim($path));
$parts = explode(DS, $path);
$newparts = array();
$newpath = '';