Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2374fb6

Browse filesBrowse files
[Finder] Disable failing test about open_basedir
1 parent 5a965f9 commit 2374fb6
Copy full SHA for 2374fb6

File tree

Expand file treeCollapse file tree

2 files changed

+63
-38
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+63
-38
lines changed
+62Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Finder\Tests;
13+
14+
use Symfony\Component\Finder\Finder;
15+
16+
class FinderOpenBasedirTest extends Iterator\RealIteratorTestCase
17+
{
18+
/**
19+
* @runInSeparateProcess
20+
*/
21+
public function testIgnoreVCSIgnoredWithOpenBasedir()
22+
{
23+
$this->markTestIncomplete('Test case needs to be refactored so that PHPUnit can run it');
24+
25+
if (\ini_get('open_basedir')) {
26+
$this->markTestSkipped('Cannot test when open_basedir is set');
27+
}
28+
29+
$finder = $this->buildFinder();
30+
$this->assertSame(
31+
$finder,
32+
$finder
33+
->ignoreVCS(true)
34+
->ignoreDotFiles(true)
35+
->ignoreVCSIgnored(true)
36+
);
37+
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());
47+
}
48+
49+
protected function buildFinder()
50+
{
51+
return Finder::create()->exclude('gitignore');
52+
}
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+
}
62+
}

‎src/Symfony/Component/Finder/Tests/FinderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Finder/Tests/FinderTest.php
+1-38Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -482,35 +482,6 @@ public function testIgnoreVCSIgnoredUpToFirstGitRepositoryRoot()
482482
]), $finder->in(self::toAbsolute('gitignore/git_root/search_root'))->getIterator());
483483
}
484484

485-
/**
486-
* @runInSeparateProcess
487-
*/
488-
public function testIgnoreVCSIgnoredWithOpenBasedir()
489-
{
490-
if (\ini_get('open_basedir')) {
491-
$this->markTestSkipped('Cannot test when open_basedir is set');
492-
}
493-
494-
$finder = $this->buildFinder();
495-
$this->assertSame(
496-
$finder,
497-
$finder
498-
->ignoreVCS(true)
499-
->ignoreDotFiles(true)
500-
->ignoreVCSIgnored(true)
501-
);
502-
503-
$this->iniSet('open_basedir', \dirname(__DIR__, 5).\PATH_SEPARATOR.self::toAbsolute('gitignore/search_root'));
504-
505-
$this->assertIterator(self::toAbsolute([
506-
'gitignore/search_root/b.txt',
507-
'gitignore/search_root/c.txt',
508-
'gitignore/search_root/dir',
509-
'gitignore/search_root/dir/a.txt',
510-
'gitignore/search_root/dir/c.txt',
511-
]), $finder->in(self::toAbsolute('gitignore/search_root'))->getIterator());
512-
}
513-
514485
public function testIgnoreVCSCanBeDisabledAfterFirstIteration()
515486
{
516487
$finder = $this->buildFinder();
@@ -1056,6 +1027,7 @@ public function testIn()
10561027
self::$tmpDir.\DIRECTORY_SEPARATOR.'Zephire.php',
10571028
self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php',
10581029
__DIR__.\DIRECTORY_SEPARATOR.'GitignoreTest.php',
1030+
__DIR__.\DIRECTORY_SEPARATOR.'FinderOpenBasedirTest.php',
10591031
__DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php',
10601032
__DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php',
10611033
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_0_1.php',
@@ -1624,13 +1596,4 @@ protected function buildFinder()
16241596
{
16251597
return Finder::create()->exclude('gitignore');
16261598
}
1627-
1628-
protected function iniSet(string $varName, string $newValue): void
1629-
{
1630-
if ('open_basedir' === $varName && $deprecationsFile = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
1631-
$newValue .= \PATH_SEPARATOR.$deprecationsFile;
1632-
}
1633-
1634-
parent::iniSet('open_basedir', $newValue);
1635-
}
16361599
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.