Skip to content

Commit e8d3ad5

Browse files
committed
[Filesystem] Fixed tests on system without posix
1 parent adc6792 commit e8d3ad5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Tests/FilesystemTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ private function getFilePermisions($filePath)
837837

838838
private function getFileOwner($filepath)
839839
{
840+
$this->markAsSkippedIfPosixIsMissing();
841+
840842
$infos = stat($filepath);
841843
if ($datas = posix_getpwuid($infos['uid'])) {
842844
return $datas['name'];
@@ -845,6 +847,8 @@ private function getFileOwner($filepath)
845847

846848
private function getFileGroup($filepath)
847849
{
850+
$this->markAsSkippedIfPosixIsMissing();
851+
848852
$infos = stat($filepath);
849853
if ($datas = posix_getgrgid($infos['gid'])) {
850854
return $datas['name'];
@@ -867,8 +871,8 @@ private function markAsSkippedIfChmodIsMissing()
867871

868872
private function markAsSkippedIfPosixIsMissing()
869873
{
870-
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
871-
$this->markTestSkipped('Posix uids are not available on windows');
874+
if (defined('PHP_WINDOWS_VERSION_MAJOR') || !function_exists('posix_isatty')) {
875+
$this->markTestSkipped('Posix is not supported');
872876
}
873877
}
874878
}

0 commit comments

Comments
 (0)