update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
0
pfosten/vendor/symfony/finder/.gitignore
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/.gitignore
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/finder/CHANGELOG.md
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/finder/CHANGELOG.md
vendored
Executable file → Normal file
|
|
@ -1,6 +1,12 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
||||
* deprecated `Symfony\Component\Finder\Iterator\FilterIterator`
|
||||
* added Finder::hasResults() method to check if any results were found
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Comparator/Comparator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Comparator/Comparator.php
vendored
Executable file → Normal file
|
|
@ -64,7 +64,7 @@ class Comparator
|
|||
$operator = '==';
|
||||
}
|
||||
|
||||
if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
|
||||
if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
|
||||
}
|
||||
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Comparator/DateComparator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Comparator/DateComparator.php
vendored
Executable file → Normal file
|
|
@ -19,8 +19,6 @@ namespace Symfony\Component\Finder\Comparator;
|
|||
class DateComparator extends Comparator
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $test A comparison string
|
||||
*
|
||||
* @throws \InvalidArgumentException If the test is not understood
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Comparator/NumberComparator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Comparator/NumberComparator.php
vendored
Executable file → Normal file
|
|
@ -35,8 +35,6 @@ namespace Symfony\Component\Finder\Comparator;
|
|||
class NumberComparator extends Comparator
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|int $test A comparison string or an integer
|
||||
*
|
||||
* @throws \InvalidArgumentException If the test is not understood
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Exception/AccessDeniedException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Exception/AccessDeniedException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Exception/ExceptionInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Exception/ExceptionInterface.php
vendored
Executable file → Normal file
55
pfosten/vendor/symfony/finder/Finder.php
vendored
Executable file → Normal file
55
pfosten/vendor/symfony/finder/Finder.php
vendored
Executable file → Normal file
|
|
@ -61,9 +61,6 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
|
||||
private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
|
||||
|
|
@ -300,6 +297,10 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
/**
|
||||
* Excludes directories.
|
||||
*
|
||||
* Directories passed as argument must be relative to the ones defined with the `in()` method. For example:
|
||||
*
|
||||
* $finder->in(__DIR__)->exclude('ruby');
|
||||
*
|
||||
* @param string|array $dirs A directory path or an array of directories
|
||||
*
|
||||
* @return $this
|
||||
|
|
@ -316,6 +317,8 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
/**
|
||||
* Excludes "hidden" directories and files (starting with a dot).
|
||||
*
|
||||
* This option is enabled by default.
|
||||
*
|
||||
* @param bool $ignoreDotFiles Whether to exclude "hidden" files or not
|
||||
*
|
||||
* @return $this
|
||||
|
|
@ -336,6 +339,8 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
/**
|
||||
* Forces the finder to ignore version control directories.
|
||||
*
|
||||
* This option is enabled by default.
|
||||
*
|
||||
* @param bool $ignoreVCS Whether to exclude VCS files or not
|
||||
*
|
||||
* @return $this
|
||||
|
|
@ -376,8 +381,6 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @param \Closure $closure An anonymous function
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
|
|
@ -483,8 +486,6 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
* The anonymous function receives a \SplFileInfo and must return false
|
||||
* to remove files.
|
||||
*
|
||||
* @param \Closure $closure An anonymous function
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see CustomFilterIterator
|
||||
|
|
@ -539,9 +540,9 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
|
||||
foreach ((array) $dirs as $dir) {
|
||||
if (is_dir($dir)) {
|
||||
$resolvedDirs[] = $dir;
|
||||
} elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
|
||||
$resolvedDirs = array_merge($resolvedDirs, $glob);
|
||||
$resolvedDirs[] = $this->normalizeDir($dir);
|
||||
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
|
||||
$resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
|
||||
}
|
||||
|
|
@ -563,11 +564,11 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
if (0 === count($this->dirs) && 0 === count($this->iterators)) {
|
||||
if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
|
||||
throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
|
||||
}
|
||||
|
||||
if (1 === count($this->dirs) && 0 === count($this->iterators)) {
|
||||
if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
|
||||
return $this->searchInDirectory($this->dirs[0]);
|
||||
}
|
||||
|
||||
|
|
@ -592,7 +593,7 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws \InvalidArgumentException When the given argument is not iterable.
|
||||
* @throws \InvalidArgumentException when the given argument is not iterable
|
||||
*/
|
||||
public function append($iterator)
|
||||
{
|
||||
|
|
@ -600,7 +601,7 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
$this->iterators[] = $iterator->getIterator();
|
||||
} elseif ($iterator instanceof \Iterator) {
|
||||
$this->iterators[] = $iterator;
|
||||
} elseif ($iterator instanceof \Traversable || is_array($iterator)) {
|
||||
} elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
|
||||
$it = new \ArrayIterator();
|
||||
foreach ($iterator as $file) {
|
||||
$it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
|
||||
|
|
@ -613,6 +614,20 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the any results were found.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasResults()
|
||||
{
|
||||
foreach ($this->getIterator() as $_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts all the results collected by the iterators.
|
||||
*
|
||||
|
|
@ -713,4 +728,16 @@ class Finder implements \IteratorAggregate, \Countable
|
|||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes given directory names by removing trailing slashes.
|
||||
*
|
||||
* @param string $dir
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function normalizeDir($dir)
|
||||
{
|
||||
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Glob.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Glob.php
vendored
Executable file → Normal file
|
|
@ -51,7 +51,7 @@ class Glob
|
|||
$escaping = false;
|
||||
$inCurlies = 0;
|
||||
$regex = '';
|
||||
$sizeGlob = strlen($glob);
|
||||
$sizeGlob = \strlen($glob);
|
||||
for ($i = 0; $i < $sizeGlob; ++$i) {
|
||||
$car = $glob[$i];
|
||||
if ($firstByte && $strictLeadingDot && '.' !== $car) {
|
||||
|
|
|
|||
6
pfosten/vendor/symfony/finder/Iterator/CustomFilterIterator.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/finder/Iterator/CustomFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -24,8 +24,6 @@ class CustomFilterIterator extends FilterIterator
|
|||
private $filters = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param callable[] $filters An array of PHP callbacks
|
||||
*
|
||||
|
|
@ -34,7 +32,7 @@ class CustomFilterIterator extends FilterIterator
|
|||
public function __construct(\Iterator $iterator, array $filters)
|
||||
{
|
||||
foreach ($filters as $filter) {
|
||||
if (!is_callable($filter)) {
|
||||
if (!\is_callable($filter)) {
|
||||
throw new \InvalidArgumentException('Invalid PHP callback.');
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +51,7 @@ class CustomFilterIterator extends FilterIterator
|
|||
$fileinfo = $this->current();
|
||||
|
||||
foreach ($this->filters as $filter) {
|
||||
if (false === call_user_func($filter, $fileinfo)) {
|
||||
if (false === \call_user_func($filter, $fileinfo)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -23,8 +23,6 @@ class DateRangeFilterIterator extends FilterIterator
|
|||
private $comparators = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param DateComparator[] $comparators An array of DateComparator instances
|
||||
*/
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -21,8 +21,6 @@ class DepthRangeFilterIterator extends FilterIterator
|
|||
private $minDepth = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \RecursiveIteratorIterator $iterator The Iterator to filter
|
||||
* @param int $minDepth The min depth
|
||||
* @param int $maxDepth The max depth
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -24,8 +24,6 @@ class ExcludeDirectoryFilterIterator extends FilterIterator implements \Recursiv
|
|||
private $excludedPattern;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param array $directories An array of directories to exclude
|
||||
*/
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -24,8 +24,6 @@ class FileTypeFilterIterator extends FilterIterator
|
|||
private $mode;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param int $mode The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES)
|
||||
*/
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Iterator/FilecontentFilterIterator.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Iterator/FilecontentFilterIterator.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Iterator/FilenameFilterIterator.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Iterator/FilenameFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/FilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/FilterIterator.php
vendored
Executable file → Normal file
|
|
@ -18,6 +18,8 @@ namespace Symfony\Component\Finder\Iterator;
|
|||
* @see https://bugs.php.net/68557
|
||||
*
|
||||
* @author Alex Bogomazov
|
||||
*
|
||||
* @deprecated since 3.4, to be removed in 4.0.
|
||||
*/
|
||||
abstract class FilterIterator extends \FilterIterator
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -22,8 +22,6 @@ abstract class MultiplePcreFilterIterator extends FilterIterator
|
|||
protected $noMatchRegexps = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param array $matchPatterns An array of patterns that need to match
|
||||
* @param array $noMatchPatterns An array of patterns that need to not match
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Iterator/PathFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/PathFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -28,7 +28,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
|
|||
{
|
||||
$filename = $this->current()->getRelativePathname();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$filename = str_replace('\\', '/', $filename);
|
||||
}
|
||||
|
||||
|
|
|
|||
6
pfosten/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php
vendored
Executable file → Normal file
|
|
@ -37,8 +37,6 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
|||
private $directorySeparator = '/';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $path
|
||||
* @param int $flags
|
||||
* @param bool $ignoreUnreadableDirs
|
||||
|
|
@ -54,8 +52,8 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
|||
parent::__construct($path, $flags);
|
||||
$this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
|
||||
$this->rootPath = $path;
|
||||
if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
|
||||
$this->directorySeparator = DIRECTORY_SEPARATOR;
|
||||
if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
|
||||
$this->directorySeparator = \DIRECTORY_SEPARATOR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php
vendored
Executable file → Normal file
|
|
@ -23,8 +23,6 @@ class SizeRangeFilterIterator extends FilterIterator
|
|||
private $comparators = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param NumberComparator[] $comparators An array of NumberComparator instances
|
||||
*/
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/finder/Iterator/SortableIterator.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/finder/Iterator/SortableIterator.php
vendored
Executable file → Normal file
|
|
@ -28,8 +28,6 @@ class SortableIterator implements \IteratorAggregate
|
|||
private $sort;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Traversable $iterator The Iterator to filter
|
||||
* @param int|callable $sort The sort type (SORT_BY_NAME, SORT_BY_TYPE, or a PHP callback)
|
||||
*
|
||||
|
|
@ -65,7 +63,7 @@ class SortableIterator implements \IteratorAggregate
|
|||
$this->sort = function ($a, $b) {
|
||||
return $a->getMTime() - $b->getMTime();
|
||||
};
|
||||
} elseif (is_callable($sort)) {
|
||||
} elseif (\is_callable($sort)) {
|
||||
$this->sort = $sort;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/LICENSE
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/LICENSE
vendored
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2017 Fabien Potencier
|
||||
Copyright (c) 2004-2018 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/README.md
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/README.md
vendored
Executable file → Normal file
9
pfosten/vendor/symfony/finder/SplFileInfo.php
vendored
Executable file → Normal file
9
pfosten/vendor/symfony/finder/SplFileInfo.php
vendored
Executable file → Normal file
|
|
@ -22,8 +22,6 @@ class SplFileInfo extends \SplFileInfo
|
|||
private $relativePathname;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $file The file name
|
||||
* @param string $relativePath The relative path
|
||||
* @param string $relativePathname The relative path name
|
||||
|
|
@ -68,12 +66,11 @@ class SplFileInfo extends \SplFileInfo
|
|||
*/
|
||||
public function getContents()
|
||||
{
|
||||
$level = error_reporting(0);
|
||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||
$content = file_get_contents($this->getPathname());
|
||||
error_reporting($level);
|
||||
restore_error_handler();
|
||||
if (false === $content) {
|
||||
$error = error_get_last();
|
||||
throw new \RuntimeException($error['message']);
|
||||
throw new \RuntimeException($error);
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php
vendored
Executable file → Normal file
133
pfosten/vendor/symfony/finder/Tests/FinderTest.php
vendored
Executable file → Normal file
133
pfosten/vendor/symfony/finder/Tests/FinderTest.php
vendored
Executable file → Normal file
|
|
@ -46,6 +46,45 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testRemoveTrailingSlash()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
|
||||
$expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar'));
|
||||
$in = self::$tmpDir.'//';
|
||||
|
||||
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
|
||||
}
|
||||
|
||||
public function testSymlinksNotResolved()
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('symlinks are not supported on Windows');
|
||||
}
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
|
||||
symlink($this->toAbsolute('foo'), $this->toAbsolute('baz'));
|
||||
$expected = $this->toAbsolute(array('baz/bar.tmp'));
|
||||
$in = self::$tmpDir.'/baz/';
|
||||
try {
|
||||
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
|
||||
unlink($this->toAbsolute('baz'));
|
||||
} catch (\Exception $e) {
|
||||
unlink($this->toAbsolute('baz'));
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function testBackPathNotNormalized()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
|
||||
$expected = $this->toAbsolute(array('foo/../foo/bar.tmp'));
|
||||
$in = self::$tmpDir.'/foo/../foo/';
|
||||
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
|
||||
}
|
||||
|
||||
public function testDepth()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
|
|
@ -226,7 +265,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
|
||||
public function testFollowLinks()
|
||||
{
|
||||
if ('\\' == DIRECTORY_SEPARATOR) {
|
||||
if ('\\' == \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('symlinks are not supported on Windows');
|
||||
}
|
||||
|
||||
|
|
@ -241,9 +280,9 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
$iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator();
|
||||
|
||||
$expected = array(
|
||||
self::$tmpDir.DIRECTORY_SEPARATOR.'test.php',
|
||||
__DIR__.DIRECTORY_SEPARATOR.'FinderTest.php',
|
||||
__DIR__.DIRECTORY_SEPARATOR.'GlobTest.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php',
|
||||
__DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php',
|
||||
__DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php',
|
||||
);
|
||||
|
||||
$this->assertIterator($expected, $iterator);
|
||||
|
|
@ -261,7 +300,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testInWithGlob()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator();
|
||||
$finder->in(array(__DIR__.'/Fixtures/*/B/C/', __DIR__.'/Fixtures/*/*/B/C/'))->getIterator();
|
||||
|
||||
$this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
|
||||
}
|
||||
|
|
@ -345,7 +384,7 @@ 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');
|
||||
|
||||
sort($paths);
|
||||
sort($ref);
|
||||
|
|
@ -356,7 +395,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testAppendWithAFinder()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
||||
$finder->files()->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo');
|
||||
|
||||
$finder1 = $this->buildFinder();
|
||||
$finder1->directories()->in(self::$tmpDir);
|
||||
|
|
@ -369,7 +408,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testAppendWithAnArray()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
||||
$finder->files()->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo');
|
||||
|
||||
$finder->append($this->toAbsolute(array('foo', 'toto')));
|
||||
|
||||
|
|
@ -384,7 +423,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testAppendDoesNotRequireIn()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
||||
$finder->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo');
|
||||
|
||||
$finder1 = Finder::create()->append($finder);
|
||||
|
||||
|
|
@ -405,7 +444,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
|
||||
public function testCountFiles()
|
||||
{
|
||||
$files = Finder::create()->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||
$files = Finder::create()->files()->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures');
|
||||
$i = 0;
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
|
@ -421,7 +460,21 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testCountWithoutIn()
|
||||
{
|
||||
$finder = Finder::create()->files();
|
||||
count($finder);
|
||||
\count($finder);
|
||||
}
|
||||
|
||||
public function testHasResults()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__);
|
||||
$this->assertTrue($finder->hasResults());
|
||||
}
|
||||
|
||||
public function testNoResults()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__)->name('DoesNotExist');
|
||||
$this->assertFalse($finder->hasResults());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -430,7 +483,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testContains($matchPatterns, $noMatchPatterns, $expected)
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
|
||||
$finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures')
|
||||
->name('*.txt')->sortByName()
|
||||
->contains($matchPatterns)
|
||||
->notContains($noMatchPatterns);
|
||||
|
|
@ -493,15 +546,15 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
{
|
||||
$locations = array(
|
||||
__DIR__.'/Fixtures/one',
|
||||
self::$tmpDir.DIRECTORY_SEPARATOR.'toto',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'toto',
|
||||
);
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in($locations)->depth('< 10')->name('*.neon');
|
||||
|
||||
$expected = array(
|
||||
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
|
||||
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
|
||||
__DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'c.neon',
|
||||
__DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'d.neon',
|
||||
);
|
||||
|
||||
$this->assertIterator($expected, $finder);
|
||||
|
|
@ -522,10 +575,10 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
|
||||
$finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
|
||||
->path('/^dir/');
|
||||
|
||||
$expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat');
|
||||
$expected = array('r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'bar.dat');
|
||||
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
|
||||
}
|
||||
|
||||
|
|
@ -559,7 +612,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
public function testPath($matchPatterns, $noMatchPatterns, array $expected)
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
|
||||
$finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures')
|
||||
->path($matchPatterns)
|
||||
->notPath($noMatchPatterns);
|
||||
|
||||
|
|
@ -571,41 +624,41 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
return array(
|
||||
array('', '', array()),
|
||||
array('/^A\/B\/C/', '/C$/',
|
||||
array('A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat'),
|
||||
array('A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat'),
|
||||
),
|
||||
array('/^A\/B/', 'foobar',
|
||||
array(
|
||||
'A'.DIRECTORY_SEPARATOR.'B',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
),
|
||||
),
|
||||
array('A/B/C', 'foobar',
|
||||
array(
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
),
|
||||
),
|
||||
array('A/B', 'foobar',
|
||||
array(
|
||||
//dirs
|
||||
'A'.DIRECTORY_SEPARATOR.'B',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
//files
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat.copy',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat.copy',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
),
|
||||
),
|
||||
array('/^with space\//', 'foobar',
|
||||
array(
|
||||
'with space'.DIRECTORY_SEPARATOR.'foo.txt',
|
||||
'with space'.\DIRECTORY_SEPARATOR.'foo.txt',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
@ -613,7 +666,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
|
||||
public function testAccessDeniedException()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
|
|
@ -621,7 +674,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
$finder->files()->in(self::$tmpDir);
|
||||
|
||||
// make 'foo' directory non-readable
|
||||
$testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
|
||||
$testDir = self::$tmpDir.\DIRECTORY_SEPARATOR.'foo';
|
||||
chmod($testDir, 0333);
|
||||
|
||||
if (false === $couldRead = is_readable($testDir)) {
|
||||
|
|
@ -653,7 +706,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
|
||||
public function testIgnoredAccessDeniedException()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
|
|
@ -661,7 +714,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||
$finder->files()->ignoreUnreadableDirs()->in(self::$tmpDir);
|
||||
|
||||
// make 'foo' directory non-readable
|
||||
$testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
|
||||
$testDir = self::$tmpDir.\DIRECTORY_SEPARATOR.'foo';
|
||||
chmod($testDir, 0333);
|
||||
|
||||
if (false === ($couldRead = is_readable($testDir))) {
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Tests/Fixtures/.dot/a
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/.dot/a
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/A/a.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/A/a.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/dolor.txt
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/dolor.txt
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/ipsum.txt
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/ipsum.txt
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/lorem.txt
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/lorem.txt
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/.dot
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/.dot
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/a
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/a
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/b/c.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/b/c.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/b/d.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/one/b/d.neon
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/with space/foo.txt
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Fixtures/with space/foo.txt
vendored
Executable file → Normal file
24
pfosten/vendor/symfony/finder/Tests/GlobTest.php
vendored
Executable file → Normal file
24
pfosten/vendor/symfony/finder/Tests/GlobTest.php
vendored
Executable file → Normal file
|
|
@ -32,9 +32,9 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/**/*.neon');
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + strlen(__DIR__));
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
|
@ -49,9 +49,9 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/**/*.neon', false);
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + strlen(__DIR__));
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
|
@ -66,9 +66,9 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/Fixtures/one/**');
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + strlen(__DIR__));
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
|
@ -83,9 +83,9 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/Fixtures/one/**', false);
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + strlen(__DIR__));
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php
vendored
Executable file → Normal file
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
|
||||
use Symfony\Component\Finder\Comparator\DateComparator;
|
||||
use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
|
||||
|
||||
class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php
vendored
Executable file → Normal file
|
|
@ -13,6 +13,8 @@ namespace Symfony\Component\Finder\Tests\Iterator;
|
|||
|
||||
/**
|
||||
* @author Alex Bogomazov
|
||||
*
|
||||
* @group legacy
|
||||
*/
|
||||
class FilterIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Tests/Iterator/Iterator.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/Iterator.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php
vendored
Executable file → Normal file
|
|
@ -19,9 +19,9 @@ abstract class IteratorTestCase extends TestCase
|
|||
{
|
||||
// set iterator_to_array $use_key to false to avoid values merge
|
||||
// this made FinderTest::testAppendWithAnArray() fail with GnuFinderAdapter
|
||||
$values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false));
|
||||
$values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', \DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false));
|
||||
|
||||
$expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected);
|
||||
$expected = array_map(function ($path) { return str_replace('/', \DIRECTORY_SEPARATOR, $path); }, $expected);
|
||||
|
||||
sort($values);
|
||||
sort($expected);
|
||||
|
|
@ -52,7 +52,7 @@ abstract class IteratorTestCase extends TestCase
|
|||
|
||||
foreach ($expected as $subarray) {
|
||||
$temp = array();
|
||||
while (count($values) && count($temp) < count($subarray)) {
|
||||
while (\count($values) && \count($temp) < \count($subarray)) {
|
||||
$temp[] = array_shift($values);
|
||||
}
|
||||
sort($temp);
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php
vendored
Executable file → Normal file
|
|
@ -13,9 +13,9 @@ namespace Symfony\Component\Finder\Tests\Iterator;
|
|||
|
||||
class MockSplFileInfo extends \SplFileInfo
|
||||
{
|
||||
const TYPE_DIRECTORY = 1;
|
||||
const TYPE_FILE = 2;
|
||||
const TYPE_UNKNOWN = 3;
|
||||
const TYPE_DIRECTORY = 1;
|
||||
const TYPE_FILE = 2;
|
||||
const TYPE_UNKNOWN = 3;
|
||||
|
||||
private $contents = null;
|
||||
private $mode = null;
|
||||
|
|
@ -25,9 +25,9 @@ class MockSplFileInfo extends \SplFileInfo
|
|||
|
||||
public function __construct($param)
|
||||
{
|
||||
if (is_string($param)) {
|
||||
if (\is_string($param)) {
|
||||
parent::__construct($param);
|
||||
} elseif (is_array($param)) {
|
||||
} elseif (\is_array($param)) {
|
||||
$defaults = array(
|
||||
'name' => 'file.txt',
|
||||
'contents' => null,
|
||||
|
|
@ -92,7 +92,7 @@ class MockSplFileInfo extends \SplFileInfo
|
|||
|
||||
public function setType($type)
|
||||
{
|
||||
if (is_string($type)) {
|
||||
if (\is_string($type)) {
|
||||
switch ($type) {
|
||||
case 'directory':
|
||||
case 'd':
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php
vendored
Executable file → Normal file
|
|
@ -31,37 +31,37 @@ class PathFilterIteratorTest extends IteratorTestCase
|
|||
//PATH: A/B/C/abc.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'abc.dat',
|
||||
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
));
|
||||
|
||||
//PATH: A/B/ab.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'ab.dat',
|
||||
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
));
|
||||
|
||||
//PATH: A/a.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'a.dat',
|
||||
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'a.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'a.dat',
|
||||
));
|
||||
|
||||
//PATH: copy/A/B/C/abc.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'abc.dat.copy',
|
||||
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
));
|
||||
|
||||
//PATH: copy/A/B/ab.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'ab.dat.copy',
|
||||
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
));
|
||||
|
||||
//PATH: copy/A/a.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'a.dat.copy',
|
||||
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'a.dat',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'a.dat',
|
||||
));
|
||||
|
||||
return array(
|
||||
|
|
|
|||
35
pfosten/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php
vendored
Executable file → Normal file
35
pfosten/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php
vendored
Executable file → Normal file
|
|
@ -18,7 +18,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
|
||||
self::$files = array(
|
||||
'.git/',
|
||||
|
|
@ -44,7 +44,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
}
|
||||
|
||||
foreach (self::$files as $file) {
|
||||
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
|
||||
if (\DIRECTORY_SEPARATOR === $file[\strlen($file) - 1]) {
|
||||
mkdir($file);
|
||||
} else {
|
||||
touch($file);
|
||||
|
|
@ -60,11 +60,20 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
foreach (array_reverse(self::$files) as $file) {
|
||||
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
|
||||
@rmdir($file);
|
||||
$paths = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if ($path->isDir()) {
|
||||
if ($path->isLink()) {
|
||||
@unlink($path);
|
||||
} else {
|
||||
@rmdir($path);
|
||||
}
|
||||
} else {
|
||||
@unlink($file);
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -75,24 +84,24 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
* Without the call to setUpBeforeClass() property can be null.
|
||||
*/
|
||||
if (!self::$tmpDir) {
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
}
|
||||
|
||||
if (is_array($files)) {
|
||||
if (\is_array($files)) {
|
||||
$f = array();
|
||||
foreach ($files as $file) {
|
||||
if (is_array($file)) {
|
||||
if (\is_array($file)) {
|
||||
$f[] = self::toAbsolute($file);
|
||||
} else {
|
||||
$f[] = self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $file);
|
||||
$f[] = self::$tmpDir.\DIRECTORY_SEPARATOR.str_replace('/', \DIRECTORY_SEPARATOR, $file);
|
||||
}
|
||||
}
|
||||
|
||||
return $f;
|
||||
}
|
||||
|
||||
if (is_string($files)) {
|
||||
return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files);
|
||||
if (\is_string($files)) {
|
||||
return self::$tmpDir.\DIRECTORY_SEPARATOR.str_replace('/', \DIRECTORY_SEPARATOR, $files);
|
||||
}
|
||||
|
||||
return self::$tmpDir;
|
||||
|
|
@ -102,7 +111,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
{
|
||||
$f = array();
|
||||
foreach ($files as $file) {
|
||||
$f[] = realpath(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.$file);
|
||||
$f[] = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.$file);
|
||||
}
|
||||
|
||||
return $f;
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php
vendored
Executable file → Normal file
|
|
@ -43,8 +43,8 @@ class RecursiveDirectoryIteratorTest extends IteratorTestCase
|
|||
}
|
||||
|
||||
$contains = array(
|
||||
'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'1000GB.zip',
|
||||
'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'100GB.zip',
|
||||
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'1000GB.zip',
|
||||
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'100GB.zip',
|
||||
);
|
||||
$actual = array();
|
||||
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
vendored
Executable file → Normal file
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
|
||||
use Symfony\Component\Finder\Comparator\NumberComparator;
|
||||
use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
|
||||
|
||||
class SizeRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
|
|
|
|||
12
pfosten/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php
vendored
Executable file → Normal file
12
pfosten/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php
vendored
Executable file → Normal file
|
|
@ -30,10 +30,10 @@ class SortableIteratorTest extends RealIteratorTestCase
|
|||
*/
|
||||
public function testAccept($mode, $expected)
|
||||
{
|
||||
if (!is_callable($mode)) {
|
||||
if (!\is_callable($mode)) {
|
||||
switch ($mode) {
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME:
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
touch(self::toAbsolute('.git'));
|
||||
} else {
|
||||
file_get_contents(self::toAbsolute('.git'));
|
||||
|
|
@ -58,11 +58,11 @@ class SortableIteratorTest extends RealIteratorTestCase
|
|||
|
||||
$iterator = new SortableIterator($inner, $mode);
|
||||
|
||||
if ($mode === SortableIterator::SORT_BY_ACCESSED_TIME
|
||||
|| $mode === SortableIterator::SORT_BY_CHANGED_TIME
|
||||
|| $mode === SortableIterator::SORT_BY_MODIFIED_TIME
|
||||
if (SortableIterator::SORT_BY_ACCESSED_TIME === $mode
|
||||
|| SortableIterator::SORT_BY_CHANGED_TIME === $mode
|
||||
|| SortableIterator::SORT_BY_MODIFIED_TIME === $mode
|
||||
) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) {
|
||||
$this->markTestSkipped('Sorting by atime or ctime is not supported on Windows');
|
||||
}
|
||||
$this->assertOrderedIteratorForGroups($expected, $iterator);
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/finder/composer.json
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/finder/composer.json
vendored
Executable file → Normal file
|
|
@ -16,7 +16,7 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\Finder\\": "" },
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.3-dev"
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/finder/phpunit.xml.dist
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/finder/phpunit.xml.dist
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue