Skip to content

Commit ad500e7

Browse files
committed
[Filesystem] Skip tests on readable file when run with root user
1 parent ed8dd86 commit ad500e7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public function testCopyUnreadableFileFails()
5050
$this->markTestSkipped('This test cannot run on Windows.');
5151
}
5252

53+
if (!getenv('USER') || 'root' === getenv('USER')) {
54+
$this->markTestSkipped('This test will fail if run under superuser');
55+
}
56+
5357
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
5458
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
5559

@@ -124,6 +128,10 @@ public function testCopyWithOverrideWithReadOnlyTargetFails()
124128
$this->markTestSkipped('This test cannot run on Windows.');
125129
}
126130

131+
if (!getenv('USER') || 'root' === getenv('USER')) {
132+
$this->markTestSkipped('This test will fail if run under superuser');
133+
}
134+
127135
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
128136
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
129137

src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public function testErrorHandlingInLockIfLockPathBecomesUnwritable()
4949
$this->markTestSkipped('This test cannot run on Windows.');
5050
}
5151

52+
if (!getenv('USER') || 'root' === getenv('USER')) {
53+
$this->markTestSkipped('This test will fail if run under superuser');
54+
}
55+
5256
$lockPath = sys_get_temp_dir().'/'.uniqid('', true);
5357
$e = null;
5458
$wrongMessage = null;

0 commit comments

Comments
 (0)