merged branch pborreli/posix-fix (PR #5047)

Commits
-------

1d6611b [Filesystem] Fixed tests on system without posix

Discussion
----------

[Filesystem] Fixed tests on system without posix

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: master is broken
Fixes the following tickets: None
License of the code: MIT
This commit is contained in:
Fabien Potencier 2012-07-25 21:26:35 +02:00
commit 2ca73f9d7e

View File

@ -837,6 +837,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
private function getFileOwner($filepath)
{
$this->markAsSkippedIfPosixIsMissing();
$infos = stat($filepath);
if ($datas = posix_getpwuid($infos['uid'])) {
return $datas['name'];
@ -845,6 +847,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
private function getFileGroup($filepath)
{
$this->markAsSkippedIfPosixIsMissing();
$infos = stat($filepath);
if ($datas = posix_getgrgid($infos['gid'])) {
return $datas['name'];
@ -867,8 +871,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
private function markAsSkippedIfPosixIsMissing()
{
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
$this->markTestSkipped('Posix uids are not available on windows');
if (defined('PHP_WINDOWS_VERSION_MAJOR') || !function_exists('posix_isatty')) {
$this->markTestSkipped('Posix is not supported');
}
}
}