Skip to content

Commit afa87bc

Browse files
committed
stop using TestCase::iniSet()
1 parent 0470b8d commit afa87bc

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

Tests/FinderOpenBasedirTest.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,29 @@ public function testIgnoreVCSIgnoredWithOpenBasedir()
3535
->ignoreVCSIgnored(true)
3636
);
3737

38-
$this->iniSet('open_basedir', \dirname(__DIR__, 5).\PATH_SEPARATOR.self::toAbsolute('gitignore/search_root'));
39-
40-
$this->assertIterator(self::toAbsolute([
41-
'gitignore/search_root/b.txt',
42-
'gitignore/search_root/c.txt',
43-
'gitignore/search_root/dir',
44-
'gitignore/search_root/dir/a.txt',
45-
'gitignore/search_root/dir/c.txt',
46-
]), $finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
38+
$openBaseDir = \dirname(__DIR__, 5).\PATH_SEPARATOR.self::toAbsolute('gitignore/search_root');
39+
40+
if ($deprecationsFile = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
41+
$openBaseDir .= \PATH_SEPARATOR.$deprecationsFile;
42+
}
43+
44+
$oldOpenBaseDir = ini_set('open_basedir', $openBaseDir);
45+
46+
try {
47+
$this->assertIterator(self::toAbsolute([
48+
'gitignore/search_root/b.txt',
49+
'gitignore/search_root/c.txt',
50+
'gitignore/search_root/dir',
51+
'gitignore/search_root/dir/a.txt',
52+
'gitignore/search_root/dir/c.txt',
53+
]), $finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
54+
} finally {
55+
ini_set('open_basedir', $oldOpenBaseDir);
56+
}
4757
}
4858

4959
protected function buildFinder()
5060
{
5161
return Finder::create()->exclude('gitignore');
5262
}
53-
54-
protected function iniSet(string $varName, string $newValue): void
55-
{
56-
if ('open_basedir' === $varName && $deprecationsFile = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
57-
$newValue .= \PATH_SEPARATOR.$deprecationsFile;
58-
}
59-
60-
parent::iniSet($varName, $newValue);
61-
}
6263
}

0 commit comments

Comments
 (0)