Updating Symfony lib and dependencies:

Package operations: 2 installs, 23 updates, 0 removals
  - Updating psr/log (1.1.0 => 1.1.2)
  - Updating symfony/debug (v3.4.30 => v3.4.35)
  - Updating symfony/console (v3.4.30 => v3.4.35)
  - Updating symfony/dotenv (v3.4.30 => v3.4.35)
  - Updating symfony/routing (v3.4.30 => v3.4.35)
  - Updating symfony/finder (v3.4.30 => v3.4.35)
  - Updating symfony/filesystem (v3.4.30 => v3.4.35)
  - Installing symfony/polyfill-util (v1.12.0)
  - Installing symfony/polyfill-php56 (v1.12.0)
  - Updating symfony/http-foundation (v3.4.30 => v3.4.35)
  - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35)
  - Updating symfony/http-kernel (v3.4.30 => v3.4.35)
  - Updating symfony/config (v3.4.30 => v3.4.35)
  - Updating symfony/dependency-injection (v3.4.30 => v3.4.35)
  - Updating symfony/class-loader (v3.4.30 => v3.4.35)
  - Updating symfony/cache (v3.4.30 => v3.4.35)
  - Updating symfony/framework-bundle (v3.4.30 => v3.4.35)
  - Updating twig/twig (v1.42.2 => v1.42.4)
  - Updating symfony/twig-bridge (v3.4.30 => v3.4.35)
  - Updating symfony/twig-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/yaml (v3.4.30 => v3.4.35)
  - Updating symfony/stopwatch (v3.4.30 => v3.4.35)
  - Updating symfony/var-dumper (v3.4.30 => v3.4.35)
  - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
Molkobain
2019-11-18 18:04:32 +01:00
parent 532eb466a1
commit c76cccd2e7
633 changed files with 4154 additions and 4093 deletions

View File

@@ -52,7 +52,7 @@ class Filesystem
}
if ($doCopy) {
// https://bugs.php.net/bug.php?id=64634
// https://bugs.php.net/64634
if (false === $source = @fopen($originFile, 'r')) {
throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
}
@@ -280,7 +280,7 @@ class Filesystem
if (true !== @rename($origin, $target)) {
if (is_dir($origin)) {
// See https://bugs.php.net/bug.php?id=54097 & http://php.net/manual/en/function.rename.php#113943
// See https://bugs.php.net/54097 & https://php.net/rename#113943
$this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);
$this->remove($origin);
@@ -413,12 +413,12 @@ class Filesystem
public function readlink($path, $canonicalize = false)
{
if (!$canonicalize && !is_link($path)) {
return;
return null;
}
if ($canonicalize) {
if (!$this->exists($path)) {
return;
return null;
}
if ('\\' === \DIRECTORY_SEPARATOR) {
@@ -743,6 +743,11 @@ class Filesystem
return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
}
/**
* @param callable $func
*
* @return mixed
*/
private static function box($func)
{
self::$lastError = null;

View File

@@ -29,22 +29,18 @@ class FilesystemTest extends FilesystemTestCase
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testCopyFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
$this->filesystem->copy($sourceFilePath, $targetFilePath);
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testCopyUnreadableFileFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
// skip test on Windows; PHP can't easily set file as unreadable on Windows
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test cannot run on Windows.');
@@ -118,11 +114,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testCopyWithOverrideWithReadOnlyTargetFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
// skip test on Windows; PHP can't easily set file as unwritable on Windows
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('This test cannot run on Windows.');
@@ -159,7 +153,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->copy($sourceFilePath, $targetFilePath);
$this->assertTrue(is_dir($targetFileDirectory));
$this->assertDirectoryExists($targetFileDirectory);
$this->assertFileExists($targetFilePath);
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
}
@@ -191,7 +185,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mkdir($directory);
$this->assertTrue(is_dir($directory));
$this->assertDirectoryExists($directory);
}
public function testMkdirCreatesDirectoriesFromArray()
@@ -203,9 +197,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mkdir($directories);
$this->assertTrue(is_dir($basePath.'1'));
$this->assertTrue(is_dir($basePath.'2'));
$this->assertTrue(is_dir($basePath.'3'));
$this->assertDirectoryExists($basePath.'1');
$this->assertDirectoryExists($basePath.'2');
$this->assertDirectoryExists($basePath.'3');
}
public function testMkdirCreatesDirectoriesFromTraversableObject()
@@ -217,16 +211,14 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mkdir($directories);
$this->assertTrue(is_dir($basePath.'1'));
$this->assertTrue(is_dir($basePath.'2'));
$this->assertTrue(is_dir($basePath.'3'));
$this->assertDirectoryExists($basePath.'1');
$this->assertDirectoryExists($basePath.'2');
$this->assertDirectoryExists($basePath.'3');
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testMkdirCreatesDirectoriesFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
$dir = $basePath.'2';
@@ -244,11 +236,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertFileExists($file);
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testTouchFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$file = $this->workspace.\DIRECTORY_SEPARATOR.'1'.\DIRECTORY_SEPARATOR.'2';
$this->filesystem->touch($file);
@@ -357,7 +347,7 @@ class FilesystemTest extends FilesystemTestCase
// create symlink to dir using trailing forward slash
$this->filesystem->symlink($basePath.'dir/', $basePath.'dir-link');
$this->assertTrue(is_dir($basePath.'dir-link'));
$this->assertDirectoryExists($basePath.'dir-link');
// create symlink to nonexistent dir
rmdir($basePath.'dir');
@@ -380,11 +370,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertTrue($this->filesystem->exists($basePath.'folder'));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testFilesExistsFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
if ('\\' !== \DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Long file names are an issue on Windows');
}
@@ -613,11 +601,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertSame($owner, $this->getFileOwner($link));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testChownSymlinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfSymlinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -630,11 +616,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->chown($link, 'user'.time().mt_rand(1000, 9999));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testChownLinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfLinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -647,11 +631,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->chown($link, 'user'.time().mt_rand(1000, 9999));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testChownFail()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfPosixIsMissing();
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -722,11 +704,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertSame($group, $this->getFileGroup($link));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testChgrpSymlinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfSymlinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -739,11 +719,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->chgrp($link, 'user'.time().mt_rand(1000, 9999));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testChgrpLinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfLinkIsMissing();
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -756,11 +734,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->chgrp($link, 'user'.time().mt_rand(1000, 9999));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testChgrpFail()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->markAsSkippedIfPosixIsMissing();
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -781,11 +757,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertFileExists($newPath);
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testRenameThrowsExceptionIfTargetAlreadyExists()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
@@ -809,11 +783,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertFileExists($newPath);
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testRenameThrowsExceptionOnError()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
@@ -853,7 +825,7 @@ class FilesystemTest extends FilesystemTestCase
$this->assertFalse(is_link($link));
$this->assertFalse(is_file($link));
$this->assertFalse(is_dir($link));
$this->assertDirectoryNotExists($link);
}
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
@@ -1198,8 +1170,8 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertTrue(is_dir($targetPath.'directory'));
$this->assertDirectoryExists($targetPath);
$this->assertDirectoryExists($targetPath.'directory');
$this->assertFileEquals($file1, $targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1');
$this->assertFileEquals($file2, $targetPath.'file2');
@@ -1232,7 +1204,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->filesystem->remove($sourcePath);
}
@@ -1251,7 +1223,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'file1', $targetPath.'link1');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
}
@@ -1271,7 +1243,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
}
@@ -1295,7 +1267,7 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->mirror($sourcePath, $targetPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
$this->assertEquals('\\' === \DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.\DIRECTORY_SEPARATOR.'link1'));
@@ -1318,7 +1290,7 @@ class FilesystemTest extends FilesystemTestCase
chdir($oldPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileExists($targetPath.'source');
$this->assertFileExists($targetPath.'target');
}
@@ -1343,7 +1315,7 @@ class FilesystemTest extends FilesystemTestCase
chdir($oldPath);
$this->assertTrue(is_dir($targetPath));
$this->assertDirectoryExists($targetPath);
$this->assertFileExists($targetPath.'source');
$this->assertFileNotExists($targetPath.'target');
}
@@ -1420,11 +1392,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertFileExists($filename);
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testTempnamWithZlibSchemeFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$scheme = 'compress.zlib://';
$dirname = $scheme.$this->workspace;
@@ -1445,11 +1415,9 @@ class FilesystemTest extends FilesystemTestCase
$this->assertFileNotExists($filename);
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testTempnamWithPharSchemeFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
// Skip test if Phar disabled phar.readonly must be 0 in php.ini
if (!\Phar::canWrite()) {
$this->markTestSkipped('This test cannot run when phar.readonly is 1.');
@@ -1464,11 +1432,9 @@ class FilesystemTest extends FilesystemTestCase
$this->filesystem->tempnam($dirname, $pharname.'/bar');
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testTempnamWithHTTPSchemeFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$scheme = 'http://';
$dirname = $scheme.$this->workspace;

View File

@@ -21,7 +21,7 @@ class FilesystemTestCase extends TestCase
protected $longPathNamesWindows = [];
/**
* @var \Symfony\Component\Filesystem\Filesystem
* @var Filesystem
*/
protected $filesystem = null;
@@ -110,9 +110,8 @@ class FilesystemTestCase extends TestCase
$this->markAsSkippedIfPosixIsMissing();
$infos = stat($filepath);
if ($datas = posix_getpwuid($infos['uid'])) {
return $datas['name'];
}
return ($datas = posix_getpwuid($infos['uid'])) ? $datas['name'] : null;
}
protected function getFileGroup($filepath)
@@ -144,7 +143,7 @@ class FilesystemTestCase extends TestCase
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows');
}
// https://bugs.php.net/bug.php?id=69473
// https://bugs.php.net/69473
if ($relative && '\\' === \DIRECTORY_SEPARATOR && 1 === PHP_ZTS) {
$this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions');
}

View File

@@ -21,24 +21,20 @@ use Symfony\Component\Filesystem\LockHandler;
*/
class LockHandlerTest extends TestCase
{
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
* @expectedExceptionMessage Failed to create "/a/b/c/d/e": mkdir(): Permission denied.
*/
public function testConstructWhenRepositoryDoesNotExist()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectExceptionMessage('Failed to create "/a/b/c/d/e": mkdir(): Permission denied.');
if (!getenv('USER') || 'root' === getenv('USER')) {
$this->markTestSkipped('This test will fail if run under superuser');
}
new LockHandler('lock', '/a/b/c/d/e');
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
* @expectedExceptionMessage The directory "/" is not writable.
*/
public function testConstructWhenRepositoryIsNotWriteable()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectExceptionMessage('The directory "/" is not writable.');
if (!getenv('USER') || 'root' === getenv('USER')) {
$this->markTestSkipped('This test will fail if run under superuser');
}