minor #28573 [Filesystem] Skip tests on readable file when run with root user (lbassin)
This PR was merged into the 2.8 branch.
Discussion
----------
[Filesystem] Skip tests on readable file when run with root user
| Q | A
| ------------- | ---
| Branch? | 2.8 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #28478 <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | - <!-- required for new features -->
This PR fix tests failures in Filesystem Component when running from a php docker container.
By defaut, root user is used to run phpunit. It means permission checking will fail (Root user is always allowed to read files)
Linked to #28529
Commits
-------
ad500e74ec
[Filesystem] Skip tests on readable file when run with root user
This commit is contained in:
commit
7c87dc9720
@ -50,6 +50,10 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
if (!getenv('USER') || 'root' === getenv('USER')) {
|
||||
$this->markTestSkipped('This test will fail if run under superuser');
|
||||
}
|
||||
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
@ -124,6 +128,10 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
if (!getenv('USER') || 'root' === getenv('USER')) {
|
||||
$this->markTestSkipped('This test will fail if run under superuser');
|
||||
}
|
||||
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
|
@ -49,6 +49,10 @@ class LockHandlerTest extends TestCase
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
if (!getenv('USER') || 'root' === getenv('USER')) {
|
||||
$this->markTestSkipped('This test will fail if run under superuser');
|
||||
}
|
||||
|
||||
$lockPath = sys_get_temp_dir().'/'.uniqid('', true);
|
||||
$e = null;
|
||||
$wrongMessage = null;
|
||||
|
Reference in New Issue
Block a user