composer update
This commit is contained in:
8
vendor/symfony/finder/CHANGELOG.md
vendored
8
vendor/symfony/finder/CHANGELOG.md
vendored
@@ -1,6 +1,14 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
4.2.0
|
||||
-----
|
||||
|
||||
* added $useNaturalSort option to Finder::sortByName() method
|
||||
* the `Finder::sortByName()` method will have a new `$useNaturalSort`
|
||||
argument in version 5.0, not defining it is deprecated
|
||||
* added `Finder::reverseSorting()` to reverse the sorting
|
||||
|
||||
4.0.0
|
||||
-----
|
||||
|
||||
|
150
vendor/symfony/finder/Finder.php
vendored
150
vendor/symfony/finder/Finder.php
vendored
@@ -31,7 +31,7 @@ use Symfony\Component\Finder\Iterator\SortableIterator;
|
||||
*
|
||||
* All methods return the current Finder object to allow easy chaining:
|
||||
*
|
||||
* $finder = Finder::create()->files()->name('*.php')->in(__DIR__);
|
||||
* $finder = Finder::create()->files()->name('*.php')->in(__DIR__);
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
@@ -48,6 +48,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
private $depths = array();
|
||||
private $sizes = array();
|
||||
private $followLinks = false;
|
||||
private $reverseSorting = false;
|
||||
private $sort = false;
|
||||
private $ignore = 0;
|
||||
private $dirs = array();
|
||||
@@ -105,19 +106,22 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* $finder->depth('> 1') // the Finder will start matching at level 1.
|
||||
* $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point.
|
||||
* $finder->depth('> 1') // the Finder will start matching at level 1.
|
||||
* $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point.
|
||||
* $finder->depth(['>= 1', '< 3'])
|
||||
*
|
||||
* @param string|int $level The depth level expression
|
||||
* @param string|int|string[]|int[] $levels The depth level expression or an array of depth levels
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see DepthRangeFilterIterator
|
||||
* @see NumberComparator
|
||||
*/
|
||||
public function depth($level)
|
||||
public function depth($levels)
|
||||
{
|
||||
$this->depths[] = new Comparator\NumberComparator($level);
|
||||
foreach ((array) $levels as $level) {
|
||||
$this->depths[] = new Comparator\NumberComparator($level);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -127,12 +131,13 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* The date must be something that strtotime() is able to parse:
|
||||
*
|
||||
* $finder->date('since yesterday');
|
||||
* $finder->date('until 2 days ago');
|
||||
* $finder->date('> now - 2 hours');
|
||||
* $finder->date('>= 2005-10-15');
|
||||
* $finder->date('since yesterday');
|
||||
* $finder->date('until 2 days ago');
|
||||
* $finder->date('> now - 2 hours');
|
||||
* $finder->date('>= 2005-10-15');
|
||||
* $finder->date(['>= 2005-10-15', '<= 2006-05-27']);
|
||||
*
|
||||
* @param string $date A date range string
|
||||
* @param string|string[] $dates A date range string or an array of date ranges
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
@@ -140,9 +145,11 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
* @see DateRangeFilterIterator
|
||||
* @see DateComparator
|
||||
*/
|
||||
public function date($date)
|
||||
public function date($dates)
|
||||
{
|
||||
$this->dates[] = new Comparator\DateComparator($date);
|
||||
foreach ((array) $dates as $date) {
|
||||
$this->dates[] = new Comparator\DateComparator($date);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -152,19 +159,20 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* You can use patterns (delimited with / sign), globs or simple strings.
|
||||
*
|
||||
* $finder->name('*.php')
|
||||
* $finder->name('/\.php$/') // same as above
|
||||
* $finder->name('test.php')
|
||||
* $finder->name('*.php')
|
||||
* $finder->name('/\.php$/') // same as above
|
||||
* $finder->name('test.php')
|
||||
* $finder->name(['test.py', 'test.php'])
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp, a glob, or a string)
|
||||
* @param string|string[] $patterns A pattern (a regexp, a glob, or a string) or an array of patterns
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
public function name($pattern)
|
||||
public function name($patterns)
|
||||
{
|
||||
$this->names[] = $pattern;
|
||||
$this->names = \array_merge($this->names, (array) $patterns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -172,15 +180,15 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Adds rules that files must not match.
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp, a glob, or a string)
|
||||
* @param string|string[] $patterns A pattern (a regexp, a glob, or a string) or an array of patterns
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
public function notName($pattern)
|
||||
public function notName($patterns)
|
||||
{
|
||||
$this->notNames[] = $pattern;
|
||||
$this->notNames = \array_merge($this->notNames, (array) $patterns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -190,18 +198,19 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* Strings or PCRE patterns can be used:
|
||||
*
|
||||
* $finder->contains('Lorem ipsum')
|
||||
* $finder->contains('/Lorem ipsum/i')
|
||||
* $finder->contains('Lorem ipsum')
|
||||
* $finder->contains('/Lorem ipsum/i')
|
||||
* $finder->contains(['dolor', '/ipsum/i'])
|
||||
*
|
||||
* @param string $pattern A pattern (string or regexp)
|
||||
* @param string|string[] $patterns A pattern (string or regexp) or an array of patterns
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see FilecontentFilterIterator
|
||||
*/
|
||||
public function contains($pattern)
|
||||
public function contains($patterns)
|
||||
{
|
||||
$this->contains[] = $pattern;
|
||||
$this->contains = \array_merge($this->contains, (array) $patterns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -211,18 +220,19 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* Strings or PCRE patterns can be used:
|
||||
*
|
||||
* $finder->notContains('Lorem ipsum')
|
||||
* $finder->notContains('/Lorem ipsum/i')
|
||||
* $finder->notContains('Lorem ipsum')
|
||||
* $finder->notContains('/Lorem ipsum/i')
|
||||
* $finder->notContains(['lorem', '/dolor/i'])
|
||||
*
|
||||
* @param string $pattern A pattern (string or regexp)
|
||||
* @param string|string[] $patterns A pattern (string or regexp) or an array of patterns
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see FilecontentFilterIterator
|
||||
*/
|
||||
public function notContains($pattern)
|
||||
public function notContains($patterns)
|
||||
{
|
||||
$this->notContains[] = $pattern;
|
||||
$this->notContains = \array_merge($this->notContains, (array) $patterns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -232,20 +242,21 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* You can use patterns (delimited with / sign) or simple strings.
|
||||
*
|
||||
* $finder->path('some/special/dir')
|
||||
* $finder->path('/some\/special\/dir/') // same as above
|
||||
* $finder->path('some/special/dir')
|
||||
* $finder->path('/some\/special\/dir/') // same as above
|
||||
* $finder->path(['some dir', 'another/dir'])
|
||||
*
|
||||
* Use only / as dirname separator.
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp or a string)
|
||||
* @param string|string[] $patterns A pattern (a regexp or a string) or an array of patterns
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
public function path($pattern)
|
||||
public function path($patterns)
|
||||
{
|
||||
$this->paths[] = $pattern;
|
||||
$this->paths = \array_merge($this->paths, (array) $patterns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -255,20 +266,21 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* You can use patterns (delimited with / sign) or simple strings.
|
||||
*
|
||||
* $finder->notPath('some/special/dir')
|
||||
* $finder->notPath('/some\/special\/dir/') // same as above
|
||||
* $finder->notPath('some/special/dir')
|
||||
* $finder->notPath('/some\/special\/dir/') // same as above
|
||||
* $finder->notPath(['some/file.txt', 'another/file.log'])
|
||||
*
|
||||
* Use only / as dirname separator.
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp or a string)
|
||||
* @param string|string[] $patterns A pattern (a regexp or a string) or an array of patterns
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
public function notPath($pattern)
|
||||
public function notPath($patterns)
|
||||
{
|
||||
$this->notPaths[] = $pattern;
|
||||
$this->notPaths = \array_merge($this->notPaths, (array) $patterns);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -276,20 +288,23 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Adds tests for file sizes.
|
||||
*
|
||||
* $finder->size('> 10K');
|
||||
* $finder->size('<= 1Ki');
|
||||
* $finder->size(4);
|
||||
* $finder->size('> 10K');
|
||||
* $finder->size('<= 1Ki');
|
||||
* $finder->size(4);
|
||||
* $finder->size(['> 10K', '< 20K'])
|
||||
*
|
||||
* @param string|int $size A size range string or an integer
|
||||
* @param string|int|string[]|int[] $sizes A size range string or an integer or an array of size ranges
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see SizeRangeFilterIterator
|
||||
* @see NumberComparator
|
||||
*/
|
||||
public function size($size)
|
||||
public function size($sizes)
|
||||
{
|
||||
$this->sizes[] = new Comparator\NumberComparator($size);
|
||||
foreach ((array) $sizes as $size) {
|
||||
$this->sizes[] = new Comparator\NumberComparator($size);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -397,13 +412,20 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @param bool $useNaturalSort Whether to use natural sort or not, disabled by default
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
public function sortByName()
|
||||
public function sortByName(/* bool $useNaturalSort = false */)
|
||||
{
|
||||
$this->sort = Iterator\SortableIterator::SORT_BY_NAME;
|
||||
if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
|
||||
@trigger_error(sprintf('The "%s()" method will have a new "bool $useNaturalSort = false" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
|
||||
}
|
||||
$useNaturalSort = 0 < \func_num_args() && func_get_arg(0);
|
||||
|
||||
$this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -442,6 +464,18 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverses the sorting.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function reverseSorting()
|
||||
{
|
||||
$this->reverseSorting = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts files and directories by the last inode changed time.
|
||||
*
|
||||
@@ -589,7 +623,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array.
|
||||
*
|
||||
* @param mixed $iterator
|
||||
* @param iterable $iterator
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
@@ -716,8 +750,8 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
|
||||
}
|
||||
|
||||
if ($this->sort) {
|
||||
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
|
||||
if ($this->sort || $this->reverseSorting) {
|
||||
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting);
|
||||
$iterator = $iteratorAggregate->getIterator();
|
||||
}
|
||||
|
||||
@@ -727,12 +761,20 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Normalizes given directory names by removing trailing slashes.
|
||||
*
|
||||
* Excluding: (s)ftp:// wrapper
|
||||
*
|
||||
* @param string $dir
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function normalizeDir($dir)
|
||||
{
|
||||
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
|
||||
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
|
||||
|
||||
if (preg_match('#^s?ftp://#', $dir)) {
|
||||
$dir .= '/';
|
||||
}
|
||||
|
||||
return $dir;
|
||||
}
|
||||
}
|
||||
|
14
vendor/symfony/finder/Glob.php
vendored
14
vendor/symfony/finder/Glob.php
vendored
@@ -14,14 +14,14 @@ namespace Symfony\Component\Finder;
|
||||
/**
|
||||
* Glob matches globbing patterns against text.
|
||||
*
|
||||
* if match_glob("foo.*", "foo.bar") echo "matched\n";
|
||||
* if match_glob("foo.*", "foo.bar") echo "matched\n";
|
||||
*
|
||||
* // prints foo.bar and foo.baz
|
||||
* $regex = glob_to_regex("foo.*");
|
||||
* for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t)
|
||||
* {
|
||||
* if (/$regex/) echo "matched: $car\n";
|
||||
* }
|
||||
* // prints foo.bar and foo.baz
|
||||
* $regex = glob_to_regex("foo.*");
|
||||
* for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t)
|
||||
* {
|
||||
* if (/$regex/) echo "matched: $car\n";
|
||||
* }
|
||||
*
|
||||
* Glob implements glob(3) style matching that can be used to match
|
||||
* against text, rather than fetching names from a filesystem.
|
||||
|
@@ -18,11 +18,13 @@ namespace Symfony\Component\Finder\Iterator;
|
||||
*/
|
||||
class SortableIterator implements \IteratorAggregate
|
||||
{
|
||||
const SORT_BY_NONE = 0;
|
||||
const SORT_BY_NAME = 1;
|
||||
const SORT_BY_TYPE = 2;
|
||||
const SORT_BY_ACCESSED_TIME = 3;
|
||||
const SORT_BY_CHANGED_TIME = 4;
|
||||
const SORT_BY_MODIFIED_TIME = 5;
|
||||
const SORT_BY_NAME_NATURAL = 6;
|
||||
|
||||
private $iterator;
|
||||
private $sort;
|
||||
@@ -33,38 +35,45 @@ class SortableIterator implements \IteratorAggregate
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct(\Traversable $iterator, $sort)
|
||||
public function __construct(\Traversable $iterator, $sort, bool $reverseOrder = false)
|
||||
{
|
||||
$this->iterator = $iterator;
|
||||
$order = $reverseOrder ? -1 : 1;
|
||||
|
||||
if (self::SORT_BY_NAME === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||
$this->sort = function ($a, $b) use ($order) {
|
||||
return $order * strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_NAME_NATURAL === $sort) {
|
||||
$this->sort = function ($a, $b) use ($order) {
|
||||
return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_TYPE === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
$this->sort = function ($a, $b) use ($order) {
|
||||
if ($a->isDir() && $b->isFile()) {
|
||||
return -1;
|
||||
return -$order;
|
||||
} elseif ($a->isFile() && $b->isDir()) {
|
||||
return 1;
|
||||
return $order;
|
||||
}
|
||||
|
||||
return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||
return $order * strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
return $a->getATime() - $b->getATime();
|
||||
$this->sort = function ($a, $b) use ($order) {
|
||||
return $order * ($a->getATime() - $b->getATime());
|
||||
};
|
||||
} elseif (self::SORT_BY_CHANGED_TIME === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
return $a->getCTime() - $b->getCTime();
|
||||
$this->sort = function ($a, $b) use ($order) {
|
||||
return $order * ($a->getCTime() - $b->getCTime());
|
||||
};
|
||||
} elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
return $a->getMTime() - $b->getMTime();
|
||||
$this->sort = function ($a, $b) use ($order) {
|
||||
return $order * ($a->getMTime() - $b->getMTime());
|
||||
};
|
||||
} elseif (self::SORT_BY_NONE === $sort) {
|
||||
$this->sort = $order;
|
||||
} elseif (\is_callable($sort)) {
|
||||
$this->sort = $sort;
|
||||
$this->sort = $reverseOrder ? function ($a, $b) use ($sort) { return -\call_user_func($sort, $a, $b); } : $sort;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
|
||||
}
|
||||
@@ -72,8 +81,17 @@ class SortableIterator implements \IteratorAggregate
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
if (1 === $this->sort) {
|
||||
return $this->iterator;
|
||||
}
|
||||
|
||||
$array = iterator_to_array($this->iterator, true);
|
||||
uasort($array, $this->sort);
|
||||
|
||||
if (-1 === $this->sort) {
|
||||
$array = array_reverse($array);
|
||||
} else {
|
||||
uasort($array, $this->sort);
|
||||
}
|
||||
|
||||
return new \ArrayIterator($array);
|
||||
}
|
||||
|
611
vendor/symfony/finder/Tests/FinderTest.php
vendored
611
vendor/symfony/finder/Tests/FinderTest.php
vendored
@@ -24,33 +24,70 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->directories());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'qux', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->directories();
|
||||
$finder->files();
|
||||
$finder->directories();
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'qux', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testFiles()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->files());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'foo bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->files();
|
||||
$finder->directories();
|
||||
$finder->files();
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'foo bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testRemoveTrailingSlash()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
|
||||
$expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar'));
|
||||
$expected = $this->toAbsolute(array(
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'foo bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
));
|
||||
$in = self::$tmpDir.'//';
|
||||
|
||||
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
|
||||
@@ -89,26 +126,73 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->depth('< 1'));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->depth('<= 0'));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->depth('>= 1'));
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo/bar.tmp',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->depth('< 1')->depth('>= 1');
|
||||
$this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testDepthWithArrayParam()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->depth(array('>= 1', '< 2'));
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo/bar.tmp',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testName()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->name('*.php'));
|
||||
$this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'test.php',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->name('test.ph*');
|
||||
@@ -121,23 +205,53 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->name('~\\.php$~i');
|
||||
$this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'test.php',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->name('test.p{hp,y}');
|
||||
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testNameWithArrayParam()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->name(array('test.php', 'test.py'));
|
||||
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testNotName()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->notName('*.php'));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.py',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->notName('*.php');
|
||||
$finder->notName('*.py');
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->name('test.ph*');
|
||||
@@ -153,6 +267,19 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testNotNameWithArrayParam()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->notName(array('*.php', '*.py'));
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getRegexNameTestData
|
||||
*/
|
||||
@@ -160,7 +287,10 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->name($regex);
|
||||
$this->assertIterator($this->toAbsolute(array('test.py', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'test.py',
|
||||
'test.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSize()
|
||||
@@ -170,6 +300,13 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSizeWithArrayParam()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->files()->size(array('< 1K', '> 500')));
|
||||
$this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testDate()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
@@ -177,83 +314,391 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testDateWithArrayParam()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->files()->date(array('>= 2005-10-15', 'until last month')));
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testExclude()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->exclude('foo'));
|
||||
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testIgnoreVCS()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false));
|
||||
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'.git',
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false);
|
||||
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'.git',
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$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', '.foo/bar', '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',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testIgnoreDotFiles()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false));
|
||||
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'.git',
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->ignoreDotFiles(false)->ignoreDotFiles(false)->ignoreVCS(false);
|
||||
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'.git',
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSortByName()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByName());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo bar',
|
||||
'foo/bar.tmp',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSortByType()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByType());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', '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',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSortByAccessedTime()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByAccessedTime());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'toto',
|
||||
'test.py',
|
||||
'foo',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSortByChangedTime()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByChangedTime());
|
||||
$this->assertIterator($this->toAbsolute(array('toto', 'test.py', 'test.php', 'foo/bar.tmp', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'toto',
|
||||
'test.py',
|
||||
'test.php',
|
||||
'foo/bar.tmp',
|
||||
'foo',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSortByModifiedTime()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByModifiedTime());
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'toto',
|
||||
'test.py',
|
||||
'foo',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testReverseSorting()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByName());
|
||||
$this->assertSame($finder, $finder->reverseSorting());
|
||||
$this->assertOrderedIteratorInForeach($this->toAbsolute(array(
|
||||
'toto',
|
||||
'test.py',
|
||||
'test.php',
|
||||
'qux_2_0.php',
|
||||
'qux_12_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_0_1.php',
|
||||
'qux/baz_1_2.py',
|
||||
'qux/baz_100_1.py',
|
||||
'qux',
|
||||
'foo/bar.tmp',
|
||||
'foo bar',
|
||||
'foo',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSortByNameNatural()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByName(true));
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo bar',
|
||||
'foo/bar.tmp',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sortByName(false));
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo bar',
|
||||
'foo/bar.tmp',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testSort()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }));
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', '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',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testFilter()
|
||||
@@ -271,7 +716,23 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertSame($finder, $finder->followLinks());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testIn()
|
||||
@@ -283,6 +744,12 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php',
|
||||
__DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php',
|
||||
__DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_0_1.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_1000_1.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_1002_0.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_10_2.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_12_0.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'qux_2_0.php',
|
||||
);
|
||||
|
||||
$this->assertIterator($expected, $iterator);
|
||||
@@ -339,7 +806,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$dirs[] = (string) $dir;
|
||||
}
|
||||
|
||||
$expected = $this->toAbsolute(array('foo', 'toto'));
|
||||
$expected = $this->toAbsolute(array('foo', 'qux', 'toto'));
|
||||
|
||||
sort($dirs);
|
||||
sort($expected);
|
||||
@@ -347,7 +814,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$this->assertEquals($expected, $dirs, 'implements the \IteratorAggregate interface');
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$this->assertEquals(2, iterator_count($finder->directories()->in(self::$tmpDir)), 'implements the \IteratorAggregate interface');
|
||||
$this->assertEquals(3, iterator_count($finder->directories()->in(self::$tmpDir)), 'implements the \IteratorAggregate interface');
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$a = iterator_to_array($finder->directories()->in(self::$tmpDir));
|
||||
@@ -366,7 +833,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$paths[] = $file->getRelativePath();
|
||||
}
|
||||
|
||||
$ref = array('', '', '', '', 'foo', '');
|
||||
$ref = array('', '', '', '', '', '', '', '', '', '', '', 'foo', 'qux', 'qux', '');
|
||||
|
||||
sort($ref);
|
||||
sort($paths);
|
||||
@@ -384,7 +851,23 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$paths[] = $file->getRelativePathname();
|
||||
}
|
||||
|
||||
$ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.\DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar');
|
||||
$ref = array(
|
||||
'test.php',
|
||||
'toto',
|
||||
'test.py',
|
||||
'foo',
|
||||
'foo'.\DIRECTORY_SEPARATOR.'bar.tmp',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux'.\DIRECTORY_SEPARATOR.'baz_100_1.py',
|
||||
'qux'.\DIRECTORY_SEPARATOR.'baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
sort($paths);
|
||||
sort($ref);
|
||||
@@ -402,7 +885,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
$finder = $finder->append($finder1);
|
||||
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'qux', 'toto')), $finder->getIterator());
|
||||
}
|
||||
|
||||
public function testAppendWithAnArray()
|
||||
@@ -595,13 +1078,15 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
array('lorem', 'foobar', array('lorem.txt')),
|
||||
array('', 'lorem', array('dolor.txt', 'ipsum.txt')),
|
||||
array('ipsum dolor sit amet', '/^IPSUM/m', array('lorem.txt')),
|
||||
array(array('lorem', 'dolor'), array(), array('lorem.txt', 'ipsum.txt', 'dolor.txt')),
|
||||
array('', array('lorem', 'ipsum'), array('dolor.txt')),
|
||||
);
|
||||
}
|
||||
|
||||
public function getRegexNameTestData()
|
||||
{
|
||||
return array(
|
||||
array('~.+\\.p.+~i'),
|
||||
array('~.*t\\.p.+~i'),
|
||||
array('~t.*s~i'),
|
||||
);
|
||||
}
|
||||
@@ -661,6 +1146,33 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
'with space'.\DIRECTORY_SEPARATOR.'foo.txt',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'/^A/',
|
||||
array('a.dat', 'abc.dat'),
|
||||
array(
|
||||
'A',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
),
|
||||
),
|
||||
array(
|
||||
array('/^A/', 'one'),
|
||||
'foobar',
|
||||
array(
|
||||
'A',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'a.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'one',
|
||||
'one'.\DIRECTORY_SEPARATOR.'a',
|
||||
'one'.\DIRECTORY_SEPARATOR.'b',
|
||||
'one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'c.neon',
|
||||
'one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'d.neon',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -718,7 +1230,20 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
chmod($testDir, 0333);
|
||||
|
||||
if (false === ($couldRead = is_readable($testDir))) {
|
||||
$this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
|
||||
$this->assertIterator($this->toAbsolute(array(
|
||||
'foo bar',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
)
|
||||
), $finder->getIterator());
|
||||
}
|
||||
|
||||
// restore original permissions
|
||||
@@ -730,8 +1255,26 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The "Symfony\Component\Finder\Finder::sortByName()" method will have a new "bool $useNaturalSort = false" argument in version 5.0, not defining it is deprecated since Symfony 4.2.
|
||||
*/
|
||||
public function testInheritedClassCallSortByNameWithNoArguments()
|
||||
{
|
||||
$finderChild = new ClassThatInheritFinder();
|
||||
$finderChild->sortByName();
|
||||
}
|
||||
|
||||
protected function buildFinder()
|
||||
{
|
||||
return Finder::create();
|
||||
}
|
||||
}
|
||||
|
||||
class ClassThatInheritFinder extends Finder
|
||||
{
|
||||
public function sortByName()
|
||||
{
|
||||
parent::sortByName();
|
||||
}
|
||||
}
|
||||
|
@@ -45,6 +45,15 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'.foo/.bar',
|
||||
'foo bar',
|
||||
'.foo/bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
$since2MonthsAgo = array(
|
||||
@@ -58,6 +67,15 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'.foo/.bar',
|
||||
'foo bar',
|
||||
'.foo/bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
$untilLastMonth = array(
|
||||
|
@@ -41,6 +41,13 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'.foo',
|
||||
'.bar',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
$lessThanOrEqualTo1 = array(
|
||||
@@ -56,6 +63,15 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'.bar',
|
||||
'foo bar',
|
||||
'.foo/bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
$graterThanOrEqualTo1 = array(
|
||||
@@ -63,6 +79,8 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'foo/bar.tmp',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
);
|
||||
|
||||
$equalTo1 = array(
|
||||
@@ -70,6 +88,8 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'foo/bar.tmp',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
);
|
||||
|
||||
return array(
|
||||
|
@@ -41,6 +41,15 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
$fo = array(
|
||||
@@ -56,6 +65,15 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
$toto = array(
|
||||
@@ -69,6 +87,15 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
return array(
|
||||
|
@@ -37,11 +37,20 @@ class FileTypeFilterIteratorTest extends RealIteratorTestCase
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'foo bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
|
||||
$onlyDirectories = array(
|
||||
'.git',
|
||||
'foo',
|
||||
'qux',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'.foo',
|
||||
|
@@ -29,12 +29,12 @@ class MockSplFileInfo extends \SplFileInfo
|
||||
parent::__construct($param);
|
||||
} elseif (\is_array($param)) {
|
||||
$defaults = array(
|
||||
'name' => 'file.txt',
|
||||
'contents' => null,
|
||||
'mode' => null,
|
||||
'type' => null,
|
||||
'relativePath' => null,
|
||||
'relativePathname' => null,
|
||||
'name' => 'file.txt',
|
||||
'contents' => null,
|
||||
'mode' => null,
|
||||
'type' => null,
|
||||
'relativePath' => null,
|
||||
'relativePathname' => null,
|
||||
);
|
||||
$defaults = array_merge($defaults, $param);
|
||||
parent::__construct($defaults['name']);
|
||||
|
@@ -33,6 +33,15 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
||||
'toto/',
|
||||
'toto/.git/',
|
||||
'foo bar',
|
||||
'qux_0_1.php',
|
||||
'qux_2_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux/',
|
||||
'qux/baz_1_2.py',
|
||||
'qux/baz_100_1.py',
|
||||
);
|
||||
|
||||
self::$files = self::toAbsolute(self::$files);
|
||||
|
@@ -34,6 +34,7 @@ class SizeRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'.foo',
|
||||
'.git',
|
||||
'foo',
|
||||
'qux',
|
||||
'test.php',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
|
@@ -82,6 +82,15 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'foo',
|
||||
'foo bar',
|
||||
'foo/bar.tmp',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
@@ -92,6 +101,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'.foo',
|
||||
'.git',
|
||||
'foo',
|
||||
'qux',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'.bar',
|
||||
@@ -99,25 +109,18 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'.foo/bar',
|
||||
'foo bar',
|
||||
'foo/bar.tmp',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
);
|
||||
|
||||
$customComparison = array(
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'.git',
|
||||
'foo',
|
||||
'foo bar',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
);
|
||||
|
||||
$sortByAccessedTime = array(
|
||||
// For these two files the access time was set to 2005-10-15
|
||||
array('foo/bar.tmp', 'test.php'),
|
||||
@@ -132,6 +135,15 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
),
|
||||
// This file was accessed after sleeping for 1 sec
|
||||
array('.bar'),
|
||||
@@ -149,6 +161,15 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
),
|
||||
array('test.php'),
|
||||
array('test.py'),
|
||||
@@ -166,17 +187,75 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
),
|
||||
array('test.php'),
|
||||
array('test.py'),
|
||||
);
|
||||
|
||||
$sortByNameNatural = array(
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'.git',
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'foo bar',
|
||||
'qux',
|
||||
'qux/baz_1_2.py',
|
||||
'qux/baz_100_1.py',
|
||||
'qux_0_1.php',
|
||||
'qux_2_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
);
|
||||
|
||||
$customComparison = array(
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'.git',
|
||||
'foo',
|
||||
'foo bar',
|
||||
'foo/bar.tmp',
|
||||
'qux',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
'qux_0_1.php',
|
||||
'qux_1000_1.php',
|
||||
'qux_1002_0.php',
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
);
|
||||
|
||||
return array(
|
||||
array(SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)),
|
||||
array(SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)),
|
||||
array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)),
|
||||
array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)),
|
||||
array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)),
|
||||
array(SortableIterator::SORT_BY_NAME_NATURAL, $this->toAbsolute($sortByNameNatural)),
|
||||
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)),
|
||||
);
|
||||
}
|
||||
|
2
vendor/symfony/finder/composer.json
vendored
2
vendor/symfony/finder/composer.json
vendored
@@ -27,7 +27,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.1-dev"
|
||||
"dev-master": "4.2-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
vendor/symfony/finder/phpunit.xml.dist
vendored
2
vendor/symfony/finder/phpunit.xml.dist
vendored
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
|
Reference in New Issue
Block a user