updated packages
This commit is contained in:
@@ -58,8 +58,8 @@ class ComparatorTest extends TestCase
|
||||
|
||||
public function getTestData()
|
||||
{
|
||||
return array(
|
||||
array('<', '1000', array('500', '999'), array('1000', '1500')),
|
||||
);
|
||||
return [
|
||||
['<', '1000', ['500', '999'], ['1000', '1500']],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,14 +51,14 @@ class DateComparatorTest extends TestCase
|
||||
|
||||
public function getTestData()
|
||||
{
|
||||
return array(
|
||||
array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
|
||||
array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
|
||||
array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
|
||||
array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
|
||||
array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
|
||||
array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
|
||||
array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))),
|
||||
);
|
||||
return [
|
||||
['< 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
|
||||
['until 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
|
||||
['before 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
|
||||
['> 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
|
||||
['after 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
|
||||
['since 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
|
||||
['!= 2005-10-10', [strtotime('2005-10-11')], [strtotime('2005-10-10')]],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,39 +53,39 @@ class NumberComparatorTest extends TestCase
|
||||
|
||||
public function getTestData()
|
||||
{
|
||||
return array(
|
||||
array('< 1000', array('500', '999'), array('1000', '1500')),
|
||||
return [
|
||||
['< 1000', ['500', '999'], ['1000', '1500']],
|
||||
|
||||
array('< 1K', array('500', '999'), array('1000', '1500')),
|
||||
array('<1k', array('500', '999'), array('1000', '1500')),
|
||||
array(' < 1 K ', array('500', '999'), array('1000', '1500')),
|
||||
array('<= 1K', array('1000'), array('1001')),
|
||||
array('> 1K', array('1001'), array('1000')),
|
||||
array('>= 1K', array('1000'), array('999')),
|
||||
['< 1K', ['500', '999'], ['1000', '1500']],
|
||||
['<1k', ['500', '999'], ['1000', '1500']],
|
||||
[' < 1 K ', ['500', '999'], ['1000', '1500']],
|
||||
['<= 1K', ['1000'], ['1001']],
|
||||
['> 1K', ['1001'], ['1000']],
|
||||
['>= 1K', ['1000'], ['999']],
|
||||
|
||||
array('< 1KI', array('500', '1023'), array('1024', '1500')),
|
||||
array('<= 1KI', array('1024'), array('1025')),
|
||||
array('> 1KI', array('1025'), array('1024')),
|
||||
array('>= 1KI', array('1024'), array('1023')),
|
||||
['< 1KI', ['500', '1023'], ['1024', '1500']],
|
||||
['<= 1KI', ['1024'], ['1025']],
|
||||
['> 1KI', ['1025'], ['1024']],
|
||||
['>= 1KI', ['1024'], ['1023']],
|
||||
|
||||
array('1KI', array('1024'), array('1023', '1025')),
|
||||
array('==1KI', array('1024'), array('1023', '1025')),
|
||||
['1KI', ['1024'], ['1023', '1025']],
|
||||
['==1KI', ['1024'], ['1023', '1025']],
|
||||
|
||||
array('==1m', array('1000000'), array('999999', '1000001')),
|
||||
array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)),
|
||||
['==1m', ['1000000'], ['999999', '1000001']],
|
||||
['==1mi', [1024 * 1024], [1024 * 1024 - 1, 1024 * 1024 + 1]],
|
||||
|
||||
array('==1g', array('1000000000'), array('999999999', '1000000001')),
|
||||
array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)),
|
||||
['==1g', ['1000000000'], ['999999999', '1000000001']],
|
||||
['==1gi', [1024 * 1024 * 1024], [1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1]],
|
||||
|
||||
array('!= 1000', array('500', '999'), array('1000')),
|
||||
);
|
||||
['!= 1000', ['500', '999'], ['1000']],
|
||||
];
|
||||
}
|
||||
|
||||
public function getConstructorTestData()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
[
|
||||
'1', '0',
|
||||
'3.5', '33.55', '123.456', '123456.78',
|
||||
'.1', '.123',
|
||||
@@ -94,15 +94,15 @@ class NumberComparatorTest extends TestCase
|
||||
'==1', '!=1', '<1', '>1', '<=1', '>=1',
|
||||
'==1k', '==1ki', '==1m', '==1mi', '==1g', '==1gi',
|
||||
'1k', '1ki', '1m', '1mi', '1g', '1gi',
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
false, null, '',
|
||||
' ', 'foobar',
|
||||
'=1', '===1',
|
||||
'0 . 1', '123 .45', '234. 567',
|
||||
'..', '.0.', '0.1.2',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
428
vendor/symfony/finder/Tests/FinderTest.php
vendored
428
vendor/symfony/finder/Tests/FinderTest.php
vendored
File diff suppressed because it is too large
Load Diff
8
vendor/symfony/finder/Tests/GlobTest.php
vendored
8
vendor/symfony/finder/Tests/GlobTest.php
vendored
@@ -39,7 +39,7 @@ class GlobTest extends TestCase
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
$this->assertSame(['one/b/c.neon', 'one/b/d.neon'], $match);
|
||||
}
|
||||
|
||||
public function testGlobToRegexDoubleStarNonStrictDots()
|
||||
@@ -56,7 +56,7 @@ class GlobTest extends TestCase
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
$this->assertSame(['.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'], $match);
|
||||
}
|
||||
|
||||
public function testGlobToRegexDoubleStarWithoutLeadingSlash()
|
||||
@@ -73,7 +73,7 @@ class GlobTest extends TestCase
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
$this->assertSame(['one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
|
||||
}
|
||||
|
||||
public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot()
|
||||
@@ -90,6 +90,6 @@ class GlobTest extends TestCase
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
$this->assertSame(['one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class CustomFilterIteratorTest extends IteratorTestCase
|
||||
*/
|
||||
public function testWithInvalidFilter()
|
||||
{
|
||||
new CustomFilterIterator(new Iterator(), array('foo'));
|
||||
new CustomFilterIterator(new Iterator(), ['foo']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ class CustomFilterIteratorTest extends IteratorTestCase
|
||||
*/
|
||||
public function testAccept($filters, $expected)
|
||||
{
|
||||
$inner = new Iterator(array('test.php', 'test.py', 'foo.php'));
|
||||
$inner = new Iterator(['test.php', 'test.py', 'foo.php']);
|
||||
|
||||
$iterator = new CustomFilterIterator($inner, $filters);
|
||||
|
||||
@@ -37,10 +37,10 @@ class CustomFilterIteratorTest extends IteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
return array(
|
||||
array(array(function (\SplFileInfo $fileinfo) { return false; }), array()),
|
||||
array(array(function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }), array('test.php', 'test.py')),
|
||||
array(array('is_dir'), array()),
|
||||
);
|
||||
return [
|
||||
[[function (\SplFileInfo $fileinfo) { return false; }], []],
|
||||
[[function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }], ['test.php', 'test.py']],
|
||||
[['is_dir'], []],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
$since20YearsAgo = array(
|
||||
$since20YearsAgo = [
|
||||
'.git',
|
||||
'test.py',
|
||||
'foo',
|
||||
@@ -54,9 +54,9 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
$since2MonthsAgo = array(
|
||||
$since2MonthsAgo = [
|
||||
'.git',
|
||||
'test.py',
|
||||
'foo',
|
||||
@@ -76,17 +76,17 @@ class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
$untilLastMonth = array(
|
||||
$untilLastMonth = [
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)),
|
||||
array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)),
|
||||
array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)),
|
||||
);
|
||||
return [
|
||||
[[new DateComparator('since 20 years ago')], $this->toAbsolute($since20YearsAgo)],
|
||||
[[new DateComparator('since 2 months ago')], $this->toAbsolute($since2MonthsAgo)],
|
||||
[[new DateComparator('until last month')], $this->toAbsolute($untilLastMonth)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
$lessThan1 = array(
|
||||
$lessThan1 = [
|
||||
'.git',
|
||||
'test.py',
|
||||
'foo',
|
||||
@@ -48,9 +48,9 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
$lessThanOrEqualTo1 = array(
|
||||
$lessThanOrEqualTo1 = [
|
||||
'.git',
|
||||
'test.py',
|
||||
'foo',
|
||||
@@ -72,32 +72,32 @@ class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
$graterThanOrEqualTo1 = array(
|
||||
$graterThanOrEqualTo1 = [
|
||||
'toto/.git',
|
||||
'foo/bar.tmp',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
);
|
||||
];
|
||||
|
||||
$equalTo1 = array(
|
||||
$equalTo1 = [
|
||||
'toto/.git',
|
||||
'foo/bar.tmp',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'qux/baz_100_1.py',
|
||||
'qux/baz_1_2.py',
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
array(0, 0, $this->toAbsolute($lessThan1)),
|
||||
array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)),
|
||||
array(2, PHP_INT_MAX, array()),
|
||||
array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)),
|
||||
array(1, 1, $this->toAbsolute($equalTo1)),
|
||||
);
|
||||
return [
|
||||
[0, 0, $this->toAbsolute($lessThan1)],
|
||||
[0, 1, $this->toAbsolute($lessThanOrEqualTo1)],
|
||||
[2, PHP_INT_MAX, []],
|
||||
[1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)],
|
||||
[1, 1, $this->toAbsolute($equalTo1)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
$foo = array(
|
||||
$foo = [
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -50,9 +50,9 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
$fo = array(
|
||||
$fo = [
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -74,9 +74,9 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
$toto = array(
|
||||
$toto = [
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -96,12 +96,12 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
array(array('foo'), $this->toAbsolute($foo)),
|
||||
array(array('fo'), $this->toAbsolute($fo)),
|
||||
array(array('toto/'), $this->toAbsolute($toto)),
|
||||
);
|
||||
return [
|
||||
[['foo'], $this->toAbsolute($foo)],
|
||||
[['fo'], $this->toAbsolute($fo)],
|
||||
[['toto/'], $this->toAbsolute($toto)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class FileTypeFilterIteratorTest extends RealIteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
$onlyFiles = array(
|
||||
$onlyFiles = [
|
||||
'test.py',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
@@ -45,21 +45,21 @@ class FileTypeFilterIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
);
|
||||
];
|
||||
|
||||
$onlyDirectories = array(
|
||||
$onlyDirectories = [
|
||||
'.git',
|
||||
'foo',
|
||||
'qux',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
'.foo',
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
array(FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)),
|
||||
array(FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)),
|
||||
);
|
||||
return [
|
||||
[FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)],
|
||||
[FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,23 +17,23 @@ class FilecontentFilterIteratorTest extends IteratorTestCase
|
||||
{
|
||||
public function testAccept()
|
||||
{
|
||||
$inner = new MockFileListIterator(array('test.txt'));
|
||||
$iterator = new FilecontentFilterIterator($inner, array(), array());
|
||||
$this->assertIterator(array('test.txt'), $iterator);
|
||||
$inner = new MockFileListIterator(['test.txt']);
|
||||
$iterator = new FilecontentFilterIterator($inner, [], []);
|
||||
$this->assertIterator(['test.txt'], $iterator);
|
||||
}
|
||||
|
||||
public function testDirectory()
|
||||
{
|
||||
$inner = new MockFileListIterator(array('directory'));
|
||||
$iterator = new FilecontentFilterIterator($inner, array('directory'), array());
|
||||
$this->assertIterator(array(), $iterator);
|
||||
$inner = new MockFileListIterator(['directory']);
|
||||
$iterator = new FilecontentFilterIterator($inner, ['directory'], []);
|
||||
$this->assertIterator([], $iterator);
|
||||
}
|
||||
|
||||
public function testUnreadableFile()
|
||||
{
|
||||
$inner = new MockFileListIterator(array('file r-'));
|
||||
$iterator = new FilecontentFilterIterator($inner, array('file r-'), array());
|
||||
$this->assertIterator(array(), $iterator);
|
||||
$inner = new MockFileListIterator(['file r-']);
|
||||
$iterator = new FilecontentFilterIterator($inner, ['file r-'], []);
|
||||
$this->assertIterator([], $iterator);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,38 +49,38 @@ class FilecontentFilterIteratorTest extends IteratorTestCase
|
||||
{
|
||||
$inner = new MockFileListIterator();
|
||||
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'a.txt',
|
||||
'contents' => 'Lorem ipsum...',
|
||||
'type' => 'file',
|
||||
'mode' => 'r+', )
|
||||
'mode' => 'r+', ]
|
||||
);
|
||||
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'b.yml',
|
||||
'contents' => 'dolor sit...',
|
||||
'type' => 'file',
|
||||
'mode' => 'r+', )
|
||||
'mode' => 'r+', ]
|
||||
);
|
||||
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'some/other/dir/third.php',
|
||||
'contents' => 'amet...',
|
||||
'type' => 'file',
|
||||
'mode' => 'r+', )
|
||||
'mode' => 'r+', ]
|
||||
);
|
||||
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'unreadable-file.txt',
|
||||
'contents' => false,
|
||||
'type' => 'file',
|
||||
'mode' => 'r+', )
|
||||
'mode' => 'r+', ]
|
||||
);
|
||||
|
||||
return array(
|
||||
array($inner, array('.'), array(), array('a.txt', 'b.yml', 'some/other/dir/third.php')),
|
||||
array($inner, array('ipsum'), array(), array('a.txt')),
|
||||
array($inner, array('i', 'amet'), array('Lorem', 'amet'), array('b.yml')),
|
||||
);
|
||||
return [
|
||||
[$inner, ['.'], [], ['a.txt', 'b.yml', 'some/other/dir/third.php']],
|
||||
[$inner, ['ipsum'], [], ['a.txt']],
|
||||
[$inner, ['i', 'amet'], ['Lorem', 'amet'], ['b.yml']],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class FilenameFilterIteratorTest extends IteratorTestCase
|
||||
*/
|
||||
public function testAccept($matchPatterns, $noMatchPatterns, $expected)
|
||||
{
|
||||
$inner = new InnerNameIterator(array('test.php', 'test.py', 'foo.php'));
|
||||
$inner = new InnerNameIterator(['test.php', 'test.py', 'foo.php']);
|
||||
|
||||
$iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns);
|
||||
|
||||
@@ -29,14 +29,14 @@ class FilenameFilterIteratorTest extends IteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
return array(
|
||||
array(array('test.*'), array(), array('test.php', 'test.py')),
|
||||
array(array(), array('test.*'), array('foo.php')),
|
||||
array(array('*.php'), array('test.*'), array('foo.php')),
|
||||
array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.py')),
|
||||
array(array('/\.php$/'), array(), array('test.php', 'foo.php')),
|
||||
array(array(), array('/\.php$/'), array('test.py')),
|
||||
);
|
||||
return [
|
||||
[['test.*'], [], ['test.php', 'test.py']],
|
||||
[[], ['test.*'], ['foo.php']],
|
||||
[['*.php'], ['test.*'], ['foo.php']],
|
||||
[['*.php', '*.py'], ['foo.*'], ['test.php', 'test.py']],
|
||||
[['/\.php$/'], [], ['test.php', 'foo.php']],
|
||||
[[], ['/\.php$/'], ['test.py']],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
class Iterator implements \Iterator
|
||||
{
|
||||
protected $values = array();
|
||||
protected $values = [];
|
||||
|
||||
public function __construct(array $values = array())
|
||||
public function __construct(array $values = [])
|
||||
{
|
||||
foreach ($values as $value) {
|
||||
$this->attach(new \SplFileInfo($value));
|
||||
|
||||
@@ -51,7 +51,7 @@ abstract class IteratorTestCase extends TestCase
|
||||
$values = array_values(array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)));
|
||||
|
||||
foreach ($expected as $subarray) {
|
||||
$temp = array();
|
||||
$temp = [];
|
||||
while (\count($values) && \count($temp) < \count($subarray)) {
|
||||
$temp[] = array_shift($values);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ abstract class IteratorTestCase extends TestCase
|
||||
*/
|
||||
protected function assertIteratorInForeach($expected, \Traversable $iterator)
|
||||
{
|
||||
$values = array();
|
||||
$values = [];
|
||||
foreach ($iterator as $file) {
|
||||
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
|
||||
$values[] = $file->getPathname();
|
||||
@@ -89,7 +89,7 @@ abstract class IteratorTestCase extends TestCase
|
||||
*/
|
||||
protected function assertOrderedIteratorInForeach($expected, \Traversable $iterator)
|
||||
{
|
||||
$values = array();
|
||||
$values = [];
|
||||
foreach ($iterator as $file) {
|
||||
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
|
||||
$values[] = $file->getPathname();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
class MockFileListIterator extends \ArrayIterator
|
||||
{
|
||||
public function __construct(array $filesArray = array())
|
||||
public function __construct(array $filesArray = [])
|
||||
{
|
||||
$files = array_map(function ($file) { return new MockSplFileInfo($file); }, $filesArray);
|
||||
parent::__construct($files);
|
||||
|
||||
@@ -28,14 +28,14 @@ class MockSplFileInfo extends \SplFileInfo
|
||||
if (\is_string($param)) {
|
||||
parent::__construct($param);
|
||||
} elseif (\is_array($param)) {
|
||||
$defaults = array(
|
||||
$defaults = [
|
||||
'name' => 'file.txt',
|
||||
'contents' => null,
|
||||
'mode' => null,
|
||||
'type' => null,
|
||||
'relativePath' => null,
|
||||
'relativePathname' => null,
|
||||
);
|
||||
];
|
||||
$defaults = array_merge($defaults, $param);
|
||||
parent::__construct($defaults['name']);
|
||||
$this->setContents($defaults['contents']);
|
||||
|
||||
@@ -27,24 +27,24 @@ class MultiplePcreFilterIteratorTest extends TestCase
|
||||
|
||||
public function getIsRegexFixtures()
|
||||
{
|
||||
return array(
|
||||
array('foo', false, 'string'),
|
||||
array(' foo ', false, '" " is not a valid delimiter'),
|
||||
array('\\foo\\', false, '"\\" is not a valid delimiter'),
|
||||
array('afooa', false, '"a" is not a valid delimiter'),
|
||||
array('//', false, 'the pattern should contain at least 1 character'),
|
||||
array('/a/', true, 'valid regex'),
|
||||
array('/foo/', true, 'valid regex'),
|
||||
array('/foo/i', true, 'valid regex with a single modifier'),
|
||||
array('/foo/imsxu', true, 'valid regex with multiple modifiers'),
|
||||
array('#foo#', true, '"#" is a valid delimiter'),
|
||||
array('{foo}', true, '"{,}" is a valid delimiter pair'),
|
||||
array('[foo]', true, '"[,]" is a valid delimiter pair'),
|
||||
array('(foo)', true, '"(,)" is a valid delimiter pair'),
|
||||
array('<foo>', true, '"<,>" is a valid delimiter pair'),
|
||||
array('*foo.*', false, '"*" is not considered as a valid delimiter'),
|
||||
array('?foo.?', false, '"?" is not considered as a valid delimiter'),
|
||||
);
|
||||
return [
|
||||
['foo', false, 'string'],
|
||||
[' foo ', false, '" " is not a valid delimiter'],
|
||||
['\\foo\\', false, '"\\" is not a valid delimiter'],
|
||||
['afooa', false, '"a" is not a valid delimiter'],
|
||||
['//', false, 'the pattern should contain at least 1 character'],
|
||||
['/a/', true, 'valid regex'],
|
||||
['/foo/', true, 'valid regex'],
|
||||
['/foo/i', true, 'valid regex with a single modifier'],
|
||||
['/foo/imsxu', true, 'valid regex with multiple modifiers'],
|
||||
['#foo#', true, '"#" is a valid delimiter'],
|
||||
['{foo}', true, '"{,}" is a valid delimiter pair'],
|
||||
['[foo]', true, '"[,]" is a valid delimiter pair'],
|
||||
['(foo)', true, '"(,)" is a valid delimiter pair'],
|
||||
['<foo>', true, '"<,>" is a valid delimiter pair'],
|
||||
['*foo.*', false, '"*" is not considered as a valid delimiter'],
|
||||
['?foo.?', false, '"?" is not considered as a valid delimiter'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,54 +29,54 @@ class PathFilterIteratorTest extends IteratorTestCase
|
||||
$inner = new MockFileListIterator();
|
||||
|
||||
//PATH: A/B/C/abc.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'abc.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
));
|
||||
]);
|
||||
|
||||
//PATH: A/B/ab.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'ab.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
));
|
||||
]);
|
||||
|
||||
//PATH: A/a.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'a.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'a.dat',
|
||||
));
|
||||
]);
|
||||
|
||||
//PATH: copy/A/B/C/abc.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'abc.dat.copy',
|
||||
'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(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'ab.dat.copy',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
));
|
||||
]);
|
||||
|
||||
//PATH: copy/A/a.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
$inner[] = new MockSplFileInfo([
|
||||
'name' => 'a.dat.copy',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'a.dat',
|
||||
));
|
||||
]);
|
||||
|
||||
return array(
|
||||
array($inner, array('/^A/'), array(), array('abc.dat', 'ab.dat', 'a.dat')),
|
||||
array($inner, array('/^A\/B/'), array(), array('abc.dat', 'ab.dat')),
|
||||
array($inner, array('/^A\/B\/C/'), array(), array('abc.dat')),
|
||||
array($inner, array('/A\/B\/C/'), array(), array('abc.dat', 'abc.dat.copy')),
|
||||
return [
|
||||
[$inner, ['/^A/'], [], ['abc.dat', 'ab.dat', 'a.dat']],
|
||||
[$inner, ['/^A\/B/'], [], ['abc.dat', 'ab.dat']],
|
||||
[$inner, ['/^A\/B\/C/'], [], ['abc.dat']],
|
||||
[$inner, ['/A\/B\/C/'], [], ['abc.dat', 'abc.dat.copy']],
|
||||
|
||||
array($inner, array('A'), array(), array('abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
|
||||
array($inner, array('A/B'), array(), array('abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy')),
|
||||
array($inner, array('A/B/C'), array(), array('abc.dat', 'abc.dat.copy')),
|
||||
[$inner, ['A'], [], ['abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy']],
|
||||
[$inner, ['A/B'], [], ['abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy']],
|
||||
[$inner, ['A/B/C'], [], ['abc.dat', 'abc.dat.copy']],
|
||||
|
||||
array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
|
||||
array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
|
||||
array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
|
||||
);
|
||||
[$inner, ['copy/A'], [], ['abc.dat.copy', 'ab.dat.copy', 'a.dat.copy']],
|
||||
[$inner, ['copy/A/B'], [], ['abc.dat.copy', 'ab.dat.copy']],
|
||||
[$inner, ['copy/A/B/C'], [], ['abc.dat.copy']],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
||||
{
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
|
||||
self::$files = array(
|
||||
self::$files = [
|
||||
'.git/',
|
||||
'.foo/',
|
||||
'.foo/.bar',
|
||||
@@ -42,7 +42,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
||||
'qux/',
|
||||
'qux/baz_1_2.py',
|
||||
'qux/baz_100_1.py',
|
||||
);
|
||||
];
|
||||
|
||||
self::$files = self::toAbsolute(self::$files);
|
||||
|
||||
@@ -97,7 +97,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
||||
}
|
||||
|
||||
if (\is_array($files)) {
|
||||
$f = array();
|
||||
$f = [];
|
||||
foreach ($files as $file) {
|
||||
if (\is_array($file)) {
|
||||
$f[] = self::toAbsolute($file);
|
||||
@@ -118,7 +118,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
||||
|
||||
protected static function toAbsoluteFixtures($files)
|
||||
{
|
||||
$f = array();
|
||||
$f = [];
|
||||
foreach ($files as $file) {
|
||||
$f[] = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.$file);
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ class RecursiveDirectoryIteratorTest extends IteratorTestCase
|
||||
$this->markTestSkipped('Unsupported stream "ftp".');
|
||||
}
|
||||
|
||||
$contains = array(
|
||||
$contains = [
|
||||
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'1000GB.zip',
|
||||
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'100GB.zip',
|
||||
);
|
||||
$actual = array();
|
||||
];
|
||||
$actual = [];
|
||||
|
||||
$i->seek(0);
|
||||
$actual[] = $i->getPathname();
|
||||
|
||||
@@ -30,7 +30,7 @@ class SizeRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
$lessThan1KGreaterThan05K = array(
|
||||
$lessThan1KGreaterThan05K = [
|
||||
'.foo',
|
||||
'.git',
|
||||
'foo',
|
||||
@@ -38,11 +38,11 @@ class SizeRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
'test.php',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)),
|
||||
);
|
||||
return [
|
||||
[[new NumberComparator('< 1K'), new NumberComparator('> 0.5K')], $this->toAbsolute($lessThan1KGreaterThan05K)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
public function testConstructor()
|
||||
{
|
||||
try {
|
||||
new SortableIterator(new Iterator(array()), 'foobar');
|
||||
new SortableIterator(new Iterator([]), 'foobar');
|
||||
$this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid');
|
||||
} catch (\Exception $e) {
|
||||
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
|
||||
@@ -73,7 +73,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
|
||||
public function getAcceptData()
|
||||
{
|
||||
$sortByName = array(
|
||||
$sortByName = [
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -95,9 +95,9 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
);
|
||||
];
|
||||
|
||||
$sortByType = array(
|
||||
$sortByType = [
|
||||
'.foo',
|
||||
'.git',
|
||||
'foo',
|
||||
@@ -119,13 +119,13 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'qux_2_0.php',
|
||||
'test.php',
|
||||
'test.py',
|
||||
);
|
||||
];
|
||||
|
||||
$sortByAccessedTime = array(
|
||||
$sortByAccessedTime = [
|
||||
// For these two files the access time was set to 2005-10-15
|
||||
array('foo/bar.tmp', 'test.php'),
|
||||
['foo/bar.tmp', 'test.php'],
|
||||
// These files were created more or less at the same time
|
||||
array(
|
||||
[
|
||||
'.git',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -144,13 +144,13 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
),
|
||||
],
|
||||
// This file was accessed after sleeping for 1 sec
|
||||
array('.bar'),
|
||||
);
|
||||
['.bar'],
|
||||
];
|
||||
|
||||
$sortByChangedTime = array(
|
||||
array(
|
||||
$sortByChangedTime = [
|
||||
[
|
||||
'.git',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -170,13 +170,13 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
),
|
||||
array('test.php'),
|
||||
array('test.py'),
|
||||
);
|
||||
],
|
||||
['test.php'],
|
||||
['test.py'],
|
||||
];
|
||||
|
||||
$sortByModifiedTime = array(
|
||||
array(
|
||||
$sortByModifiedTime = [
|
||||
[
|
||||
'.git',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -196,12 +196,12 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'qux_10_2.php',
|
||||
'qux_12_0.php',
|
||||
'qux_2_0.php',
|
||||
),
|
||||
array('test.php'),
|
||||
array('test.py'),
|
||||
);
|
||||
],
|
||||
['test.php'],
|
||||
['test.py'],
|
||||
];
|
||||
|
||||
$sortByNameNatural = array(
|
||||
$sortByNameNatural = [
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -223,9 +223,9 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'test.py',
|
||||
'toto',
|
||||
'toto/.git',
|
||||
);
|
||||
];
|
||||
|
||||
$customComparison = array(
|
||||
$customComparison = [
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
@@ -247,16 +247,16 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
'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)),
|
||||
);
|
||||
return [
|
||||
[SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)],
|
||||
[SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)],
|
||||
[SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)],
|
||||
[SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)],
|
||||
[SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)],
|
||||
[SortableIterator::SORT_BY_NAME_NATURAL, $this->toAbsolute($sortByNameNatural)],
|
||||
[function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user