summaryrefslogtreecommitdiffstats
path: root/Aufgabe06/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
diff options
context:
space:
mode:
authorStefan Suhren <suhren.stefan@fh-swf.de>2015-05-11 15:02:33 +0200
committerStefan Suhren <suhren.stefan@fh-swf.de>2015-05-11 15:02:33 +0200
commita7e17cb70e9306f8887bd2b5ca1a37edcbe3ea0f (patch)
treebf6e04c9bdba66e249fd6b78391e132da130848c /Aufgabe06/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
parentea3fed0df4eaedd820f3f405502b62efe5952f8f (diff)
downloadInternetTechnologien-a7e17cb70e9306f8887bd2b5ca1a37edcbe3ea0f.tar.gz
InternetTechnologien-a7e17cb70e9306f8887bd2b5ca1a37edcbe3ea0f.zip
Let composer manage its own files
Diffstat (limited to 'Aufgabe06/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php')
-rw-r--r--Aufgabe06/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php131
1 files changed, 0 insertions, 131 deletions
diff --git a/Aufgabe06/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/Aufgabe06/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
deleted file mode 100644
index 80cd57e..0000000
--- a/Aufgabe06/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?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;
-
-class FilesystemTestCase extends \PHPUnit_Framework_TestCase
-{
- private $umask;
-
- /**
- * @var string $workspace
- */
- protected $workspace = null;
-
- protected static $symlinkOnWindows = null;
-
- public static function setUpBeforeClass()
- {
- if ('\\' === DIRECTORY_SEPARATOR) {
- static::$symlinkOnWindows = true;
- $originDir = tempnam(sys_get_temp_dir(), 'sl');
- $targetDir = tempnam(sys_get_temp_dir(), 'sl');
- if (true !== @symlink($originDir, $targetDir)) {
- $report = error_get_last();
- if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) {
- static::$symlinkOnWindows = false;
- }
- }
- }
- }
-
- protected function setUp()
- {
- $this->umask = umask(0);
- $this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000);
- mkdir($this->workspace, 0777, true);
- $this->workspace = realpath($this->workspace);
- }
-
- protected function tearDown()
- {
- $this->clean($this->workspace);
- umask($this->umask);
- }
-
- /**
- * @param string $file
- */
- protected function clean($file)
- {
- if (is_dir($file) && !is_link($file)) {
- $dir = new \FilesystemIterator($file);
- foreach ($dir as $childFile) {
- $this->clean($childFile);
- }
-
- rmdir($file);
- } else {
- unlink($file);
- }
- }
-
- /**
- * @param int $expectedFilePerms expected file permissions as three digits (i.e. 755)
- * @param string $filePath
- */
- protected function assertFilePermissions($expectedFilePerms, $filePath)
- {
- $actualFilePerms = (int) substr(sprintf('%o', fileperms($filePath)), -3);
- $this->assertEquals(
- $expectedFilePerms,
- $actualFilePerms,
- sprintf('File permissions for %s must be %s. Actual %s', $filePath, $expectedFilePerms, $actualFilePerms)
- );
- }
-
- protected function getFileOwner($filepath)
- {
- $this->markAsSkippedIfPosixIsMissing();
-
- $infos = stat($filepath);
- if ($datas = posix_getpwuid($infos['uid'])) {
- return $datas['name'];
- }
- }
-
- protected function getFileGroup($filepath)
- {
- $this->markAsSkippedIfPosixIsMissing();
-
- $infos = stat($filepath);
- if ($datas = posix_getgrgid($infos['gid'])) {
- return $datas['name'];
- }
-
- $this->markTestSkipped('Unable to retrieve file group name');
- }
-
- protected function markAsSkippedIfSymlinkIsMissing()
- {
- if (!function_exists('symlink')) {
- $this->markTestSkipped('symlink is not supported');
- }
-
- if ('\\' === DIRECTORY_SEPARATOR && false === static::$symlinkOnWindows) {
- $this->markTestSkipped('symlink requires "Create symbolic links" privilege on windows');
- }
- }
-
- protected function markAsSkippedIfChmodIsMissing()
- {
- if ('\\' === DIRECTORY_SEPARATOR) {
- $this->markTestSkipped('chmod is not supported on windows');
- }
- }
-
- protected function markAsSkippedIfPosixIsMissing()
- {
- if ('\\' === DIRECTORY_SEPARATOR || !function_exists('posix_isatty')) {
- $this->markTestSkipped('Posix is not supported');
- }
- }
-}