[Filesystem] Fixed tests on system without posix

This commit is contained in:
Pascal Borreli 2012-07-25 17:04:57 +00:00
parent 2bc358dbcd
commit 1d6611be50

View File

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