composer update
This commit is contained in:
@@ -16,6 +16,6 @@ namespace Symfony\Component\Filesystem\Exception;
|
||||
*
|
||||
* @author Romain Neutron <imprec@gmail.com>
|
||||
*/
|
||||
interface ExceptionInterface
|
||||
interface ExceptionInterface extends \Throwable
|
||||
{
|
||||
}
|
||||
|
11
vendor/symfony/filesystem/Filesystem.php
vendored
11
vendor/symfony/filesystem/Filesystem.php
vendored
@@ -557,10 +557,7 @@ class Filesystem
|
||||
}
|
||||
}
|
||||
|
||||
$copyOnWindows = false;
|
||||
if (isset($options['copy_on_windows'])) {
|
||||
$copyOnWindows = $options['copy_on_windows'];
|
||||
}
|
||||
$copyOnWindows = $options['copy_on_windows'] ?? false;
|
||||
|
||||
if (null === $iterator) {
|
||||
$flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
|
||||
@@ -572,6 +569,10 @@ class Filesystem
|
||||
}
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
if (false === strpos($file->getPath(), $originDir)) {
|
||||
throw new IOException(sprintf('Unable to mirror "%s" directory. If the origin directory is relative, try using "realpath" before calling the mirror method.', $originDir), 0, null, $originDir);
|
||||
}
|
||||
|
||||
$target = $targetDir.substr($file->getPathname(), $originDirLen);
|
||||
|
||||
if ($copyOnWindows) {
|
||||
@@ -744,7 +745,7 @@ class Filesystem
|
||||
self::$lastError = null;
|
||||
\set_error_handler(__CLASS__.'::handleError');
|
||||
try {
|
||||
$result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
|
||||
$result = $func(...\array_slice(\func_get_args(), 1));
|
||||
\restore_error_handler();
|
||||
|
||||
return $result;
|
||||
|
@@ -50,6 +50,10 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
if (!getenv('USER') || 'root' === getenv('USER')) {
|
||||
$this->markTestSkipped('This test will fail if run under superuser');
|
||||
}
|
||||
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
@@ -124,6 +128,10 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
if (!getenv('USER') || 'root' === getenv('USER')) {
|
||||
$this->markTestSkipped('This test will fail if run under superuser');
|
||||
}
|
||||
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
@@ -161,7 +169,10 @@ class FilesystemTest extends FilesystemTestCase
|
||||
*/
|
||||
public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy()
|
||||
{
|
||||
$sourceFilePath = 'http://symfony.com/images/common/logo/logo_symfony_header.png';
|
||||
if (!\in_array('https', stream_get_wrappers())) {
|
||||
$this->markTestSkipped('"https" stream wrapper is not enabled.');
|
||||
}
|
||||
$sourceFilePath = 'https://symfony.com/images/common/logo/logo_symfony_header.png';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($targetFilePath, 'TARGET FILE');
|
||||
@@ -1321,6 +1332,46 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->assertFileNotExists($targetPath.'target');
|
||||
}
|
||||
|
||||
public function testMirrorWithCustomIterator()
|
||||
{
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
mkdir($sourcePath);
|
||||
|
||||
$file = $sourcePath.DIRECTORY_SEPARATOR.'file';
|
||||
file_put_contents($file, 'FILE');
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
|
||||
$splFile = new \SplFileInfo($file);
|
||||
$iterator = new \ArrayObject(array($splFile));
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath, $iterator);
|
||||
|
||||
$this->assertTrue(is_dir($targetPath));
|
||||
$this->assertFileEquals($file, $targetPath.DIRECTORY_SEPARATOR.'file');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
|
||||
* @expectedExceptionMessageRegExp /Unable to mirror "(.*)" directory/
|
||||
*/
|
||||
public function testMirrorWithCustomIteratorWithRelativePath()
|
||||
{
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$realSourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
mkdir($realSourcePath);
|
||||
|
||||
$file = $realSourcePath.'file';
|
||||
file_put_contents($file, 'FILE');
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
|
||||
$splFile = new \SplFileInfo($file);
|
||||
$iterator = new \ArrayObject(array($splFile));
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath, $iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providePathsForIsAbsolutePath
|
||||
*/
|
||||
|
@@ -31,12 +31,12 @@ class FilesystemTestCase extends TestCase
|
||||
protected $workspace = null;
|
||||
|
||||
/**
|
||||
* @var null|bool Flag for hard links on Windows
|
||||
* @var bool|null Flag for hard links on Windows
|
||||
*/
|
||||
private static $linkOnWindows = null;
|
||||
|
||||
/**
|
||||
* @var null|bool Flag for symbolic links on Windows
|
||||
* @var bool|null Flag for symbolic links on Windows
|
||||
*/
|
||||
private static $symlinkOnWindows = null;
|
||||
|
||||
|
2
vendor/symfony/filesystem/composer.json
vendored
2
vendor/symfony/filesystem/composer.json
vendored
@@ -28,7 +28,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.1-dev"
|
||||
"dev-master": "4.2-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
vendor/symfony/filesystem/phpunit.xml.dist
vendored
2
vendor/symfony/filesystem/phpunit.xml.dist
vendored
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
|
Reference in New Issue
Block a user