Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d15c1d

Browse files
committed
minor #13225 [Filesystem] enforce umask while testing (nicolas-grekas)
This PR was merged into the 2.3 branch. Discussion ---------- [Filesystem] enforce umask while testing | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Having a predictable umask (but not the usual one) should help (TDD for #13222). When merging in 2.5, the patch should be moved to the new `FilesystemTestCase` Commits ------- 1e547be [Filesystem] enforce umask while testing
2 parents 4d56fd0 + 1e547be commit 7d15c1d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class FilesystemTest extends \PHPUnit_Framework_TestCase
2020
{
21+
private $umask;
22+
2123
/**
2224
* @var string
2325
*/
@@ -47,6 +49,7 @@ public static function setUpBeforeClass()
4749

4850
public function setUp()
4951
{
52+
$this->umask = umask(0);
5053
$this->filesystem = new Filesystem();
5154
$this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000);
5255
mkdir($this->workspace, 0777, true);
@@ -56,6 +59,7 @@ public function setUp()
5659
public function tearDown()
5760
{
5861
$this->clean($this->workspace);
62+
umask($this->umask);
5963
}
6064

6165
/**

0 commit comments

Comments
 (0)