update for version 1.0.2

This commit is contained in:
sujitprasad
2015-11-30 16:38:59 +05:30
parent d0a69a8df1
commit 7e17edab1e
425 changed files with 14241 additions and 3410 deletions

View File

@@ -15,8 +15,6 @@ namespace Symfony\Component\Filesystem\Exception;
* Exception interface for all exceptions thrown by the component.
*
* @author Romain Neutron <imprec@gmail.com>
*
* @api
*/
interface ExceptionInterface
{

View File

@@ -17,8 +17,6 @@ namespace Symfony\Component\Filesystem\Exception;
* @author Romain Neutron <imprec@gmail.com>
* @author Christian Gärtner <christiangaertner.film@googlemail.com>
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class IOException extends \RuntimeException implements IOExceptionInterface
{

View File

@@ -345,8 +345,13 @@ class Filesystem
// Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels)
$depth = count($startPathArr) - $index;
// Repeated "../" for each level need to reach the common path
$traverser = str_repeat('../', $depth);
// When we need to traverse from the start, and we are starting from a root path, don't add '../'
if ('/' === $startPath[0] && 0 === $index && 1 === $depth) {
$traverser = '';
} else {
// Repeated "../" for each level need to reach the common path
$traverser = str_repeat('../', $depth);
}
$endPathRemainder = implode('/', array_slice($endPathArr, $index));
@@ -417,7 +422,7 @@ class Filesystem
}
} else {
if (is_link($file)) {
$this->symlink($file->getRealPath(), $target);
$this->symlink($file->getLinkTarget(), $target);
} elseif (is_dir($file)) {
$this->mkdir($target);
} elseif (is_file($file)) {

View File

@@ -790,6 +790,8 @@ class FilesystemTest extends FilesystemTestCase
array('/a/aab/bb', '/a/aa/', '../aab/bb/'),
array('/a/aab/bb/', '/a/aa', '../aab/bb/'),
array('/a/aab/bb/', '/a/aa/', '../aab/bb/'),
array('/a/aab/bb/', '/', 'a/aab/bb/'),
array('/a/aab/bb/', '/b/aab', '../../a/aab/bb/'),
);
if ('\\' === DIRECTORY_SEPARATOR) {
@@ -915,7 +917,7 @@ class FilesystemTest extends FilesystemTestCase
$this->assertTrue(is_dir($targetPath));
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt');
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
$this->assertEquals($sourcePath.'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
$this->assertEquals('\\' === DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
}
/**

View File

@@ -95,25 +95,25 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
protected function markAsSkippedIfSymlinkIsMissing()
{
if (!function_exists('symlink')) {
$this->markTestSkipped('symlink is not supported');
$this->markTestSkipped('Function symlink is required.');
}
if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) {
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on windows');
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows');
}
}
protected function markAsSkippedIfChmodIsMissing()
{
if ('\\' === DIRECTORY_SEPARATOR) {
$this->markTestSkipped('chmod is not supported on windows');
$this->markTestSkipped('chmod is not supported on Windows');
}
}
protected function markAsSkippedIfPosixIsMissing()
{
if ('\\' === DIRECTORY_SEPARATOR || !function_exists('posix_isatty')) {
$this->markTestSkipped('Posix is not supported');
if (!function_exists('posix_isatty')) {
$this->markTestSkipped('Function posix_isatty is required.');
}
}
}

View File

@@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Filesystem\Tests;
use Symfony\Component\Filesystem\LockHandler;

View File

@@ -18,9 +18,6 @@
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Filesystem\\": "" }
},