merged branch jfsimon/issue-5851 (PR #5859)
This PR was merged into the master branch. Commits -------2817a47
[Finder] Fixed filename containing space bug in gnu adapter.9bf7cb0
[Finder] Added filename containing space to tests. Discussion ---------- [Finder] Fixed filename containing space bug in gnu find adapter. Bug fix: yes Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes: #5851 `GNU find` adapter now uses `cut` instead of `awk`.
This commit is contained in:
commit
0f5af869c8
@ -84,7 +84,7 @@ class GnuFindAdapter extends AbstractAdapter
|
||||
$this->buildDatesFiltering($find, $this->dates);
|
||||
|
||||
$useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
|
||||
$useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('awk');
|
||||
$useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
|
||||
|
||||
if ($useGrep && ($this->contains || $this->notContains)) {
|
||||
$grep = $command->ins('grep');
|
||||
@ -286,8 +286,8 @@ class GnuFindAdapter extends AbstractAdapter
|
||||
{
|
||||
switch ($sort) {
|
||||
case SortableIterator::SORT_BY_NAME:
|
||||
$format = null;
|
||||
break;
|
||||
$command->ins('sort')->add('| sort');
|
||||
return;
|
||||
case SortableIterator::SORT_BY_TYPE:
|
||||
$format = '%y';
|
||||
break;
|
||||
@ -306,6 +306,6 @@ class GnuFindAdapter extends AbstractAdapter
|
||||
|
||||
$command->get('find')->add('-printf')->arg($format.' %h/%f\\n');
|
||||
$command->ins('sort')->add('| sort');
|
||||
$command->ins('awk')->add('| awk')->arg('{ print $'.(null === $format ? '1' : '2').' }');
|
||||
$command->ins('awk')->add('| cut')->arg('-d ')->arg('-f2-');
|
||||
}
|
||||
}
|
||||
|
@ -57,13 +57,13 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->files());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$finder->files();
|
||||
$finder->directories();
|
||||
$finder->files();
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,11 +73,11 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->depth('< 1'));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->depth('<= 0'));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->depth('>= 1'));
|
||||
@ -118,12 +118,12 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->notName('*.php'));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$finder->notName('*.php');
|
||||
$finder->notName('*.py');
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$finder->name('test.ph*');
|
||||
@ -172,7 +172,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->exclude('foo'));
|
||||
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,15 +182,15 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false));
|
||||
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false);
|
||||
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,15 +200,15 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false));
|
||||
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = new Finder();
|
||||
$finder->ignoreDotFiles(false)->ignoreDotFiles(false)->ignoreVCS(false);
|
||||
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->sortByName());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,7 +229,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->sortByType());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'toto', 'foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'toto', 'foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -239,7 +239,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->sortByAccessedTime());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -249,7 +249,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->sortByChangedTime());
|
||||
$this->assertIterator($this->toAbsolute(array('toto', 'test.py', 'test.php', 'foo/bar.tmp', 'foo')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('toto', 'test.py', 'test.php', 'foo/bar.tmp', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,7 +259,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->sortByModifiedTime());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -269,7 +269,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -293,7 +293,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
$finder = $this->buildFinder($adapter);
|
||||
$this->assertSame($finder, $finder->followLinks());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,7 +366,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$paths[] = $file->getRelativePath();
|
||||
}
|
||||
|
||||
$ref = array("", "", "", "", "foo");
|
||||
$ref = array("", "", "", "", "foo", "");
|
||||
|
||||
sort($ref);
|
||||
sort($paths);
|
||||
@ -389,7 +389,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$paths[] = $file->getRelativePathname();
|
||||
}
|
||||
|
||||
$ref = array("test.php", "toto", "test.py", "foo", "foo".DIRECTORY_SEPARATOR."bar.tmp");
|
||||
$ref = array("test.php", "toto", "test.py", "foo", "foo".DIRECTORY_SEPARATOR."bar.tmp", "foo bar");
|
||||
|
||||
sort($paths);
|
||||
sort($ref);
|
||||
|
@ -31,8 +31,8 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
public function getAcceptData()
|
||||
{
|
||||
return array(
|
||||
array(array(new DateComparator('since 20 years ago')), array(sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar')),
|
||||
array(array(new DateComparator('since 2 months ago')), array(sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar')),
|
||||
array(array(new DateComparator('since 20 years ago')), array(sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/foo bar')),
|
||||
array(array(new DateComparator('since 2 months ago')), array(sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/foo bar')),
|
||||
array(array(new DateComparator('until last month')), array(sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.foo')),
|
||||
);
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
public function getAcceptData()
|
||||
{
|
||||
return array(
|
||||
array(0, 0, array($this->getAbsolutePath('/.git'), $this->getAbsolutePath('/test.py'), $this->getAbsolutePath('/foo'), $this->getAbsolutePath('/test.php'), $this->getAbsolutePath('/toto'), $this->getAbsolutePath('/.foo'), $this->getAbsolutePath('/.bar'))),
|
||||
array(0, 1, array($this->getAbsolutePath('/.git'), $this->getAbsolutePath('/test.py'), $this->getAbsolutePath('/foo'), $this->getAbsolutePath('/foo/bar.tmp'), $this->getAbsolutePath('/test.php'), $this->getAbsolutePath('/toto'), $this->getAbsolutePath('/.foo'), $this->getAbsolutePath('/.foo/.bar'), $this->getAbsolutePath('/.bar'))),
|
||||
array(0, 0, array($this->getAbsolutePath('/.git'), $this->getAbsolutePath('/test.py'), $this->getAbsolutePath('/foo'), $this->getAbsolutePath('/test.php'), $this->getAbsolutePath('/toto'), $this->getAbsolutePath('/.foo'), $this->getAbsolutePath('/.bar'), $this->getAbsolutePath('/foo bar'))),
|
||||
array(0, 1, array($this->getAbsolutePath('/.git'), $this->getAbsolutePath('/test.py'), $this->getAbsolutePath('/foo'), $this->getAbsolutePath('/foo/bar.tmp'), $this->getAbsolutePath('/test.php'), $this->getAbsolutePath('/toto'), $this->getAbsolutePath('/.foo'), $this->getAbsolutePath('/.foo/.bar'), $this->getAbsolutePath('/.bar'), $this->getAbsolutePath('/foo bar'))),
|
||||
array(2, INF, array()),
|
||||
array(1, INF, array($this->getAbsolutePath('/foo/bar.tmp'), $this->getAbsolutePath('/.foo/.bar'))),
|
||||
array(1, 1, array($this->getAbsolutePath('/foo/bar.tmp'), $this->getAbsolutePath('/.foo/.bar'))),
|
||||
|
@ -40,7 +40,8 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'.git',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'test.py',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'test.php',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'toto'
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'toto',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'foo bar',
|
||||
)),
|
||||
array(array('fo'), array(
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'.bar',
|
||||
@ -51,7 +52,8 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'foo',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'test.php',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'toto'
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'toto',
|
||||
$tmpDir.DIRECTORY_SEPARATOR.'foo bar',
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class FileTypeFilterIteratorTest extends RealIteratorTestCase
|
||||
public function getAcceptData()
|
||||
{
|
||||
return array(
|
||||
array(FileTypeFilterIterator::ONLY_FILES, array(sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo/.bar')),
|
||||
array(FileTypeFilterIterator::ONLY_FILES, array(sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/foo bar')),
|
||||
array(FileTypeFilterIterator::ONLY_DIRECTORIES, array(sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.foo')),
|
||||
);
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
||||
$tmpDir.'/foo/',
|
||||
$tmpDir.'/foo/bar.tmp',
|
||||
$tmpDir.'/test.php',
|
||||
$tmpDir.'/toto/'
|
||||
$tmpDir.'/toto/',
|
||||
$tmpDir.'/foo bar',
|
||||
);
|
||||
|
||||
if (is_dir($tmpDir)) {
|
||||
|
@ -40,9 +40,9 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
public function getAcceptData()
|
||||
{
|
||||
return array(
|
||||
array(SortableIterator::SORT_BY_NAME, array(sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/toto')),
|
||||
array(SortableIterator::SORT_BY_TYPE, array(sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/test.py')),
|
||||
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }, array(sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/toto')),
|
||||
array(SortableIterator::SORT_BY_NAME, array(sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/foo bar', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/toto')),
|
||||
array(SortableIterator::SORT_BY_TYPE, array(sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/toto', sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/foo bar', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/test.py')),
|
||||
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }, array(sys_get_temp_dir().'/symfony2_finder/.bar', sys_get_temp_dir().'/symfony2_finder/.foo', sys_get_temp_dir().'/symfony2_finder/.foo/.bar', sys_get_temp_dir().'/symfony2_finder/.git', sys_get_temp_dir().'/symfony2_finder/foo', sys_get_temp_dir().'/symfony2_finder/foo bar', sys_get_temp_dir().'/symfony2_finder/foo/bar.tmp', sys_get_temp_dir().'/symfony2_finder/test.php', sys_get_temp_dir().'/symfony2_finder/test.py', sys_get_temp_dir().'/symfony2_finder/toto')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user