Update v1.0.6.5

This commit is contained in:
sujitprasad
2016-03-02 12:25:21 +05:30
parent 7011553462
commit c56ff86194
218 changed files with 17161 additions and 2358 deletions

View File

@@ -358,6 +358,28 @@ class FilesystemTest extends FilesystemTestCase
$this->assertTrue($this->filesystem->exists($basePath.'folder'));
}
/**
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
*/
public function testFilesExistsFails()
{
if ('\\' !== DIRECTORY_SEPARATOR) {
$this->markTestSkipped('Test covers edge case on Windows only.');
}
$basePath = $this->workspace.'\\directory\\';
$oldPath = getcwd();
mkdir($basePath);
chdir($basePath);
$file = str_repeat('T', 259 - strlen($basePath));
$path = $basePath.$file;
exec('TYPE NUL >>'.$file); // equivalent of touch, we can not use the php touch() here because it suffers from the same limitation
self::$longPathNamesWindows[] = $path; // save this so we can clean up later
chdir($oldPath);
$this->filesystem->exists($path);
}
public function testFilesExistsTraversableObjectOfFilesAndDirectories()
{
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
@@ -893,7 +915,7 @@ class FilesystemTest extends FilesystemTestCase
public function testMirrorCopiesLinkedDirectoryContents()
{
$this->markAsSkippedIfSymlinkIsMissing();
$this->markAsSkippedIfSymlinkIsMissing(true);
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
@@ -913,7 +935,7 @@ class FilesystemTest extends FilesystemTestCase
public function testMirrorCopiesRelativeLinkedContents()
{
$this->markAsSkippedIfSymlinkIsMissing();
$this->markAsSkippedIfSymlinkIsMissing(true);
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
$oldPath = getcwd();
@@ -1005,7 +1027,6 @@ class FilesystemTest extends FilesystemTestCase
// The compress.zlib:// stream does not support mode x: creates the file, errors "failed to open stream: operation failed" and returns false
$this->filesystem->tempnam($dirname, 'bar');
}
public function testTempnamWithPHPTempSchemeFails()
@@ -1151,8 +1172,8 @@ class FilesystemTest extends FilesystemTestCase
{
$this->markAsSkippedIfChmodIsMissing();
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
$sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file';
$targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file';
file_put_contents($sourceFilePath, 'SOURCE FILE');
chmod($sourceFilePath, 0745);

View File

@@ -17,6 +17,8 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
{
private $umask;
static protected $longPathNamesWindows = array();
/**
* @var \Symfony\Component\Filesystem\Filesystem
*/
@@ -31,6 +33,12 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
public static function setUpBeforeClass()
{
if (!empty(self::$longPathNamesWindows)) {
foreach (self::$longPathNamesWindows as $path) {
exec('DEL '.$path);
}
}
if ('\\' === DIRECTORY_SEPARATOR && null === self::$symlinkOnWindows) {
$target = tempnam(sys_get_temp_dir(), 'sl');
$link = sys_get_temp_dir().'/sl'.microtime(true).mt_rand();
@@ -92,7 +100,7 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
$this->markTestSkipped('Unable to retrieve file group name');
}
protected function markAsSkippedIfSymlinkIsMissing()
protected function markAsSkippedIfSymlinkIsMissing($relative = false)
{
if (!function_exists('symlink')) {
$this->markTestSkipped('Function symlink is required.');
@@ -101,6 +109,11 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) {
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows');
}
// https://bugs.php.net/bug.php?id=69473
if ($relative && '\\' === DIRECTORY_SEPARATOR && 1 === PHP_ZTS) {
$this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions');
}
}
protected function markAsSkippedIfChmodIsMissing()