Version Description
= 3.2.1 =
- Important bug fixes. Please upgrade to this version to avoid incomplete or broken backups.
= 3.1.3 =
- Fixes backwards compatibility for add-ons and avoids a Fatal Error. Please upgrade straight to this version before upgrading your add-ons.
= 3.0.4 =
- Fixes a few minor bugs. Immediate update is recommended.
= 3.0.2 =
- Important: we have dropped support for PHP 5.2, you will not be able to activate BackUpWordPress on a server running PHP versions older than PHP 5.3.29
= 3.0.1 =
- This is a critical update. Fixes a bug in the core backup library. Please update immediately.
Download this release
Release Info
Developer | pauldewouters |
Plugin | BackUpWordPress |
Version | 3.2.3 |
Comparing to | |
See all releases |
Code changes from version 3.2.2 to 3.2.3
- backupwordpress.php +1 -1
- changelog.txt +0 -3
- classes/class-plugin.php +1 -1
- languages/backupwordpress.pot +24 -24
- readme.txt +1 -1
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php +0 -64
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php +0 -63
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php +0 -107
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/ExpressionTest.php +0 -68
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/GlobTest.php +0 -47
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/RegexTest.php +0 -143
- vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/DummyAdapter.php +0 -57
- vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/FailingAdapter.php +0 -45
- vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/NamedAdapter.php +0 -57
- vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/UnsupportedAdapter.php +0 -44
- vendor/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php +0 -869
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/C/abc.dat +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/ab.dat +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/a.dat +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/ab.dat.copy +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/a.dat.copy +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/dolor.txt +0 -2
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/ipsum.txt +0 -2
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/lorem.txt +0 -2
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/a +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/c.neon +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/d.neon +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/with space/foo.txt +0 -0
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php +0 -46
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php +0 -72
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php +0 -80
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php +0 -64
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php +0 -66
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php +0 -72
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php +0 -86
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php +0 -54
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php +0 -50
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/Iterator.php +0 -55
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php +0 -98
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php +0 -21
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php +0 -134
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php +0 -67
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/PathFilterIteratorTest.php +0 -83
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php +0 -109
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +0 -83
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php +0 -68
- vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php +0 -169
backupwordpress.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: BackUpWordPress Backup Plugin
|
4 |
Plugin URI: http://bwp.hmn.md/
|
5 |
Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools → Backups</strong>. On multisite, you'll find me under the Network Settings menu.
|
6 |
-
Version: 3.2.
|
7 |
Author: Human Made Limited
|
8 |
Author URI: http://hmn.md/
|
9 |
License: GPL-2.0+
|
3 |
Plugin Name: BackUpWordPress Backup Plugin
|
4 |
Plugin URI: http://bwp.hmn.md/
|
5 |
Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools → Backups</strong>. On multisite, you'll find me under the Network Settings menu.
|
6 |
+
Version: 3.2.3
|
7 |
Author: Human Made Limited
|
8 |
Author URI: http://hmn.md/
|
9 |
License: GPL-2.0+
|
changelog.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
3196233 (HEAD, origin/master, origin/HEAD, master) Fix incorrect filename
|
2 |
-
68b87f1 Remove commented admin_post hook
|
3 |
-
16a6b3a Update plugin version class constant
|
|
|
|
|
|
classes/class-plugin.php
CHANGED
@@ -11,7 +11,7 @@ register_deactivation_hook( __FILE__, array( 'HM\BackUpWordPress\Setup', 'deacti
|
|
11 |
* Class Plugin
|
12 |
*/
|
13 |
final class Plugin {
|
14 |
-
const PLUGIN_VERSION = '3.2.
|
15 |
|
16 |
/**
|
17 |
* @var Plugin The singleton instance.
|
11 |
* Class Plugin
|
12 |
*/
|
13 |
final class Plugin {
|
14 |
+
const PLUGIN_VERSION = '3.2.3';
|
15 |
|
16 |
/**
|
17 |
* @var Plugin The singleton instance.
|
languages/backupwordpress.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: BackUpWordPress Backup Plugin 3.2.
|
6 |
"Report-Msgid-Bugs-To: support@humanmade.co.uk\n"
|
7 |
-
"POT-Creation-Date: 2015-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -13,59 +13,59 @@ msgstr ""
|
|
13 |
"Language-Team: Human Made Limited\n"
|
14 |
"X-Generator: grunt-wp-i18n 0.4.9\n"
|
15 |
|
16 |
-
#: admin/actions.php:
|
17 |
msgid "The schedule ID was not provided. Aborting."
|
18 |
msgstr ""
|
19 |
|
20 |
-
#: admin/actions.php:
|
21 |
msgid "Backup type cannot be empty"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: admin/actions.php:
|
25 |
msgid "Invalid backup type"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: admin/actions.php:
|
29 |
msgid "Schedule cannot be empty"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: admin/actions.php:
|
33 |
msgid "Invalid schedule"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: admin/actions.php:
|
37 |
msgid "Day of the week must be a valid lowercase day name"
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: admin/actions.php:
|
41 |
msgid "Day of month must be between 1 and 31"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: admin/actions.php:
|
45 |
msgid "Hours must be between 0 and 23"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: admin/actions.php:
|
49 |
msgid "Minutes must be between 0 and 59"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: admin/actions.php:
|
53 |
msgid "Max backups can't be empty"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: admin/actions.php:
|
57 |
msgid "Max backups must be a number"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: admin/actions.php:
|
61 |
msgid "Max backups must be greater than 0"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: admin/actions.php:
|
65 |
msgid "BackUpWordPress has detected a problem."
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: admin/actions.php:
|
69 |
msgid ""
|
70 |
"%1$s is returning a %2$s response which could mean cron jobs aren't getting "
|
71 |
"fired properly. BackUpWordPress relies on wp-cron to run scheduled backups. "
|
@@ -827,34 +827,34 @@ msgstr ""
|
|
827 |
msgid "This %s file ensures that other people cannot download your backup files."
|
828 |
msgstr ""
|
829 |
|
830 |
-
#: classes/class-plugin.php:
|
831 |
msgid "Update"
|
832 |
msgstr ""
|
833 |
|
834 |
-
#: classes/class-plugin.php:
|
835 |
msgid "Cancel"
|
836 |
msgstr ""
|
837 |
|
838 |
-
#: classes/class-plugin.php:
|
839 |
msgid ""
|
840 |
"Are you sure you want to delete this schedule? All of it's backups will "
|
841 |
"also be deleted."
|
842 |
msgstr ""
|
843 |
|
844 |
-
#: classes/class-plugin.php:
|
845 |
-
#: classes/class-plugin.php:
|
846 |
msgid "'Cancel' to go back, 'OK' to delete."
|
847 |
msgstr ""
|
848 |
|
849 |
-
#: classes/class-plugin.php:
|
850 |
msgid "Are you sure you want to delete this backup?"
|
851 |
msgstr ""
|
852 |
|
853 |
-
#: classes/class-plugin.php:
|
854 |
msgid "Are you sure you want to remove this exclude rule?"
|
855 |
msgstr ""
|
856 |
|
857 |
-
#: classes/class-plugin.php:
|
858 |
msgid ""
|
859 |
"Reducing the number of backups that are stored on this server will cause "
|
860 |
"some of your existing backups to be deleted, are you sure that's what you "
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: BackUpWordPress Backup Plugin 3.2.3\n"
|
6 |
"Report-Msgid-Bugs-To: support@humanmade.co.uk\n"
|
7 |
+
"POT-Creation-Date: 2015-04-01 07:48:07+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
"Language-Team: Human Made Limited\n"
|
14 |
"X-Generator: grunt-wp-i18n 0.4.9\n"
|
15 |
|
16 |
+
#: admin/actions.php:191
|
17 |
msgid "The schedule ID was not provided. Aborting."
|
18 |
msgstr ""
|
19 |
|
20 |
+
#: admin/actions.php:241
|
21 |
msgid "Backup type cannot be empty"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: admin/actions.php:245
|
25 |
msgid "Invalid backup type"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: admin/actions.php:259
|
29 |
msgid "Schedule cannot be empty"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: admin/actions.php:263
|
33 |
msgid "Invalid schedule"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: admin/actions.php:277
|
37 |
msgid "Day of the week must be a valid lowercase day name"
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: admin/actions.php:296
|
41 |
msgid "Day of month must be between 1 and 31"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: admin/actions.php:315
|
45 |
msgid "Hours must be between 0 and 23"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: admin/actions.php:334
|
49 |
msgid "Minutes must be between 0 and 59"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: admin/actions.php:348
|
53 |
msgid "Max backups can't be empty"
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: admin/actions.php:352
|
57 |
msgid "Max backups must be a number"
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: admin/actions.php:356
|
61 |
msgid "Max backups must be greater than 0"
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: admin/actions.php:708 admin/actions.php:714
|
65 |
msgid "BackUpWordPress has detected a problem."
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: admin/actions.php:708 admin/actions.php:714
|
69 |
msgid ""
|
70 |
"%1$s is returning a %2$s response which could mean cron jobs aren't getting "
|
71 |
"fired properly. BackUpWordPress relies on wp-cron to run scheduled backups. "
|
827 |
msgid "This %s file ensures that other people cannot download your backup files."
|
828 |
msgstr ""
|
829 |
|
830 |
+
#: classes/class-plugin.php:218
|
831 |
msgid "Update"
|
832 |
msgstr ""
|
833 |
|
834 |
+
#: classes/class-plugin.php:219
|
835 |
msgid "Cancel"
|
836 |
msgstr ""
|
837 |
|
838 |
+
#: classes/class-plugin.php:220
|
839 |
msgid ""
|
840 |
"Are you sure you want to delete this schedule? All of it's backups will "
|
841 |
"also be deleted."
|
842 |
msgstr ""
|
843 |
|
844 |
+
#: classes/class-plugin.php:220 classes/class-plugin.php:221
|
845 |
+
#: classes/class-plugin.php:222 classes/class-plugin.php:223
|
846 |
msgid "'Cancel' to go back, 'OK' to delete."
|
847 |
msgstr ""
|
848 |
|
849 |
+
#: classes/class-plugin.php:221
|
850 |
msgid "Are you sure you want to delete this backup?"
|
851 |
msgstr ""
|
852 |
|
853 |
+
#: classes/class-plugin.php:222
|
854 |
msgid "Are you sure you want to remove this exclude rule?"
|
855 |
msgstr ""
|
856 |
|
857 |
+
#: classes/class-plugin.php:223
|
858 |
msgid ""
|
859 |
"Reducing the number of backups that are stored on this server will cause "
|
860 |
"some of your existing backups to be deleted, are you sure that's what you "
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: humanmade, willmot, pauldewouters, joehoyle, mattheu, tcrsavage, c
|
|
3 |
Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.2-beta
|
6 |
-
Stable tag: 3.2.
|
7 |
|
8 |
Simple automated backups of your WordPress powered website.
|
9 |
|
3 |
Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
|
4 |
Requires at least: 3.9
|
5 |
Tested up to: 4.2-beta
|
6 |
+
Stable tag: 3.2.3
|
7 |
|
8 |
Simple automated backups of your WordPress powered website.
|
9 |
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Comparator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Comparator\Comparator;
|
15 |
-
|
16 |
-
class ComparatorTest extends \PHPUnit_Framework_TestCase
|
17 |
-
{
|
18 |
-
public function testGetSetOperator()
|
19 |
-
{
|
20 |
-
$comparator = new Comparator();
|
21 |
-
try {
|
22 |
-
$comparator->setOperator('foo');
|
23 |
-
$this->fail('->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
|
24 |
-
} catch (\Exception $e) {
|
25 |
-
$this->assertInstanceOf('InvalidArgumentException', $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
|
26 |
-
}
|
27 |
-
|
28 |
-
$comparator = new Comparator();
|
29 |
-
$comparator->setOperator('>');
|
30 |
-
$this->assertEquals('>', $comparator->getOperator(), '->getOperator() returns the current operator');
|
31 |
-
}
|
32 |
-
|
33 |
-
public function testGetSetTarget()
|
34 |
-
{
|
35 |
-
$comparator = new Comparator();
|
36 |
-
$comparator->setTarget(8);
|
37 |
-
$this->assertEquals(8, $comparator->getTarget(), '->getTarget() returns the target');
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @dataProvider getTestData
|
42 |
-
*/
|
43 |
-
public function testTest($operator, $target, $match, $noMatch)
|
44 |
-
{
|
45 |
-
$c = new Comparator();
|
46 |
-
$c->setOperator($operator);
|
47 |
-
$c->setTarget($target);
|
48 |
-
|
49 |
-
foreach ($match as $m) {
|
50 |
-
$this->assertTrue($c->test($m), '->test() tests a string against the expression');
|
51 |
-
}
|
52 |
-
|
53 |
-
foreach ($noMatch as $m) {
|
54 |
-
$this->assertFalse($c->test($m), '->test() tests a string against the expression');
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
public function getTestData()
|
59 |
-
{
|
60 |
-
return array(
|
61 |
-
array('<', '1000', array('500', '999'), array('1000', '1500')),
|
62 |
-
);
|
63 |
-
}
|
64 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Comparator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Comparator\DateComparator;
|
15 |
-
|
16 |
-
class DateComparatorTest extends \PHPUnit_Framework_TestCase
|
17 |
-
{
|
18 |
-
public function testConstructor()
|
19 |
-
{
|
20 |
-
try {
|
21 |
-
new DateComparator('foobar');
|
22 |
-
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
|
23 |
-
} catch (\Exception $e) {
|
24 |
-
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
|
25 |
-
}
|
26 |
-
|
27 |
-
try {
|
28 |
-
new DateComparator('');
|
29 |
-
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
|
30 |
-
} catch (\Exception $e) {
|
31 |
-
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @dataProvider getTestData
|
37 |
-
*/
|
38 |
-
public function testTest($test, $match, $noMatch)
|
39 |
-
{
|
40 |
-
$c = new DateComparator($test);
|
41 |
-
|
42 |
-
foreach ($match as $m) {
|
43 |
-
$this->assertTrue($c->test($m), '->test() tests a string against the expression');
|
44 |
-
}
|
45 |
-
|
46 |
-
foreach ($noMatch as $m) {
|
47 |
-
$this->assertFalse($c->test($m), '->test() tests a string against the expression');
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
public function getTestData()
|
52 |
-
{
|
53 |
-
return array(
|
54 |
-
array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
|
55 |
-
array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
|
56 |
-
array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
|
57 |
-
array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
|
58 |
-
array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
|
59 |
-
array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
|
60 |
-
array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))),
|
61 |
-
);
|
62 |
-
}
|
63 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php
DELETED
@@ -1,107 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Comparator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Comparator\NumberComparator;
|
15 |
-
|
16 |
-
class NumberComparatorTest extends \PHPUnit_Framework_TestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getConstructorTestData
|
20 |
-
*/
|
21 |
-
public function testConstructor($successes, $failures)
|
22 |
-
{
|
23 |
-
foreach ($successes as $s) {
|
24 |
-
new NumberComparator($s);
|
25 |
-
}
|
26 |
-
|
27 |
-
foreach ($failures as $f) {
|
28 |
-
try {
|
29 |
-
new NumberComparator($f);
|
30 |
-
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
|
31 |
-
} catch (\Exception $e) {
|
32 |
-
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
|
33 |
-
}
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @dataProvider getTestData
|
39 |
-
*/
|
40 |
-
public function testTest($test, $match, $noMatch)
|
41 |
-
{
|
42 |
-
$c = new NumberComparator($test);
|
43 |
-
|
44 |
-
foreach ($match as $m) {
|
45 |
-
$this->assertTrue($c->test($m), '->test() tests a string against the expression');
|
46 |
-
}
|
47 |
-
|
48 |
-
foreach ($noMatch as $m) {
|
49 |
-
$this->assertFalse($c->test($m), '->test() tests a string against the expression');
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
public function getTestData()
|
54 |
-
{
|
55 |
-
return array(
|
56 |
-
array('< 1000', array('500', '999'), array('1000', '1500')),
|
57 |
-
|
58 |
-
array('< 1K', array('500', '999'), array('1000', '1500')),
|
59 |
-
array('<1k', array('500', '999'), array('1000', '1500')),
|
60 |
-
array(' < 1 K ', array('500', '999'), array('1000', '1500')),
|
61 |
-
array('<= 1K', array('1000'), array('1001')),
|
62 |
-
array('> 1K', array('1001'), array('1000')),
|
63 |
-
array('>= 1K', array('1000'), array('999')),
|
64 |
-
|
65 |
-
array('< 1KI', array('500', '1023'), array('1024', '1500')),
|
66 |
-
array('<= 1KI', array('1024'), array('1025')),
|
67 |
-
array('> 1KI', array('1025'), array('1024')),
|
68 |
-
array('>= 1KI', array('1024'), array('1023')),
|
69 |
-
|
70 |
-
array('1KI', array('1024'), array('1023', '1025')),
|
71 |
-
array('==1KI', array('1024'), array('1023', '1025')),
|
72 |
-
|
73 |
-
array('==1m', array('1000000'), array('999999', '1000001')),
|
74 |
-
array('==1mi', array(1024*1024), array(1024*1024-1, 1024*1024+1)),
|
75 |
-
|
76 |
-
array('==1g', array('1000000000'), array('999999999', '1000000001')),
|
77 |
-
array('==1gi', array(1024*1024*1024), array(1024*1024*1024-1, 1024*1024*1024+1)),
|
78 |
-
|
79 |
-
array('!= 1000', array('500', '999'), array('1000')),
|
80 |
-
);
|
81 |
-
}
|
82 |
-
|
83 |
-
public function getConstructorTestData()
|
84 |
-
{
|
85 |
-
return array(
|
86 |
-
array(
|
87 |
-
array(
|
88 |
-
'1', '0',
|
89 |
-
'3.5', '33.55', '123.456', '123456.78',
|
90 |
-
'.1', '.123',
|
91 |
-
'.0', '0.0',
|
92 |
-
'1.', '0.', '123.',
|
93 |
-
'==1', '!=1', '<1', '>1', '<=1', '>=1',
|
94 |
-
'==1k', '==1ki', '==1m', '==1mi', '==1g', '==1gi',
|
95 |
-
'1k', '1ki', '1m', '1mi', '1g', '1gi',
|
96 |
-
),
|
97 |
-
array(
|
98 |
-
false, null, '',
|
99 |
-
' ', 'foobar',
|
100 |
-
'=1', '===1',
|
101 |
-
'0 . 1', '123 .45', '234. 567',
|
102 |
-
'..', '.0.', '0.1.2',
|
103 |
-
),
|
104 |
-
),
|
105 |
-
);
|
106 |
-
}
|
107 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/ExpressionTest.php
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Expression;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Expression\Expression;
|
15 |
-
|
16 |
-
class ExpressionTest extends \PHPUnit_Framework_TestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getTypeGuesserData
|
20 |
-
*/
|
21 |
-
public function testTypeGuesser($expr, $type)
|
22 |
-
{
|
23 |
-
$this->assertEquals($type, Expression::create($expr)->getType());
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @dataProvider getCaseSensitiveData
|
28 |
-
*/
|
29 |
-
public function testCaseSensitive($expr, $isCaseSensitive)
|
30 |
-
{
|
31 |
-
$this->assertEquals($isCaseSensitive, Expression::create($expr)->isCaseSensitive());
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* @dataProvider getRegexRenderingData
|
36 |
-
*/
|
37 |
-
public function testRegexRendering($expr, $body)
|
38 |
-
{
|
39 |
-
$this->assertEquals($body, Expression::create($expr)->renderPattern());
|
40 |
-
}
|
41 |
-
|
42 |
-
public function getTypeGuesserData()
|
43 |
-
{
|
44 |
-
return array(
|
45 |
-
array('{foo}', Expression::TYPE_REGEX),
|
46 |
-
array('/foo/', Expression::TYPE_REGEX),
|
47 |
-
array('foo', Expression::TYPE_GLOB),
|
48 |
-
array('foo*', Expression::TYPE_GLOB),
|
49 |
-
);
|
50 |
-
}
|
51 |
-
|
52 |
-
public function getCaseSensitiveData()
|
53 |
-
{
|
54 |
-
return array(
|
55 |
-
array('{foo}m', true),
|
56 |
-
array('/foo/i', false),
|
57 |
-
array('foo*', true),
|
58 |
-
);
|
59 |
-
}
|
60 |
-
|
61 |
-
public function getRegexRenderingData()
|
62 |
-
{
|
63 |
-
return array(
|
64 |
-
array('{foo}m', 'foo'),
|
65 |
-
array('/foo/i', 'foo'),
|
66 |
-
);
|
67 |
-
}
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/GlobTest.php
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Expression;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Expression\Expression;
|
15 |
-
|
16 |
-
class GlobTest extends \PHPUnit_Framework_TestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getToRegexData
|
20 |
-
*/
|
21 |
-
public function testGlobToRegex($glob, $match, $noMatch)
|
22 |
-
{
|
23 |
-
foreach ($match as $m) {
|
24 |
-
$this->assertRegExp(Expression::create($glob)->getRegex()->render(), $m, '::toRegex() converts a glob to a regexp');
|
25 |
-
}
|
26 |
-
|
27 |
-
foreach ($noMatch as $m) {
|
28 |
-
$this->assertNotRegExp(Expression::create($glob)->getRegex()->render(), $m, '::toRegex() converts a glob to a regexp');
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
public function getToRegexData()
|
33 |
-
{
|
34 |
-
return array(
|
35 |
-
array('', array(''), array('f', '/')),
|
36 |
-
array('*', array('foo'), array('foo/', '/foo')),
|
37 |
-
array('foo.*', array('foo.php', 'foo.a', 'foo.'), array('fooo.php', 'foo.php/foo')),
|
38 |
-
array('fo?', array('foo', 'fot'), array('fooo', 'ffoo', 'fo/')),
|
39 |
-
array('fo{o,t}', array('foo', 'fot'), array('fob', 'fo/')),
|
40 |
-
array('foo(bar|foo)', array('foo(bar|foo)'), array('foobar', 'foofoo')),
|
41 |
-
array('foo,bar', array('foo,bar'), array('foo', 'bar')),
|
42 |
-
array('fo{o,\\,}', array('foo', 'fo,'), array()),
|
43 |
-
array('fo{o,\\\\}', array('foo', 'fo\\'), array()),
|
44 |
-
array('/foo', array('/foo'), array('foo')),
|
45 |
-
);
|
46 |
-
}
|
47 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/RegexTest.php
DELETED
@@ -1,143 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Expression;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Expression\Expression;
|
15 |
-
|
16 |
-
class RegexTest extends \PHPUnit_Framework_TestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getHasFlagsData
|
20 |
-
*/
|
21 |
-
public function testHasFlags($regex, $start, $end)
|
22 |
-
{
|
23 |
-
$expr = new Expression($regex);
|
24 |
-
|
25 |
-
$this->assertEquals($start, $expr->getRegex()->hasStartFlag());
|
26 |
-
$this->assertEquals($end, $expr->getRegex()->hasEndFlag());
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @dataProvider getHasJokersData
|
31 |
-
*/
|
32 |
-
public function testHasJokers($regex, $start, $end)
|
33 |
-
{
|
34 |
-
$expr = new Expression($regex);
|
35 |
-
|
36 |
-
$this->assertEquals($start, $expr->getRegex()->hasStartJoker());
|
37 |
-
$this->assertEquals($end, $expr->getRegex()->hasEndJoker());
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @dataProvider getSetFlagsData
|
42 |
-
*/
|
43 |
-
public function testSetFlags($regex, $start, $end, $expected)
|
44 |
-
{
|
45 |
-
$expr = new Expression($regex);
|
46 |
-
$expr->getRegex()->setStartFlag($start)->setEndFlag($end);
|
47 |
-
|
48 |
-
$this->assertEquals($expected, $expr->render());
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @dataProvider getSetJokersData
|
53 |
-
*/
|
54 |
-
public function testSetJokers($regex, $start, $end, $expected)
|
55 |
-
{
|
56 |
-
$expr = new Expression($regex);
|
57 |
-
$expr->getRegex()->setStartJoker($start)->setEndJoker($end);
|
58 |
-
|
59 |
-
$this->assertEquals($expected, $expr->render());
|
60 |
-
}
|
61 |
-
|
62 |
-
public function testOptions()
|
63 |
-
{
|
64 |
-
$expr = new Expression('~abc~is');
|
65 |
-
$expr->getRegex()->removeOption('i')->addOption('m');
|
66 |
-
|
67 |
-
$this->assertEquals('~abc~sm', $expr->render());
|
68 |
-
}
|
69 |
-
|
70 |
-
public function testMixFlagsAndJokers()
|
71 |
-
{
|
72 |
-
$expr = new Expression('~^.*abc.*$~is');
|
73 |
-
|
74 |
-
$expr->getRegex()->setStartFlag(false)->setEndFlag(false)->setStartJoker(false)->setEndJoker(false);
|
75 |
-
$this->assertEquals('~abc~is', $expr->render());
|
76 |
-
|
77 |
-
$expr->getRegex()->setStartFlag(true)->setEndFlag(true)->setStartJoker(true)->setEndJoker(true);
|
78 |
-
$this->assertEquals('~^.*abc.*$~is', $expr->render());
|
79 |
-
}
|
80 |
-
|
81 |
-
/**
|
82 |
-
* @dataProvider getReplaceJokersTestData
|
83 |
-
*/
|
84 |
-
public function testReplaceJokers($regex, $expected)
|
85 |
-
{
|
86 |
-
$expr = new Expression($regex);
|
87 |
-
$expr = $expr->getRegex()->replaceJokers('@');
|
88 |
-
|
89 |
-
$this->assertEquals($expected, $expr->renderPattern());
|
90 |
-
}
|
91 |
-
|
92 |
-
public function getHasFlagsData()
|
93 |
-
{
|
94 |
-
return array(
|
95 |
-
array('~^abc~', true, false),
|
96 |
-
array('~abc$~', false, true),
|
97 |
-
array('~abc~', false, false),
|
98 |
-
array('~^abc$~', true, true),
|
99 |
-
array('~^abc\\$~', true, false),
|
100 |
-
);
|
101 |
-
}
|
102 |
-
|
103 |
-
public function getHasJokersData()
|
104 |
-
{
|
105 |
-
return array(
|
106 |
-
array('~.*abc~', true, false),
|
107 |
-
array('~abc.*~', false, true),
|
108 |
-
array('~abc~', false, false),
|
109 |
-
array('~.*abc.*~', true, true),
|
110 |
-
array('~.*abc\\.*~', true, false),
|
111 |
-
);
|
112 |
-
}
|
113 |
-
|
114 |
-
public function getSetFlagsData()
|
115 |
-
{
|
116 |
-
return array(
|
117 |
-
array('~abc~', true, false, '~^abc~'),
|
118 |
-
array('~abc~', false, true, '~abc$~'),
|
119 |
-
array('~abc~', false, false, '~abc~'),
|
120 |
-
array('~abc~', true, true, '~^abc$~'),
|
121 |
-
);
|
122 |
-
}
|
123 |
-
|
124 |
-
public function getSetJokersData()
|
125 |
-
{
|
126 |
-
return array(
|
127 |
-
array('~abc~', true, false, '~.*abc~'),
|
128 |
-
array('~abc~', false, true, '~abc.*~'),
|
129 |
-
array('~abc~', false, false, '~abc~'),
|
130 |
-
array('~abc~', true, true, '~.*abc.*~'),
|
131 |
-
);
|
132 |
-
}
|
133 |
-
|
134 |
-
public function getReplaceJokersTestData()
|
135 |
-
{
|
136 |
-
return array(
|
137 |
-
array('~.abc~', '@abc'),
|
138 |
-
array('~\\.abc~', '\\.abc'),
|
139 |
-
array('~\\\\.abc~', '\\\\@abc'),
|
140 |
-
array('~\\\\\\.abc~', '\\\\\\.abc'),
|
141 |
-
);
|
142 |
-
}
|
143 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/DummyAdapter.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\FakeAdapter;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Adapter\AbstractAdapter;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @author Jean-François Simon <contact@jfsimon.fr>
|
18 |
-
*/
|
19 |
-
class DummyAdapter extends AbstractAdapter
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* @var \Iterator
|
23 |
-
*/
|
24 |
-
private $iterator;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @param \Iterator $iterator
|
28 |
-
*/
|
29 |
-
public function __construct(\Iterator $iterator)
|
30 |
-
{
|
31 |
-
$this->iterator = $iterator;
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* {@inheritdoc}
|
36 |
-
*/
|
37 |
-
public function searchInDirectory($dir)
|
38 |
-
{
|
39 |
-
return $this->iterator;
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* {@inheritdoc}
|
44 |
-
*/
|
45 |
-
public function getName()
|
46 |
-
{
|
47 |
-
return 'yes';
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* {@inheritdoc}
|
52 |
-
*/
|
53 |
-
protected function canBeUsed()
|
54 |
-
{
|
55 |
-
return true;
|
56 |
-
}
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/FailingAdapter.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\FakeAdapter;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Adapter\AbstractAdapter;
|
15 |
-
use Symfony\Component\Finder\Exception\AdapterFailureException;
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @author Jean-François Simon <contact@jfsimon.fr>
|
19 |
-
*/
|
20 |
-
class FailingAdapter extends AbstractAdapter
|
21 |
-
{
|
22 |
-
/**
|
23 |
-
* {@inheritdoc}
|
24 |
-
*/
|
25 |
-
public function searchInDirectory($dir)
|
26 |
-
{
|
27 |
-
throw new AdapterFailureException($this);
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* {@inheritdoc}
|
32 |
-
*/
|
33 |
-
public function getName()
|
34 |
-
{
|
35 |
-
return 'failing';
|
36 |
-
}
|
37 |
-
|
38 |
-
/**
|
39 |
-
* {@inheritdoc}
|
40 |
-
*/
|
41 |
-
protected function canBeUsed()
|
42 |
-
{
|
43 |
-
return true;
|
44 |
-
}
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/NamedAdapter.php
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\FakeAdapter;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Adapter\AbstractAdapter;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @author Jean-François Simon <contact@jfsimon.fr>
|
18 |
-
*/
|
19 |
-
class NamedAdapter extends AbstractAdapter
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* @var string
|
23 |
-
*/
|
24 |
-
private $name;
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @param string $name
|
28 |
-
*/
|
29 |
-
public function __construct($name)
|
30 |
-
{
|
31 |
-
$this->name = $name;
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* {@inheritdoc}
|
36 |
-
*/
|
37 |
-
public function searchInDirectory($dir)
|
38 |
-
{
|
39 |
-
return new \ArrayIterator(array());
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* {@inheritdoc}
|
44 |
-
*/
|
45 |
-
public function getName()
|
46 |
-
{
|
47 |
-
return $this->name;
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* {@inheritdoc}
|
52 |
-
*/
|
53 |
-
protected function canBeUsed()
|
54 |
-
{
|
55 |
-
return true;
|
56 |
-
}
|
57 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/UnsupportedAdapter.php
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\FakeAdapter;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Adapter\AbstractAdapter;
|
15 |
-
|
16 |
-
/**
|
17 |
-
* @author Jean-François Simon <contact@jfsimon.fr>
|
18 |
-
*/
|
19 |
-
class UnsupportedAdapter extends AbstractAdapter
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* {@inheritdoc}
|
23 |
-
*/
|
24 |
-
public function searchInDirectory($dir)
|
25 |
-
{
|
26 |
-
return new \ArrayIterator(array());
|
27 |
-
}
|
28 |
-
|
29 |
-
/**
|
30 |
-
* {@inheritdoc}
|
31 |
-
*/
|
32 |
-
public function getName()
|
33 |
-
{
|
34 |
-
return 'unsupported';
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* {@inheritdoc}
|
39 |
-
*/
|
40 |
-
protected function canBeUsed()
|
41 |
-
{
|
42 |
-
return false;
|
43 |
-
}
|
44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php
DELETED
@@ -1,869 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Finder;
|
15 |
-
use Symfony\Component\Finder\Adapter;
|
16 |
-
|
17 |
-
class FinderTest extends Iterator\RealIteratorTestCase
|
18 |
-
{
|
19 |
-
public function testCreate()
|
20 |
-
{
|
21 |
-
$this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create());
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @dataProvider getAdaptersTestData
|
26 |
-
*/
|
27 |
-
public function testDirectories($adapter)
|
28 |
-
{
|
29 |
-
$finder = $this->buildFinder($adapter);
|
30 |
-
$this->assertSame($finder, $finder->directories());
|
31 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
32 |
-
|
33 |
-
$finder = $this->buildFinder($adapter);
|
34 |
-
$finder->directories();
|
35 |
-
$finder->files();
|
36 |
-
$finder->directories();
|
37 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* @dataProvider getAdaptersTestData
|
42 |
-
*/
|
43 |
-
public function testFiles($adapter)
|
44 |
-
{
|
45 |
-
$finder = $this->buildFinder($adapter);
|
46 |
-
$this->assertSame($finder, $finder->files());
|
47 |
-
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
48 |
-
|
49 |
-
$finder = $this->buildFinder($adapter);
|
50 |
-
$finder->files();
|
51 |
-
$finder->directories();
|
52 |
-
$finder->files();
|
53 |
-
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* @dataProvider getAdaptersTestData
|
58 |
-
*/
|
59 |
-
public function testDepth($adapter)
|
60 |
-
{
|
61 |
-
$finder = $this->buildFinder($adapter);
|
62 |
-
$this->assertSame($finder, $finder->depth('< 1'));
|
63 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
64 |
-
|
65 |
-
$finder = $this->buildFinder($adapter);
|
66 |
-
$this->assertSame($finder, $finder->depth('<= 0'));
|
67 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
68 |
-
|
69 |
-
$finder = $this->buildFinder($adapter);
|
70 |
-
$this->assertSame($finder, $finder->depth('>= 1'));
|
71 |
-
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp')), $finder->in(self::$tmpDir)->getIterator());
|
72 |
-
|
73 |
-
$finder = $this->buildFinder($adapter);
|
74 |
-
$finder->depth('< 1')->depth('>= 1');
|
75 |
-
$this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* @dataProvider getAdaptersTestData
|
80 |
-
*/
|
81 |
-
public function testName($adapter)
|
82 |
-
{
|
83 |
-
$finder = $this->buildFinder($adapter);
|
84 |
-
$this->assertSame($finder, $finder->name('*.php'));
|
85 |
-
$this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
|
86 |
-
|
87 |
-
$finder = $this->buildFinder($adapter);
|
88 |
-
$finder->name('test.ph*');
|
89 |
-
$finder->name('test.py');
|
90 |
-
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
91 |
-
|
92 |
-
$finder = $this->buildFinder($adapter);
|
93 |
-
$finder->name('~^test~i');
|
94 |
-
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
95 |
-
|
96 |
-
$finder = $this->buildFinder($adapter);
|
97 |
-
$finder->name('~\\.php$~i');
|
98 |
-
$this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
|
99 |
-
|
100 |
-
$finder = $this->buildFinder($adapter);
|
101 |
-
$finder->name('test.p{hp,y}');
|
102 |
-
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* @dataProvider getAdaptersTestData
|
107 |
-
*/
|
108 |
-
public function testNotName($adapter)
|
109 |
-
{
|
110 |
-
$finder = $this->buildFinder($adapter);
|
111 |
-
$this->assertSame($finder, $finder->notName('*.php'));
|
112 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
113 |
-
|
114 |
-
$finder = $this->buildFinder($adapter);
|
115 |
-
$finder->notName('*.php');
|
116 |
-
$finder->notName('*.py');
|
117 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
118 |
-
|
119 |
-
$finder = $this->buildFinder($adapter);
|
120 |
-
$finder->name('test.ph*');
|
121 |
-
$finder->name('test.py');
|
122 |
-
$finder->notName('*.php');
|
123 |
-
$finder->notName('*.py');
|
124 |
-
$this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
|
125 |
-
|
126 |
-
$finder = $this->buildFinder($adapter);
|
127 |
-
$finder->name('test.ph*');
|
128 |
-
$finder->name('test.py');
|
129 |
-
$finder->notName('*.p{hp,y}');
|
130 |
-
$this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* @dataProvider getRegexNameTestData
|
135 |
-
*
|
136 |
-
* @group regexName
|
137 |
-
*/
|
138 |
-
public function testRegexName($adapter, $regex)
|
139 |
-
{
|
140 |
-
$finder = $this->buildFinder($adapter);
|
141 |
-
$finder->name($regex);
|
142 |
-
$this->assertIterator($this->toAbsolute(array('test.py', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
|
143 |
-
}
|
144 |
-
|
145 |
-
/**
|
146 |
-
* @dataProvider getAdaptersTestData
|
147 |
-
*/
|
148 |
-
public function testSize($adapter)
|
149 |
-
{
|
150 |
-
$finder = $this->buildFinder($adapter);
|
151 |
-
$this->assertSame($finder, $finder->files()->size('< 1K')->size('> 500'));
|
152 |
-
$this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator());
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* @dataProvider getAdaptersTestData
|
157 |
-
*/
|
158 |
-
public function testDate($adapter)
|
159 |
-
{
|
160 |
-
$finder = $this->buildFinder($adapter);
|
161 |
-
$this->assertSame($finder, $finder->files()->date('until last month'));
|
162 |
-
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator());
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* @dataProvider getAdaptersTestData
|
167 |
-
*/
|
168 |
-
public function testExclude($adapter)
|
169 |
-
{
|
170 |
-
$finder = $this->buildFinder($adapter);
|
171 |
-
$this->assertSame($finder, $finder->exclude('foo'));
|
172 |
-
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
173 |
-
}
|
174 |
-
|
175 |
-
/**
|
176 |
-
* @dataProvider getAdaptersTestData
|
177 |
-
*/
|
178 |
-
public function testIgnoreVCS($adapter)
|
179 |
-
{
|
180 |
-
$finder = $this->buildFinder($adapter);
|
181 |
-
$this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false));
|
182 |
-
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
183 |
-
|
184 |
-
$finder = $this->buildFinder($adapter);
|
185 |
-
$finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false);
|
186 |
-
$this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
187 |
-
|
188 |
-
$finder = $this->buildFinder($adapter);
|
189 |
-
$this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false));
|
190 |
-
$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());
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* @dataProvider getAdaptersTestData
|
195 |
-
*/
|
196 |
-
public function testIgnoreDotFiles($adapter)
|
197 |
-
{
|
198 |
-
$finder = $this->buildFinder($adapter);
|
199 |
-
$this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false));
|
200 |
-
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
201 |
-
|
202 |
-
$finder = $this->buildFinder($adapter);
|
203 |
-
$finder->ignoreDotFiles(false)->ignoreDotFiles(false)->ignoreVCS(false);
|
204 |
-
$this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
205 |
-
|
206 |
-
$finder = $this->buildFinder($adapter);
|
207 |
-
$this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false));
|
208 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* @dataProvider getAdaptersTestData
|
213 |
-
*/
|
214 |
-
public function testSortByName($adapter)
|
215 |
-
{
|
216 |
-
$finder = $this->buildFinder($adapter);
|
217 |
-
$this->assertSame($finder, $finder->sortByName());
|
218 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* @dataProvider getAdaptersTestData
|
223 |
-
*/
|
224 |
-
public function testSortByType($adapter)
|
225 |
-
{
|
226 |
-
$finder = $this->buildFinder($adapter);
|
227 |
-
$this->assertSame($finder, $finder->sortByType());
|
228 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'toto', 'foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
229 |
-
}
|
230 |
-
|
231 |
-
/**
|
232 |
-
* @dataProvider getAdaptersTestData
|
233 |
-
*/
|
234 |
-
public function testSortByAccessedTime($adapter)
|
235 |
-
{
|
236 |
-
$finder = $this->buildFinder($adapter);
|
237 |
-
$this->assertSame($finder, $finder->sortByAccessedTime());
|
238 |
-
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
239 |
-
}
|
240 |
-
|
241 |
-
/**
|
242 |
-
* @dataProvider getAdaptersTestData
|
243 |
-
*/
|
244 |
-
public function testSortByChangedTime($adapter)
|
245 |
-
{
|
246 |
-
$finder = $this->buildFinder($adapter);
|
247 |
-
$this->assertSame($finder, $finder->sortByChangedTime());
|
248 |
-
$this->assertIterator($this->toAbsolute(array('toto', 'test.py', 'test.php', 'foo/bar.tmp', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* @dataProvider getAdaptersTestData
|
253 |
-
*/
|
254 |
-
public function testSortByModifiedTime($adapter)
|
255 |
-
{
|
256 |
-
$finder = $this->buildFinder($adapter);
|
257 |
-
$this->assertSame($finder, $finder->sortByModifiedTime());
|
258 |
-
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
259 |
-
}
|
260 |
-
|
261 |
-
/**
|
262 |
-
* @dataProvider getAdaptersTestData
|
263 |
-
*/
|
264 |
-
public function testSort($adapter)
|
265 |
-
{
|
266 |
-
$finder = $this->buildFinder($adapter);
|
267 |
-
$this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }));
|
268 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
|
269 |
-
}
|
270 |
-
|
271 |
-
/**
|
272 |
-
* @dataProvider getAdaptersTestData
|
273 |
-
*/
|
274 |
-
public function testFilter($adapter)
|
275 |
-
{
|
276 |
-
$finder = $this->buildFinder($adapter);
|
277 |
-
$this->assertSame($finder, $finder->filter(function (\SplFileInfo $f) { return preg_match('/test/', $f) > 0; }));
|
278 |
-
$this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator());
|
279 |
-
}
|
280 |
-
|
281 |
-
/**
|
282 |
-
* @dataProvider getAdaptersTestData
|
283 |
-
*/
|
284 |
-
public function testFollowLinks($adapter)
|
285 |
-
{
|
286 |
-
if ('\\' == DIRECTORY_SEPARATOR) {
|
287 |
-
return;
|
288 |
-
}
|
289 |
-
|
290 |
-
$finder = $this->buildFinder($adapter);
|
291 |
-
$this->assertSame($finder, $finder->followLinks());
|
292 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* @dataProvider getAdaptersTestData
|
297 |
-
*/
|
298 |
-
public function testIn($adapter)
|
299 |
-
{
|
300 |
-
$finder = $this->buildFinder($adapter);
|
301 |
-
try {
|
302 |
-
$finder->in('foobar');
|
303 |
-
$this->fail('->in() throws a \InvalidArgumentException if the directory does not exist');
|
304 |
-
} catch (\Exception $e) {
|
305 |
-
$this->assertInstanceOf('InvalidArgumentException', $e, '->in() throws a \InvalidArgumentException if the directory does not exist');
|
306 |
-
}
|
307 |
-
|
308 |
-
$finder = $this->buildFinder($adapter);
|
309 |
-
$iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator();
|
310 |
-
|
311 |
-
$this->assertIterator(array(self::$tmpDir.DIRECTORY_SEPARATOR.'test.php', __DIR__.DIRECTORY_SEPARATOR.'FinderTest.php'), $iterator);
|
312 |
-
}
|
313 |
-
|
314 |
-
/**
|
315 |
-
* @dataProvider getAdaptersTestData
|
316 |
-
*/
|
317 |
-
public function testInWithGlob($adapter)
|
318 |
-
{
|
319 |
-
$finder = $this->buildFinder($adapter);
|
320 |
-
$finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator();
|
321 |
-
|
322 |
-
$this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* @dataProvider getAdaptersTestData
|
327 |
-
* @expectedException \InvalidArgumentException
|
328 |
-
*/
|
329 |
-
public function testInWithNonDirectoryGlob($adapter)
|
330 |
-
{
|
331 |
-
$finder = $this->buildFinder($adapter);
|
332 |
-
$finder->in(__DIR__.'/Fixtures/A/a*');
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* @dataProvider getAdaptersTestData
|
337 |
-
*/
|
338 |
-
public function testInWithGlobBrace($adapter)
|
339 |
-
{
|
340 |
-
$finder = $this->buildFinder($adapter);
|
341 |
-
$finder->in(array(__DIR__.'/Fixtures/{A,copy/A}/B/C'))->getIterator();
|
342 |
-
|
343 |
-
$this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* @dataProvider getAdaptersTestData
|
348 |
-
*/
|
349 |
-
public function testGetIterator($adapter)
|
350 |
-
{
|
351 |
-
$finder = $this->buildFinder($adapter);
|
352 |
-
try {
|
353 |
-
$finder->getIterator();
|
354 |
-
$this->fail('->getIterator() throws a \LogicException if the in() method has not been called');
|
355 |
-
} catch (\Exception $e) {
|
356 |
-
$this->assertInstanceOf('LogicException', $e, '->getIterator() throws a \LogicException if the in() method has not been called');
|
357 |
-
}
|
358 |
-
|
359 |
-
$finder = $this->buildFinder($adapter);
|
360 |
-
$dirs = array();
|
361 |
-
foreach ($finder->directories()->in(self::$tmpDir) as $dir) {
|
362 |
-
$dirs[] = (string) $dir;
|
363 |
-
}
|
364 |
-
|
365 |
-
$expected = $this->toAbsolute(array('foo', 'toto'));
|
366 |
-
|
367 |
-
sort($dirs);
|
368 |
-
sort($expected);
|
369 |
-
|
370 |
-
$this->assertEquals($expected, $dirs, 'implements the \IteratorAggregate interface');
|
371 |
-
|
372 |
-
$finder = $this->buildFinder($adapter);
|
373 |
-
$this->assertEquals(2, iterator_count($finder->directories()->in(self::$tmpDir)), 'implements the \IteratorAggregate interface');
|
374 |
-
|
375 |
-
$finder = $this->buildFinder($adapter);
|
376 |
-
$a = iterator_to_array($finder->directories()->in(self::$tmpDir));
|
377 |
-
$a = array_values(array_map(function ($a) { return (string) $a; }, $a));
|
378 |
-
sort($a);
|
379 |
-
$this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface');
|
380 |
-
}
|
381 |
-
|
382 |
-
/**
|
383 |
-
* @dataProvider getAdaptersTestData
|
384 |
-
*/
|
385 |
-
public function testRelativePath($adapter)
|
386 |
-
{
|
387 |
-
$finder = $this->buildFinder($adapter)->in(self::$tmpDir);
|
388 |
-
|
389 |
-
$paths = array();
|
390 |
-
|
391 |
-
foreach ($finder as $file) {
|
392 |
-
$paths[] = $file->getRelativePath();
|
393 |
-
}
|
394 |
-
|
395 |
-
$ref = array("", "", "", "", "foo", "");
|
396 |
-
|
397 |
-
sort($ref);
|
398 |
-
sort($paths);
|
399 |
-
|
400 |
-
$this->assertEquals($ref, $paths);
|
401 |
-
}
|
402 |
-
|
403 |
-
/**
|
404 |
-
* @dataProvider getAdaptersTestData
|
405 |
-
*/
|
406 |
-
public function testRelativePathname($adapter)
|
407 |
-
{
|
408 |
-
$finder = $this->buildFinder($adapter)->in(self::$tmpDir)->sortByName();
|
409 |
-
|
410 |
-
$paths = array();
|
411 |
-
|
412 |
-
foreach ($finder as $file) {
|
413 |
-
$paths[] = $file->getRelativePathname();
|
414 |
-
}
|
415 |
-
|
416 |
-
$ref = array("test.php", "toto", "test.py", "foo", "foo".DIRECTORY_SEPARATOR."bar.tmp", "foo bar");
|
417 |
-
|
418 |
-
sort($paths);
|
419 |
-
sort($ref);
|
420 |
-
|
421 |
-
$this->assertEquals($ref, $paths);
|
422 |
-
}
|
423 |
-
|
424 |
-
/**
|
425 |
-
* @dataProvider getAdaptersTestData
|
426 |
-
*/
|
427 |
-
public function testAppendWithAFinder($adapter)
|
428 |
-
{
|
429 |
-
$finder = $this->buildFinder($adapter);
|
430 |
-
$finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
431 |
-
|
432 |
-
$finder1 = $this->buildFinder($adapter);
|
433 |
-
$finder1->directories()->in(self::$tmpDir);
|
434 |
-
|
435 |
-
$finder = $finder->append($finder1);
|
436 |
-
|
437 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
|
438 |
-
}
|
439 |
-
|
440 |
-
/**
|
441 |
-
* @dataProvider getAdaptersTestData
|
442 |
-
*/
|
443 |
-
public function testAppendWithAnArray($adapter)
|
444 |
-
{
|
445 |
-
$finder = $this->buildFinder($adapter);
|
446 |
-
$finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
447 |
-
|
448 |
-
$finder->append($this->toAbsolute(array('foo', 'toto')));
|
449 |
-
|
450 |
-
$this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator());
|
451 |
-
}
|
452 |
-
|
453 |
-
/**
|
454 |
-
* @dataProvider getAdaptersTestData
|
455 |
-
*/
|
456 |
-
public function testAppendReturnsAFinder($adapter)
|
457 |
-
{
|
458 |
-
$this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', $this->buildFinder($adapter)->append(array()));
|
459 |
-
}
|
460 |
-
|
461 |
-
/**
|
462 |
-
* @dataProvider getAdaptersTestData
|
463 |
-
*/
|
464 |
-
public function testAppendDoesNotRequireIn($adapter)
|
465 |
-
{
|
466 |
-
$finder = $this->buildFinder($adapter);
|
467 |
-
$finder->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
468 |
-
|
469 |
-
$finder1 = Finder::create()->append($finder);
|
470 |
-
|
471 |
-
$this->assertIterator(iterator_to_array($finder->getIterator()), $finder1->getIterator());
|
472 |
-
}
|
473 |
-
|
474 |
-
public function testCountDirectories()
|
475 |
-
{
|
476 |
-
$directory = Finder::create()->directories()->in(self::$tmpDir);
|
477 |
-
$i = 0;
|
478 |
-
|
479 |
-
foreach ($directory as $dir) {
|
480 |
-
$i++;
|
481 |
-
}
|
482 |
-
|
483 |
-
$this->assertCount($i, $directory);
|
484 |
-
}
|
485 |
-
|
486 |
-
public function testCountFiles()
|
487 |
-
{
|
488 |
-
$files = Finder::create()->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
489 |
-
$i = 0;
|
490 |
-
|
491 |
-
foreach ($files as $file) {
|
492 |
-
$i++;
|
493 |
-
}
|
494 |
-
|
495 |
-
$this->assertCount($i, $files);
|
496 |
-
}
|
497 |
-
|
498 |
-
/**
|
499 |
-
* @expectedException \LogicException
|
500 |
-
*/
|
501 |
-
public function testCountWithoutIn()
|
502 |
-
{
|
503 |
-
$finder = Finder::create()->files();
|
504 |
-
count($finder);
|
505 |
-
}
|
506 |
-
|
507 |
-
/**
|
508 |
-
* @dataProvider getContainsTestData
|
509 |
-
* @group grep
|
510 |
-
*/
|
511 |
-
public function testContains($adapter, $matchPatterns, $noMatchPatterns, $expected)
|
512 |
-
{
|
513 |
-
$finder = $this->buildFinder($adapter);
|
514 |
-
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
|
515 |
-
->name('*.txt')->sortByName()
|
516 |
-
->contains($matchPatterns)
|
517 |
-
->notContains($noMatchPatterns);
|
518 |
-
|
519 |
-
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
|
520 |
-
}
|
521 |
-
|
522 |
-
/**
|
523 |
-
* @dataProvider getAdaptersTestData
|
524 |
-
*/
|
525 |
-
public function testContainsOnDirectory(Adapter\AdapterInterface $adapter)
|
526 |
-
{
|
527 |
-
$finder = $this->buildFinder($adapter);
|
528 |
-
$finder->in(__DIR__)
|
529 |
-
->directories()
|
530 |
-
->name('Fixtures')
|
531 |
-
->contains('abc');
|
532 |
-
$this->assertIterator(array(), $finder);
|
533 |
-
}
|
534 |
-
|
535 |
-
/**
|
536 |
-
* @dataProvider getAdaptersTestData
|
537 |
-
*/
|
538 |
-
public function testNotContainsOnDirectory(Adapter\AdapterInterface $adapter)
|
539 |
-
{
|
540 |
-
$finder = $this->buildFinder($adapter);
|
541 |
-
$finder->in(__DIR__)
|
542 |
-
->directories()
|
543 |
-
->name('Fixtures')
|
544 |
-
->notContains('abc');
|
545 |
-
$this->assertIterator(array(), $finder);
|
546 |
-
}
|
547 |
-
|
548 |
-
/**
|
549 |
-
* Searching in multiple locations involves AppendIterator which does an unnecessary rewind which leaves FilterIterator
|
550 |
-
* with inner FilesystemIterator in an invalid state.
|
551 |
-
*
|
552 |
-
* @see https://bugs.php.net/bug.php?id=49104
|
553 |
-
*
|
554 |
-
* @dataProvider getAdaptersTestData
|
555 |
-
*/
|
556 |
-
public function testMultipleLocations(Adapter\AdapterInterface $adapter)
|
557 |
-
{
|
558 |
-
$locations = array(
|
559 |
-
self::$tmpDir.'/',
|
560 |
-
self::$tmpDir.'/toto/',
|
561 |
-
);
|
562 |
-
|
563 |
-
// it is expected that there are test.py test.php in the tmpDir
|
564 |
-
$finder = $this->buildFinder($adapter);
|
565 |
-
$finder->in($locations)->depth('< 1')->name('test.php');
|
566 |
-
|
567 |
-
$this->assertCount(1, $finder);
|
568 |
-
}
|
569 |
-
|
570 |
-
/**
|
571 |
-
* Iterator keys must be the file pathname.
|
572 |
-
*
|
573 |
-
* @dataProvider getAdaptersTestData
|
574 |
-
*/
|
575 |
-
public function testIteratorKeys(Adapter\AdapterInterface $adapter)
|
576 |
-
{
|
577 |
-
$finder = $this->buildFinder($adapter)->in(self::$tmpDir);
|
578 |
-
foreach ($finder as $key => $file) {
|
579 |
-
$this->assertEquals($file->getPathname(), $key);
|
580 |
-
}
|
581 |
-
}
|
582 |
-
|
583 |
-
/**
|
584 |
-
* @dataProvider getAdaptersTestData
|
585 |
-
*/
|
586 |
-
public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag(Adapter\AdapterInterface $adapter)
|
587 |
-
{
|
588 |
-
$finder = $this->buildFinder($adapter);
|
589 |
-
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
|
590 |
-
->path('/^dir/');
|
591 |
-
|
592 |
-
$expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir',
|
593 |
-
'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat',);
|
594 |
-
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
|
595 |
-
}
|
596 |
-
|
597 |
-
public function testAdaptersOrdering()
|
598 |
-
{
|
599 |
-
$finder = Finder::create()
|
600 |
-
->removeAdapters()
|
601 |
-
->addAdapter(new FakeAdapter\NamedAdapter('a'), 0)
|
602 |
-
->addAdapter(new FakeAdapter\NamedAdapter('b'), -50)
|
603 |
-
->addAdapter(new FakeAdapter\NamedAdapter('c'), 50)
|
604 |
-
->addAdapter(new FakeAdapter\NamedAdapter('d'), -25)
|
605 |
-
->addAdapter(new FakeAdapter\NamedAdapter('e'), 25);
|
606 |
-
|
607 |
-
$this->assertEquals(
|
608 |
-
array('c', 'e', 'a', 'd', 'b'),
|
609 |
-
array_map(function (Adapter\AdapterInterface $adapter) {
|
610 |
-
return $adapter->getName();
|
611 |
-
}, $finder->getAdapters())
|
612 |
-
);
|
613 |
-
}
|
614 |
-
|
615 |
-
public function testAdaptersChaining()
|
616 |
-
{
|
617 |
-
$iterator = new \ArrayIterator(array());
|
618 |
-
$filenames = $this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto'));
|
619 |
-
foreach ($filenames as $file) {
|
620 |
-
$iterator->append(new \Symfony\Component\Finder\SplFileInfo($file, null, null));
|
621 |
-
}
|
622 |
-
|
623 |
-
$finder = Finder::create()
|
624 |
-
->removeAdapters()
|
625 |
-
->addAdapter(new FakeAdapter\UnsupportedAdapter(), 3)
|
626 |
-
->addAdapter(new FakeAdapter\FailingAdapter(), 2)
|
627 |
-
->addAdapter(new FakeAdapter\DummyAdapter($iterator), 1);
|
628 |
-
|
629 |
-
$this->assertIterator($filenames, $finder->in(sys_get_temp_dir())->getIterator());
|
630 |
-
}
|
631 |
-
|
632 |
-
public function getAdaptersTestData()
|
633 |
-
{
|
634 |
-
return array_map(
|
635 |
-
function ($adapter) { return array($adapter); },
|
636 |
-
$this->getValidAdapters()
|
637 |
-
);
|
638 |
-
}
|
639 |
-
|
640 |
-
public function getContainsTestData()
|
641 |
-
{
|
642 |
-
$tests = array(
|
643 |
-
array('', '', array()),
|
644 |
-
array('foo', 'bar', array()),
|
645 |
-
array('', 'foobar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')),
|
646 |
-
array('lorem ipsum dolor sit amet', 'foobar', array('lorem.txt')),
|
647 |
-
array('sit', 'bar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')),
|
648 |
-
array('dolor sit amet', '@^L@m', array('dolor.txt', 'ipsum.txt')),
|
649 |
-
array('/^lorem ipsum dolor sit amet$/m', 'foobar', array('lorem.txt')),
|
650 |
-
array('lorem', 'foobar', array('lorem.txt')),
|
651 |
-
array('', 'lorem', array('dolor.txt', 'ipsum.txt')),
|
652 |
-
array('ipsum dolor sit amet', '/^IPSUM/m', array('lorem.txt')),
|
653 |
-
);
|
654 |
-
|
655 |
-
return $this->buildTestData($tests);
|
656 |
-
}
|
657 |
-
|
658 |
-
public function getRegexNameTestData()
|
659 |
-
{
|
660 |
-
$tests = array(
|
661 |
-
array('~.+\\.p.+~i'),
|
662 |
-
array('~t.*s~i'),
|
663 |
-
);
|
664 |
-
|
665 |
-
return $this->buildTestData($tests);
|
666 |
-
}
|
667 |
-
|
668 |
-
/**
|
669 |
-
* @dataProvider getTestPathData
|
670 |
-
*/
|
671 |
-
public function testPath(Adapter\AdapterInterface $adapter, $matchPatterns, $noMatchPatterns, array $expected)
|
672 |
-
{
|
673 |
-
$finder = $this->buildFinder($adapter);
|
674 |
-
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
|
675 |
-
->path($matchPatterns)
|
676 |
-
->notPath($noMatchPatterns);
|
677 |
-
|
678 |
-
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
|
679 |
-
}
|
680 |
-
|
681 |
-
public function testAdapterSelection()
|
682 |
-
{
|
683 |
-
// test that by default, PhpAdapter is selected
|
684 |
-
$adapters = Finder::create()->getAdapters();
|
685 |
-
$this->assertTrue($adapters[0] instanceof Adapter\PhpAdapter);
|
686 |
-
|
687 |
-
// test another adapter selection
|
688 |
-
$adapters = Finder::create()->setAdapter('gnu_find')->getAdapters();
|
689 |
-
$this->assertTrue($adapters[0] instanceof Adapter\GnuFindAdapter);
|
690 |
-
|
691 |
-
// test that useBestAdapter method removes selection
|
692 |
-
$adapters = Finder::create()->useBestAdapter()->getAdapters();
|
693 |
-
$this->assertFalse($adapters[0] instanceof Adapter\PhpAdapter);
|
694 |
-
}
|
695 |
-
|
696 |
-
public function getTestPathData()
|
697 |
-
{
|
698 |
-
$tests = array(
|
699 |
-
array('', '', array()),
|
700 |
-
array('/^A\/B\/C/', '/C$/',
|
701 |
-
array('A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat'),
|
702 |
-
),
|
703 |
-
array('/^A\/B/', 'foobar',
|
704 |
-
array(
|
705 |
-
'A'.DIRECTORY_SEPARATOR.'B',
|
706 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
707 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
708 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
709 |
-
),
|
710 |
-
),
|
711 |
-
array('A/B/C', 'foobar',
|
712 |
-
array(
|
713 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
714 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
715 |
-
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
716 |
-
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
|
717 |
-
),
|
718 |
-
),
|
719 |
-
array('A/B', 'foobar',
|
720 |
-
array(
|
721 |
-
//dirs
|
722 |
-
'A'.DIRECTORY_SEPARATOR.'B',
|
723 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
724 |
-
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B',
|
725 |
-
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
726 |
-
//files
|
727 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
728 |
-
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
729 |
-
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat.copy',
|
730 |
-
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
|
731 |
-
),
|
732 |
-
),
|
733 |
-
array('/^with space\//', 'foobar',
|
734 |
-
array(
|
735 |
-
'with space'.DIRECTORY_SEPARATOR.'foo.txt',
|
736 |
-
),
|
737 |
-
),
|
738 |
-
);
|
739 |
-
|
740 |
-
return $this->buildTestData($tests);
|
741 |
-
}
|
742 |
-
|
743 |
-
/**
|
744 |
-
* @dataProvider getAdaptersTestData
|
745 |
-
*/
|
746 |
-
public function testAccessDeniedException(Adapter\AdapterInterface $adapter)
|
747 |
-
{
|
748 |
-
if ('\\' === DIRECTORY_SEPARATOR) {
|
749 |
-
$this->markTestSkipped('chmod is not supported on Windows');
|
750 |
-
}
|
751 |
-
|
752 |
-
$finder = $this->buildFinder($adapter);
|
753 |
-
$finder->files()->in(self::$tmpDir);
|
754 |
-
|
755 |
-
// make 'foo' directory non-readable
|
756 |
-
$testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
|
757 |
-
chmod($testDir, 0333);
|
758 |
-
|
759 |
-
if (false === $couldRead = is_readable($testDir)) {
|
760 |
-
try {
|
761 |
-
$this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
|
762 |
-
$this->fail('Finder should throw an exception when opening a non-readable directory.');
|
763 |
-
} catch (\Exception $e) {
|
764 |
-
$expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException';
|
765 |
-
if ($e instanceof \PHPUnit_Framework_ExpectationFailedException) {
|
766 |
-
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
|
767 |
-
}
|
768 |
-
|
769 |
-
$this->assertInstanceOf($expectedExceptionClass, $e);
|
770 |
-
}
|
771 |
-
}
|
772 |
-
|
773 |
-
// restore original permissions
|
774 |
-
chmod($testDir, 0777);
|
775 |
-
clearstatcache($testDir);
|
776 |
-
|
777 |
-
if ($couldRead) {
|
778 |
-
$this->markTestSkipped('could read test files while test requires unreadable');
|
779 |
-
}
|
780 |
-
}
|
781 |
-
|
782 |
-
/**
|
783 |
-
* @dataProvider getAdaptersTestData
|
784 |
-
*/
|
785 |
-
public function testIgnoredAccessDeniedException(Adapter\AdapterInterface $adapter)
|
786 |
-
{
|
787 |
-
if ('\\' === DIRECTORY_SEPARATOR) {
|
788 |
-
$this->markTestSkipped('chmod is not supported on Windows');
|
789 |
-
}
|
790 |
-
|
791 |
-
$finder = $this->buildFinder($adapter);
|
792 |
-
$finder->files()->ignoreUnreadableDirs()->in(self::$tmpDir);
|
793 |
-
|
794 |
-
// make 'foo' directory non-readable
|
795 |
-
$testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
|
796 |
-
chmod($testDir, 0333);
|
797 |
-
|
798 |
-
if (false === ($couldRead = is_readable($testDir))) {
|
799 |
-
$this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator());
|
800 |
-
}
|
801 |
-
|
802 |
-
// restore original permissions
|
803 |
-
chmod($testDir, 0777);
|
804 |
-
clearstatcache($testDir);
|
805 |
-
|
806 |
-
if ($couldRead) {
|
807 |
-
$this->markTestSkipped('could read test files while test requires unreadable');
|
808 |
-
}
|
809 |
-
}
|
810 |
-
|
811 |
-
private function buildTestData(array $tests)
|
812 |
-
{
|
813 |
-
$data = array();
|
814 |
-
foreach ($this->getValidAdapters() as $adapter) {
|
815 |
-
foreach ($tests as $test) {
|
816 |
-
$data[] = array_merge(array($adapter), $test);
|
817 |
-
}
|
818 |
-
}
|
819 |
-
|
820 |
-
return $data;
|
821 |
-
}
|
822 |
-
|
823 |
-
private function buildFinder(Adapter\AdapterInterface $adapter)
|
824 |
-
{
|
825 |
-
return Finder::create()
|
826 |
-
->removeAdapters()
|
827 |
-
->addAdapter($adapter);
|
828 |
-
}
|
829 |
-
|
830 |
-
private function getValidAdapters()
|
831 |
-
{
|
832 |
-
return array_filter(
|
833 |
-
array(
|
834 |
-
new Adapter\BsdFindAdapter(),
|
835 |
-
new Adapter\GnuFindAdapter(),
|
836 |
-
new Adapter\PhpAdapter(),
|
837 |
-
),
|
838 |
-
function (Adapter\AdapterInterface $adapter) {
|
839 |
-
return $adapter->isSupported();
|
840 |
-
}
|
841 |
-
);
|
842 |
-
}
|
843 |
-
|
844 |
-
/**
|
845 |
-
* Searching in multiple locations with sub directories involves
|
846 |
-
* AppendIterator which does an unnecessary rewind which leaves
|
847 |
-
* FilterIterator with inner FilesystemIterator in an invalid state.
|
848 |
-
*
|
849 |
-
* @see https://bugs.php.net/bug.php?id=49104
|
850 |
-
*/
|
851 |
-
public function testMultipleLocationsWithSubDirectories()
|
852 |
-
{
|
853 |
-
$locations = array(
|
854 |
-
__DIR__.'/Fixtures/one',
|
855 |
-
self::$tmpDir.DIRECTORY_SEPARATOR.'toto',
|
856 |
-
);
|
857 |
-
|
858 |
-
$finder = new Finder();
|
859 |
-
$finder->in($locations)->depth('< 10')->name('*.neon');
|
860 |
-
|
861 |
-
$expected = array(
|
862 |
-
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
|
863 |
-
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
|
864 |
-
);
|
865 |
-
|
866 |
-
$this->assertIterator($expected, $finder);
|
867 |
-
$this->assertIteratorInForeach($expected, $finder);
|
868 |
-
}
|
869 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/C/abc.dat
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/ab.dat
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/a.dat
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/ab.dat.copy
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/a.dat.copy
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/dolor.txt
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
dolor sit amet
|
2 |
-
DOLOR SIT AMET
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/ipsum.txt
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
ipsum dolor sit amet
|
2 |
-
IPSUM DOLOR SIT AMET
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/lorem.txt
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
lorem ipsum dolor sit amet
|
2 |
-
LOREM IPSUM DOLOR SIT AMET
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/a
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/c.neon
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/d.neon
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/with space/foo.txt
DELETED
File without changes
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\CustomFilterIterator;
|
15 |
-
|
16 |
-
class CustomFilterIteratorTest extends IteratorTestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @expectedException \InvalidArgumentException
|
20 |
-
*/
|
21 |
-
public function testWithInvalidFilter()
|
22 |
-
{
|
23 |
-
new CustomFilterIterator(new Iterator(), array('foo'));
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* @dataProvider getAcceptData
|
28 |
-
*/
|
29 |
-
public function testAccept($filters, $expected)
|
30 |
-
{
|
31 |
-
$inner = new Iterator(array('test.php', 'test.py', 'foo.php'));
|
32 |
-
|
33 |
-
$iterator = new CustomFilterIterator($inner, $filters);
|
34 |
-
|
35 |
-
$this->assertIterator($expected, $iterator);
|
36 |
-
}
|
37 |
-
|
38 |
-
public function getAcceptData()
|
39 |
-
{
|
40 |
-
return array(
|
41 |
-
array(array(function (\SplFileInfo $fileinfo) { return false; }), array()),
|
42 |
-
array(array(function (\SplFileInfo $fileinfo) { return preg_match('/^test/', $fileinfo) > 0; }), array('test.php', 'test.py')),
|
43 |
-
array(array('is_dir'), array()),
|
44 |
-
);
|
45 |
-
}
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
|
15 |
-
use Symfony\Component\Finder\Comparator\DateComparator;
|
16 |
-
|
17 |
-
class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* @dataProvider getAcceptData
|
21 |
-
*/
|
22 |
-
public function testAccept($size, $expected)
|
23 |
-
{
|
24 |
-
$files = self::$files;
|
25 |
-
$files[] = self::toAbsolute('doesnotexist');
|
26 |
-
$inner = new Iterator($files);
|
27 |
-
|
28 |
-
$iterator = new DateRangeFilterIterator($inner, $size);
|
29 |
-
|
30 |
-
$this->assertIterator($expected, $iterator);
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getAcceptData()
|
34 |
-
{
|
35 |
-
$since20YearsAgo = array(
|
36 |
-
'.git',
|
37 |
-
'test.py',
|
38 |
-
'foo',
|
39 |
-
'foo/bar.tmp',
|
40 |
-
'test.php',
|
41 |
-
'toto',
|
42 |
-
'.bar',
|
43 |
-
'.foo',
|
44 |
-
'.foo/.bar',
|
45 |
-
'foo bar',
|
46 |
-
'.foo/bar',
|
47 |
-
);
|
48 |
-
|
49 |
-
$since2MonthsAgo = array(
|
50 |
-
'.git',
|
51 |
-
'test.py',
|
52 |
-
'foo',
|
53 |
-
'toto',
|
54 |
-
'.bar',
|
55 |
-
'.foo',
|
56 |
-
'.foo/.bar',
|
57 |
-
'foo bar',
|
58 |
-
'.foo/bar',
|
59 |
-
);
|
60 |
-
|
61 |
-
$untilLastMonth = array(
|
62 |
-
'foo/bar.tmp',
|
63 |
-
'test.php',
|
64 |
-
);
|
65 |
-
|
66 |
-
return array(
|
67 |
-
array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)),
|
68 |
-
array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)),
|
69 |
-
array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)),
|
70 |
-
);
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
DELETED
@@ -1,80 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
|
15 |
-
|
16 |
-
class DepthRangeFilterIteratorTest extends RealIteratorTestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getAcceptData
|
20 |
-
*/
|
21 |
-
public function testAccept($minDepth, $maxDepth, $expected)
|
22 |
-
{
|
23 |
-
$inner = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
|
24 |
-
|
25 |
-
$iterator = new DepthRangeFilterIterator($inner, $minDepth, $maxDepth);
|
26 |
-
|
27 |
-
$actual = array_keys(iterator_to_array($iterator));
|
28 |
-
sort($expected);
|
29 |
-
sort($actual);
|
30 |
-
$this->assertEquals($expected, $actual);
|
31 |
-
}
|
32 |
-
|
33 |
-
public function getAcceptData()
|
34 |
-
{
|
35 |
-
$lessThan1 = array(
|
36 |
-
'.git',
|
37 |
-
'test.py',
|
38 |
-
'foo',
|
39 |
-
'test.php',
|
40 |
-
'toto',
|
41 |
-
'.foo',
|
42 |
-
'.bar',
|
43 |
-
'foo bar',
|
44 |
-
);
|
45 |
-
|
46 |
-
$lessThanOrEqualTo1 = array(
|
47 |
-
'.git',
|
48 |
-
'test.py',
|
49 |
-
'foo',
|
50 |
-
'foo/bar.tmp',
|
51 |
-
'test.php',
|
52 |
-
'toto',
|
53 |
-
'.foo',
|
54 |
-
'.foo/.bar',
|
55 |
-
'.bar',
|
56 |
-
'foo bar',
|
57 |
-
'.foo/bar',
|
58 |
-
);
|
59 |
-
|
60 |
-
$graterThanOrEqualTo1 = array(
|
61 |
-
'foo/bar.tmp',
|
62 |
-
'.foo/.bar',
|
63 |
-
'.foo/bar',
|
64 |
-
);
|
65 |
-
|
66 |
-
$equalTo1 = array(
|
67 |
-
'foo/bar.tmp',
|
68 |
-
'.foo/.bar',
|
69 |
-
'.foo/bar',
|
70 |
-
);
|
71 |
-
|
72 |
-
return array(
|
73 |
-
array(0, 0, $this->toAbsolute($lessThan1)),
|
74 |
-
array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)),
|
75 |
-
array(2, PHP_INT_MAX, array()),
|
76 |
-
array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)),
|
77 |
-
array(1, 1, $this->toAbsolute($equalTo1)),
|
78 |
-
);
|
79 |
-
}
|
80 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
|
15 |
-
use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
|
16 |
-
|
17 |
-
class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* @dataProvider getAcceptData
|
21 |
-
*/
|
22 |
-
public function testAccept($directories, $expected)
|
23 |
-
{
|
24 |
-
$inner = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
|
25 |
-
|
26 |
-
$iterator = new ExcludeDirectoryFilterIterator($inner, $directories);
|
27 |
-
|
28 |
-
$this->assertIterator($expected, $iterator);
|
29 |
-
}
|
30 |
-
|
31 |
-
public function getAcceptData()
|
32 |
-
{
|
33 |
-
$foo = array(
|
34 |
-
'.bar',
|
35 |
-
'.foo',
|
36 |
-
'.foo/.bar',
|
37 |
-
'.foo/bar',
|
38 |
-
'.git',
|
39 |
-
'test.py',
|
40 |
-
'test.php',
|
41 |
-
'toto',
|
42 |
-
'foo bar',
|
43 |
-
);
|
44 |
-
|
45 |
-
$fo = array(
|
46 |
-
'.bar',
|
47 |
-
'.foo',
|
48 |
-
'.foo/.bar',
|
49 |
-
'.foo/bar',
|
50 |
-
'.git',
|
51 |
-
'test.py',
|
52 |
-
'foo',
|
53 |
-
'foo/bar.tmp',
|
54 |
-
'test.php',
|
55 |
-
'toto',
|
56 |
-
'foo bar',
|
57 |
-
);
|
58 |
-
|
59 |
-
return array(
|
60 |
-
array(array('foo'), $this->toAbsolute($foo)),
|
61 |
-
array(array('fo'), $this->toAbsolute($fo)),
|
62 |
-
);
|
63 |
-
}
|
64 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\FilePathsIterator;
|
15 |
-
|
16 |
-
class FilePathsIteratorTest extends RealIteratorTestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getSubPathData
|
20 |
-
*/
|
21 |
-
public function testSubPath($baseDir, array $paths, array $subPaths, array $subPathnames)
|
22 |
-
{
|
23 |
-
$iterator = new FilePathsIterator($paths, $baseDir);
|
24 |
-
|
25 |
-
foreach ($iterator as $index => $file) {
|
26 |
-
$this->assertEquals($paths[$index], $file->getPathname());
|
27 |
-
$this->assertEquals($subPaths[$index], $iterator->getSubPath());
|
28 |
-
$this->assertEquals($subPathnames[$index], $iterator->getSubPathname());
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
public function getSubPathData()
|
33 |
-
{
|
34 |
-
$tmpDir = sys_get_temp_dir().'/symfony_finder';
|
35 |
-
|
36 |
-
return array(
|
37 |
-
array(
|
38 |
-
$tmpDir,
|
39 |
-
array( // paths
|
40 |
-
$tmpDir.DIRECTORY_SEPARATOR.'.git' => $tmpDir.DIRECTORY_SEPARATOR.'.git',
|
41 |
-
$tmpDir.DIRECTORY_SEPARATOR.'test.py' => $tmpDir.DIRECTORY_SEPARATOR.'test.py',
|
42 |
-
$tmpDir.DIRECTORY_SEPARATOR.'foo' => $tmpDir.DIRECTORY_SEPARATOR.'foo',
|
43 |
-
$tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp',
|
44 |
-
$tmpDir.DIRECTORY_SEPARATOR.'test.php' => $tmpDir.DIRECTORY_SEPARATOR.'test.php',
|
45 |
-
$tmpDir.DIRECTORY_SEPARATOR.'toto' => $tmpDir.DIRECTORY_SEPARATOR.'toto',
|
46 |
-
),
|
47 |
-
array( // subPaths
|
48 |
-
$tmpDir.DIRECTORY_SEPARATOR.'.git' => '',
|
49 |
-
$tmpDir.DIRECTORY_SEPARATOR.'test.py' => '',
|
50 |
-
$tmpDir.DIRECTORY_SEPARATOR.'foo' => '',
|
51 |
-
$tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => 'foo',
|
52 |
-
$tmpDir.DIRECTORY_SEPARATOR.'test.php' => '',
|
53 |
-
$tmpDir.DIRECTORY_SEPARATOR.'toto' => '',
|
54 |
-
),
|
55 |
-
array( // subPathnames
|
56 |
-
$tmpDir.DIRECTORY_SEPARATOR.'.git' => '.git',
|
57 |
-
$tmpDir.DIRECTORY_SEPARATOR.'test.py' => 'test.py',
|
58 |
-
$tmpDir.DIRECTORY_SEPARATOR.'foo' => 'foo',
|
59 |
-
$tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => 'foo'.DIRECTORY_SEPARATOR.'bar.tmp',
|
60 |
-
$tmpDir.DIRECTORY_SEPARATOR.'test.php' => 'test.php',
|
61 |
-
$tmpDir.DIRECTORY_SEPARATOR.'toto' => 'toto',
|
62 |
-
),
|
63 |
-
),
|
64 |
-
);
|
65 |
-
}
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\FileTypeFilterIterator;
|
15 |
-
|
16 |
-
class FileTypeFilterIteratorTest extends RealIteratorTestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getAcceptData
|
20 |
-
*/
|
21 |
-
public function testAccept($mode, $expected)
|
22 |
-
{
|
23 |
-
$inner = new InnerTypeIterator(self::$files);
|
24 |
-
|
25 |
-
$iterator = new FileTypeFilterIterator($inner, $mode);
|
26 |
-
|
27 |
-
$this->assertIterator($expected, $iterator);
|
28 |
-
}
|
29 |
-
|
30 |
-
public function getAcceptData()
|
31 |
-
{
|
32 |
-
$onlyFiles = array(
|
33 |
-
'test.py',
|
34 |
-
'foo/bar.tmp',
|
35 |
-
'test.php',
|
36 |
-
'.bar',
|
37 |
-
'.foo/.bar',
|
38 |
-
'.foo/bar',
|
39 |
-
'foo bar',
|
40 |
-
);
|
41 |
-
|
42 |
-
$onlyDirectories = array(
|
43 |
-
'.git',
|
44 |
-
'foo',
|
45 |
-
'toto',
|
46 |
-
'.foo',
|
47 |
-
);
|
48 |
-
|
49 |
-
return array(
|
50 |
-
array(FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)),
|
51 |
-
array(FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)),
|
52 |
-
);
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
class InnerTypeIterator extends \ArrayIterator
|
57 |
-
{
|
58 |
-
public function current()
|
59 |
-
{
|
60 |
-
return new \SplFileInfo(parent::current());
|
61 |
-
}
|
62 |
-
|
63 |
-
public function isFile()
|
64 |
-
{
|
65 |
-
return $this->current()->isFile();
|
66 |
-
}
|
67 |
-
|
68 |
-
public function isDir()
|
69 |
-
{
|
70 |
-
return $this->current()->isDir();
|
71 |
-
}
|
72 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php
DELETED
@@ -1,86 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
|
15 |
-
|
16 |
-
class FilecontentFilterIteratorTest extends IteratorTestCase
|
17 |
-
{
|
18 |
-
public function testAccept()
|
19 |
-
{
|
20 |
-
$inner = new MockFileListIterator(array('test.txt'));
|
21 |
-
$iterator = new FilecontentFilterIterator($inner, array(), array());
|
22 |
-
$this->assertIterator(array('test.txt'), $iterator);
|
23 |
-
}
|
24 |
-
|
25 |
-
public function testDirectory()
|
26 |
-
{
|
27 |
-
$inner = new MockFileListIterator(array('directory'));
|
28 |
-
$iterator = new FilecontentFilterIterator($inner, array('directory'), array());
|
29 |
-
$this->assertIterator(array(), $iterator);
|
30 |
-
}
|
31 |
-
|
32 |
-
public function testUnreadableFile()
|
33 |
-
{
|
34 |
-
$inner = new MockFileListIterator(array('file r-'));
|
35 |
-
$iterator = new FilecontentFilterIterator($inner, array('file r-'), array());
|
36 |
-
$this->assertIterator(array(), $iterator);
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @dataProvider getTestFilterData
|
41 |
-
*/
|
42 |
-
public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray)
|
43 |
-
{
|
44 |
-
$iterator = new FilecontentFilterIterator($inner, $matchPatterns, $noMatchPatterns);
|
45 |
-
$this->assertIterator($resultArray, $iterator);
|
46 |
-
}
|
47 |
-
|
48 |
-
public function getTestFilterData()
|
49 |
-
{
|
50 |
-
$inner = new MockFileListIterator();
|
51 |
-
|
52 |
-
$inner[] = new MockSplFileInfo(array(
|
53 |
-
'name' => 'a.txt',
|
54 |
-
'contents' => 'Lorem ipsum...',
|
55 |
-
'type' => 'file',
|
56 |
-
'mode' => 'r+', )
|
57 |
-
);
|
58 |
-
|
59 |
-
$inner[] = new MockSplFileInfo(array(
|
60 |
-
'name' => 'b.yml',
|
61 |
-
'contents' => 'dolor sit...',
|
62 |
-
'type' => 'file',
|
63 |
-
'mode' => 'r+', )
|
64 |
-
);
|
65 |
-
|
66 |
-
$inner[] = new MockSplFileInfo(array(
|
67 |
-
'name' => 'some/other/dir/third.php',
|
68 |
-
'contents' => 'amet...',
|
69 |
-
'type' => 'file',
|
70 |
-
'mode' => 'r+', )
|
71 |
-
);
|
72 |
-
|
73 |
-
$inner[] = new MockSplFileInfo(array(
|
74 |
-
'name' => 'unreadable-file.txt',
|
75 |
-
'contents' => false,
|
76 |
-
'type' => 'file',
|
77 |
-
'mode' => 'r+', )
|
78 |
-
);
|
79 |
-
|
80 |
-
return array(
|
81 |
-
array($inner, array('.'), array(), array('a.txt', 'b.yml', 'some/other/dir/third.php')),
|
82 |
-
array($inner, array('ipsum'), array(), array('a.txt')),
|
83 |
-
array($inner, array('i', 'amet'), array('Lorem', 'amet'), array('b.yml')),
|
84 |
-
);
|
85 |
-
}
|
86 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
|
15 |
-
|
16 |
-
class FilenameFilterIteratorTest extends IteratorTestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getAcceptData
|
20 |
-
*/
|
21 |
-
public function testAccept($matchPatterns, $noMatchPatterns, $expected)
|
22 |
-
{
|
23 |
-
$inner = new InnerNameIterator(array('test.php', 'test.py', 'foo.php'));
|
24 |
-
|
25 |
-
$iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns);
|
26 |
-
|
27 |
-
$this->assertIterator($expected, $iterator);
|
28 |
-
}
|
29 |
-
|
30 |
-
public function getAcceptData()
|
31 |
-
{
|
32 |
-
return array(
|
33 |
-
array(array('test.*'), array(), array('test.php', 'test.py')),
|
34 |
-
array(array(), array('test.*'), array('foo.php')),
|
35 |
-
array(array('*.php'), array('test.*'), array('foo.php')),
|
36 |
-
array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.py')),
|
37 |
-
array(array('/\.php$/'), array(), array('test.php', 'foo.php')),
|
38 |
-
array(array(), array('/\.php$/'), array('test.py')),
|
39 |
-
);
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
class InnerNameIterator extends \ArrayIterator
|
44 |
-
{
|
45 |
-
public function current()
|
46 |
-
{
|
47 |
-
return new \SplFileInfo(parent::current());
|
48 |
-
}
|
49 |
-
|
50 |
-
public function getFilename()
|
51 |
-
{
|
52 |
-
return parent::current();
|
53 |
-
}
|
54 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* @author Alex Bogomazov
|
16 |
-
*/
|
17 |
-
class FilterIteratorTest extends RealIteratorTestCase
|
18 |
-
{
|
19 |
-
public function testFilterFilesystemIterators()
|
20 |
-
{
|
21 |
-
$i = new \FilesystemIterator($this->toAbsolute());
|
22 |
-
|
23 |
-
// it is expected that there are test.py test.php in the tmpDir
|
24 |
-
$i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i));
|
25 |
-
$i->expects($this->any())
|
26 |
-
->method('accept')
|
27 |
-
->will($this->returnCallback(function () use ($i) {
|
28 |
-
return (bool) preg_match('/\.php/', (string) $i->current());
|
29 |
-
})
|
30 |
-
);
|
31 |
-
|
32 |
-
$c = 0;
|
33 |
-
foreach ($i as $item) {
|
34 |
-
$c++;
|
35 |
-
}
|
36 |
-
|
37 |
-
$this->assertEquals(1, $c);
|
38 |
-
|
39 |
-
$i->rewind();
|
40 |
-
|
41 |
-
$c = 0;
|
42 |
-
foreach ($i as $item) {
|
43 |
-
$c++;
|
44 |
-
}
|
45 |
-
|
46 |
-
// This would fail with \FilterIterator but works with Symfony\Component\Finder\Iterator\FilterIterator
|
47 |
-
// see https://bugs.php.net/bug.php?id=49104
|
48 |
-
$this->assertEquals(1, $c);
|
49 |
-
}
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/Iterator.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
class Iterator implements \Iterator
|
15 |
-
{
|
16 |
-
protected $values = array();
|
17 |
-
|
18 |
-
public function __construct(array $values = array())
|
19 |
-
{
|
20 |
-
foreach ($values as $value) {
|
21 |
-
$this->attach(new \SplFileInfo($value));
|
22 |
-
}
|
23 |
-
$this->rewind();
|
24 |
-
}
|
25 |
-
|
26 |
-
public function attach(\SplFileInfo $fileinfo)
|
27 |
-
{
|
28 |
-
$this->values[] = $fileinfo;
|
29 |
-
}
|
30 |
-
|
31 |
-
public function rewind()
|
32 |
-
{
|
33 |
-
reset($this->values);
|
34 |
-
}
|
35 |
-
|
36 |
-
public function valid()
|
37 |
-
{
|
38 |
-
return false !== $this->current();
|
39 |
-
}
|
40 |
-
|
41 |
-
public function next()
|
42 |
-
{
|
43 |
-
next($this->values);
|
44 |
-
}
|
45 |
-
|
46 |
-
public function current()
|
47 |
-
{
|
48 |
-
return current($this->values);
|
49 |
-
}
|
50 |
-
|
51 |
-
public function key()
|
52 |
-
{
|
53 |
-
return key($this->values);
|
54 |
-
}
|
55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase
|
15 |
-
{
|
16 |
-
protected function assertIterator($expected, \Traversable $iterator)
|
17 |
-
{
|
18 |
-
// set iterator_to_array $use_key to false to avoid values merge
|
19 |
-
// this made FinderTest::testAppendWithAnArray() failed with GnuFinderAdapter
|
20 |
-
$values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false));
|
21 |
-
|
22 |
-
$expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected);
|
23 |
-
|
24 |
-
sort($values);
|
25 |
-
sort($expected);
|
26 |
-
|
27 |
-
$this->assertEquals($expected, array_values($values));
|
28 |
-
}
|
29 |
-
|
30 |
-
protected function assertOrderedIterator($expected, \Traversable $iterator)
|
31 |
-
{
|
32 |
-
$values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator));
|
33 |
-
|
34 |
-
$this->assertEquals($expected, array_values($values));
|
35 |
-
}
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Same as assertOrderedIterator, but checks the order of groups of
|
39 |
-
* array elements.
|
40 |
-
*
|
41 |
-
* @param array $expected - an array of arrays. For any two subarrays
|
42 |
-
* $a and $b such that $a goes before $b in $expected, the method
|
43 |
-
* asserts that any element of $a goes before any element of $b
|
44 |
-
* in the sequence generated by $iterator
|
45 |
-
* @param \Traversable $iterator
|
46 |
-
*/
|
47 |
-
protected function assertOrderedIteratorForGroups($expected, \Traversable $iterator)
|
48 |
-
{
|
49 |
-
$values = array_values(array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)));
|
50 |
-
|
51 |
-
foreach ($expected as $subarray) {
|
52 |
-
$temp = array();
|
53 |
-
while (count($values) && count($temp) < count($subarray)) {
|
54 |
-
array_push($temp, array_shift($values));
|
55 |
-
}
|
56 |
-
sort($temp);
|
57 |
-
sort($subarray);
|
58 |
-
$this->assertEquals($subarray, $temp);
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Same as IteratorTestCase::assertIterator with foreach usage.
|
64 |
-
*
|
65 |
-
* @param array $expected
|
66 |
-
* @param \Traversable $iterator
|
67 |
-
*/
|
68 |
-
protected function assertIteratorInForeach($expected, \Traversable $iterator)
|
69 |
-
{
|
70 |
-
$values = array();
|
71 |
-
foreach ($iterator as $file) {
|
72 |
-
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
|
73 |
-
$values[] = $file->getPathname();
|
74 |
-
}
|
75 |
-
|
76 |
-
sort($values);
|
77 |
-
sort($expected);
|
78 |
-
|
79 |
-
$this->assertEquals($expected, array_values($values));
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Same as IteratorTestCase::assertOrderedIterator with foreach usage.
|
84 |
-
*
|
85 |
-
* @param array $expected
|
86 |
-
* @param \Traversable $iterator
|
87 |
-
*/
|
88 |
-
protected function assertOrderedIteratorInForeach($expected, \Traversable $iterator)
|
89 |
-
{
|
90 |
-
$values = array();
|
91 |
-
foreach ($iterator as $file) {
|
92 |
-
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
|
93 |
-
$values[] = $file->getPathname();
|
94 |
-
}
|
95 |
-
|
96 |
-
$this->assertEquals($expected, array_values($values));
|
97 |
-
}
|
98 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
class MockFileListIterator extends \ArrayIterator
|
15 |
-
{
|
16 |
-
public function __construct(array $filesArray = array())
|
17 |
-
{
|
18 |
-
$files = array_map(function ($file) { return new MockSplFileInfo($file); }, $filesArray);
|
19 |
-
parent::__construct($files);
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php
DELETED
@@ -1,134 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
class MockSplFileInfo extends \SplFileInfo
|
15 |
-
{
|
16 |
-
const TYPE_DIRECTORY = 1;
|
17 |
-
const TYPE_FILE = 2;
|
18 |
-
const TYPE_UNKNOWN = 3;
|
19 |
-
|
20 |
-
private $contents = null;
|
21 |
-
private $mode = null;
|
22 |
-
private $type = null;
|
23 |
-
private $relativePath = null;
|
24 |
-
private $relativePathname = null;
|
25 |
-
|
26 |
-
public function __construct($param)
|
27 |
-
{
|
28 |
-
if (is_string($param)) {
|
29 |
-
parent::__construct($param);
|
30 |
-
} elseif (is_array($param)) {
|
31 |
-
$defaults = array(
|
32 |
-
'name' => 'file.txt',
|
33 |
-
'contents' => null,
|
34 |
-
'mode' => null,
|
35 |
-
'type' => null,
|
36 |
-
'relativePath' => null,
|
37 |
-
'relativePathname' => null,
|
38 |
-
);
|
39 |
-
$defaults = array_merge($defaults, $param);
|
40 |
-
parent::__construct($defaults['name']);
|
41 |
-
$this->setContents($defaults['contents']);
|
42 |
-
$this->setMode($defaults['mode']);
|
43 |
-
$this->setType($defaults['type']);
|
44 |
-
$this->setRelativePath($defaults['relativePath']);
|
45 |
-
$this->setRelativePathname($defaults['relativePathname']);
|
46 |
-
} else {
|
47 |
-
throw new \RuntimeException(sprintf('Incorrect parameter "%s"', $param));
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
public function isFile()
|
52 |
-
{
|
53 |
-
if (null === $this->type) {
|
54 |
-
return preg_match('/file/', $this->getFilename());
|
55 |
-
};
|
56 |
-
|
57 |
-
return self::TYPE_FILE === $this->type;
|
58 |
-
}
|
59 |
-
|
60 |
-
public function isDir()
|
61 |
-
{
|
62 |
-
if (null === $this->type) {
|
63 |
-
return preg_match('/directory/', $this->getFilename());
|
64 |
-
}
|
65 |
-
|
66 |
-
return self::TYPE_DIRECTORY === $this->type;
|
67 |
-
}
|
68 |
-
|
69 |
-
public function isReadable()
|
70 |
-
{
|
71 |
-
if (null === $this->mode) {
|
72 |
-
return preg_match('/r\+/', $this->getFilename());
|
73 |
-
}
|
74 |
-
|
75 |
-
return preg_match('/r\+/', $this->mode);
|
76 |
-
}
|
77 |
-
|
78 |
-
public function getContents()
|
79 |
-
{
|
80 |
-
return $this->contents;
|
81 |
-
}
|
82 |
-
|
83 |
-
public function setContents($contents)
|
84 |
-
{
|
85 |
-
$this->contents = $contents;
|
86 |
-
}
|
87 |
-
|
88 |
-
public function setMode($mode)
|
89 |
-
{
|
90 |
-
$this->mode = $mode;
|
91 |
-
}
|
92 |
-
|
93 |
-
public function setType($type)
|
94 |
-
{
|
95 |
-
if (is_string($type)) {
|
96 |
-
switch ($type) {
|
97 |
-
case 'directory':
|
98 |
-
$this->type = self::TYPE_DIRECTORY;
|
99 |
-
case 'd':
|
100 |
-
$this->type = self::TYPE_DIRECTORY;
|
101 |
-
break;
|
102 |
-
case 'file':
|
103 |
-
$this->type = self::TYPE_FILE;
|
104 |
-
case 'f':
|
105 |
-
$this->type = self::TYPE_FILE;
|
106 |
-
break;
|
107 |
-
default:
|
108 |
-
$this->type = self::TYPE_UNKNOWN;
|
109 |
-
}
|
110 |
-
} else {
|
111 |
-
$this->type = $type;
|
112 |
-
}
|
113 |
-
}
|
114 |
-
|
115 |
-
public function setRelativePath($relativePath)
|
116 |
-
{
|
117 |
-
$this->relativePath = $relativePath;
|
118 |
-
}
|
119 |
-
|
120 |
-
public function setRelativePathname($relativePathname)
|
121 |
-
{
|
122 |
-
$this->relativePathname = $relativePathname;
|
123 |
-
}
|
124 |
-
|
125 |
-
public function getRelativePath()
|
126 |
-
{
|
127 |
-
return $this->relativePath;
|
128 |
-
}
|
129 |
-
|
130 |
-
public function getRelativePathname()
|
131 |
-
{
|
132 |
-
return $this->relativePathname;
|
133 |
-
}
|
134 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\MultiplePcreFilterIterator;
|
15 |
-
|
16 |
-
class MultiplePcreFilterIteratorTest extends \PHPUnit_Framework_TestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getIsRegexFixtures
|
20 |
-
*/
|
21 |
-
public function testIsRegex($string, $isRegex, $message)
|
22 |
-
{
|
23 |
-
$testIterator = new TestMultiplePcreFilterIterator();
|
24 |
-
$this->assertEquals($isRegex, $testIterator->isRegex($string), $message);
|
25 |
-
}
|
26 |
-
|
27 |
-
public function getIsRegexFixtures()
|
28 |
-
{
|
29 |
-
return array(
|
30 |
-
array('foo', false, 'string'),
|
31 |
-
array(' foo ', false, '" " is not a valid delimiter'),
|
32 |
-
array('\\foo\\', false, '"\\" is not a valid delimiter'),
|
33 |
-
array('afooa', false, '"a" is not a valid delimiter'),
|
34 |
-
array('//', false, 'the pattern should contain at least 1 character'),
|
35 |
-
array('/a/', true, 'valid regex'),
|
36 |
-
array('/foo/', true, 'valid regex'),
|
37 |
-
array('/foo/i', true, 'valid regex with a single modifier'),
|
38 |
-
array('/foo/imsxu', true, 'valid regex with multiple modifiers'),
|
39 |
-
array('#foo#', true, '"#" is a valid delimiter'),
|
40 |
-
array('{foo}', true, '"{,}" is a valid delimiter pair'),
|
41 |
-
array('*foo.*', false, '"*" is not considered as a valid delimiter'),
|
42 |
-
array('?foo.?', false, '"?" is not considered as a valid delimiter'),
|
43 |
-
);
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
class TestMultiplePcreFilterIterator extends MultiplePcreFilterIterator
|
48 |
-
{
|
49 |
-
public function __construct()
|
50 |
-
{
|
51 |
-
}
|
52 |
-
|
53 |
-
public function accept()
|
54 |
-
{
|
55 |
-
throw new \BadFunctionCallException('Not implemented');
|
56 |
-
}
|
57 |
-
|
58 |
-
public function isRegex($str)
|
59 |
-
{
|
60 |
-
return parent::isRegex($str);
|
61 |
-
}
|
62 |
-
|
63 |
-
public function toRegex($str)
|
64 |
-
{
|
65 |
-
throw new \BadFunctionCallException('Not implemented');
|
66 |
-
}
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/PathFilterIteratorTest.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\PathFilterIterator;
|
15 |
-
|
16 |
-
class PathFilterIteratorTest extends IteratorTestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getTestFilterData
|
20 |
-
*/
|
21 |
-
public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray)
|
22 |
-
{
|
23 |
-
$iterator = new PathFilterIterator($inner, $matchPatterns, $noMatchPatterns);
|
24 |
-
$this->assertIterator($resultArray, $iterator);
|
25 |
-
}
|
26 |
-
|
27 |
-
public function getTestFilterData()
|
28 |
-
{
|
29 |
-
$inner = new MockFileListIterator();
|
30 |
-
|
31 |
-
//PATH: A/B/C/abc.dat
|
32 |
-
$inner[] = new MockSplFileInfo(array(
|
33 |
-
'name' => 'abc.dat',
|
34 |
-
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
35 |
-
));
|
36 |
-
|
37 |
-
//PATH: A/B/ab.dat
|
38 |
-
$inner[] = new MockSplFileInfo(array(
|
39 |
-
'name' => 'ab.dat',
|
40 |
-
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
41 |
-
));
|
42 |
-
|
43 |
-
//PATH: A/a.dat
|
44 |
-
$inner[] = new MockSplFileInfo(array(
|
45 |
-
'name' => 'a.dat',
|
46 |
-
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'a.dat',
|
47 |
-
));
|
48 |
-
|
49 |
-
//PATH: copy/A/B/C/abc.dat.copy
|
50 |
-
$inner[] = new MockSplFileInfo(array(
|
51 |
-
'name' => 'abc.dat.copy',
|
52 |
-
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
53 |
-
));
|
54 |
-
|
55 |
-
//PATH: copy/A/B/ab.dat.copy
|
56 |
-
$inner[] = new MockSplFileInfo(array(
|
57 |
-
'name' => 'ab.dat.copy',
|
58 |
-
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
59 |
-
));
|
60 |
-
|
61 |
-
//PATH: copy/A/a.dat.copy
|
62 |
-
$inner[] = new MockSplFileInfo(array(
|
63 |
-
'name' => 'a.dat.copy',
|
64 |
-
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'a.dat',
|
65 |
-
));
|
66 |
-
|
67 |
-
return array(
|
68 |
-
array($inner, array('/^A/'), array(), array('abc.dat', 'ab.dat', 'a.dat')),
|
69 |
-
array($inner, array('/^A\/B/'), array(), array('abc.dat', 'ab.dat')),
|
70 |
-
array($inner, array('/^A\/B\/C/'), array(), array('abc.dat')),
|
71 |
-
array($inner, array('/A\/B\/C/'), array(), array('abc.dat', 'abc.dat.copy')),
|
72 |
-
|
73 |
-
array($inner, array('A'), array(), array('abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
|
74 |
-
array($inner, array('A/B'), array(), array('abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy')),
|
75 |
-
array($inner, array('A/B/C'), array(), array('abc.dat', 'abc.dat.copy')),
|
76 |
-
|
77 |
-
array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
|
78 |
-
array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
|
79 |
-
array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
|
80 |
-
|
81 |
-
);
|
82 |
-
}
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
abstract class RealIteratorTestCase extends IteratorTestCase
|
15 |
-
{
|
16 |
-
protected static $tmpDir;
|
17 |
-
protected static $files;
|
18 |
-
|
19 |
-
public static function setUpBeforeClass()
|
20 |
-
{
|
21 |
-
self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
|
22 |
-
|
23 |
-
self::$files = array(
|
24 |
-
'.git/',
|
25 |
-
'.foo/',
|
26 |
-
'.foo/.bar',
|
27 |
-
'.foo/bar',
|
28 |
-
'.bar',
|
29 |
-
'test.py',
|
30 |
-
'foo/',
|
31 |
-
'foo/bar.tmp',
|
32 |
-
'test.php',
|
33 |
-
'toto/',
|
34 |
-
'foo bar',
|
35 |
-
);
|
36 |
-
|
37 |
-
self::$files = self::toAbsolute(self::$files);
|
38 |
-
|
39 |
-
if (is_dir(self::$tmpDir)) {
|
40 |
-
self::tearDownAfterClass();
|
41 |
-
} else {
|
42 |
-
mkdir(self::$tmpDir);
|
43 |
-
}
|
44 |
-
|
45 |
-
foreach (self::$files as $file) {
|
46 |
-
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
|
47 |
-
mkdir($file);
|
48 |
-
} else {
|
49 |
-
touch($file);
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
file_put_contents(self::toAbsolute('test.php'), str_repeat(' ', 800));
|
54 |
-
file_put_contents(self::toAbsolute('test.py'), str_repeat(' ', 2000));
|
55 |
-
|
56 |
-
touch(self::toAbsolute('foo/bar.tmp'), strtotime('2005-10-15'));
|
57 |
-
touch(self::toAbsolute('test.php'), strtotime('2005-10-15'));
|
58 |
-
}
|
59 |
-
|
60 |
-
public static function tearDownAfterClass()
|
61 |
-
{
|
62 |
-
foreach (array_reverse(self::$files) as $file) {
|
63 |
-
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
|
64 |
-
@rmdir($file);
|
65 |
-
} else {
|
66 |
-
@unlink($file);
|
67 |
-
}
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
protected static function toAbsolute($files = null)
|
72 |
-
{
|
73 |
-
/*
|
74 |
-
* Without the call to setUpBeforeClass() property can be null.
|
75 |
-
*/
|
76 |
-
if (!self::$tmpDir) {
|
77 |
-
self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
|
78 |
-
}
|
79 |
-
|
80 |
-
if (is_array($files)) {
|
81 |
-
$f = array();
|
82 |
-
foreach ($files as $file) {
|
83 |
-
if (is_array($file)) {
|
84 |
-
$f[] = self::toAbsolute($file);
|
85 |
-
} else {
|
86 |
-
$f[] = self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $file);
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
return $f;
|
91 |
-
}
|
92 |
-
|
93 |
-
if (is_string($files)) {
|
94 |
-
return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files);
|
95 |
-
}
|
96 |
-
|
97 |
-
return self::$tmpDir;
|
98 |
-
}
|
99 |
-
|
100 |
-
protected static function toAbsoluteFixtures($files)
|
101 |
-
{
|
102 |
-
$f = array();
|
103 |
-
foreach ($files as $file) {
|
104 |
-
$f[] = realpath(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.$file);
|
105 |
-
}
|
106 |
-
|
107 |
-
return $f;
|
108 |
-
}
|
109 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
|
15 |
-
|
16 |
-
class RecursiveDirectoryIteratorTest extends IteratorTestCase
|
17 |
-
{
|
18 |
-
/**
|
19 |
-
* @dataProvider getPaths
|
20 |
-
*
|
21 |
-
* @param string $path
|
22 |
-
* @param bool $seekable
|
23 |
-
* @param array $contains
|
24 |
-
* @param string $message
|
25 |
-
*/
|
26 |
-
public function testRewind($path, $seekable, $contains, $message = null)
|
27 |
-
{
|
28 |
-
try {
|
29 |
-
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
|
30 |
-
} catch (\UnexpectedValueException $e) {
|
31 |
-
$this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
|
32 |
-
}
|
33 |
-
|
34 |
-
$i->rewind();
|
35 |
-
|
36 |
-
$this->assertTrue(true, $message);
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @dataProvider getPaths
|
41 |
-
*
|
42 |
-
* @param string $path
|
43 |
-
* @param bool $seekable
|
44 |
-
* @param array $contains
|
45 |
-
* @param string $message
|
46 |
-
*/
|
47 |
-
public function testSeek($path, $seekable, $contains, $message = null)
|
48 |
-
{
|
49 |
-
try {
|
50 |
-
$i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS);
|
51 |
-
} catch (\UnexpectedValueException $e) {
|
52 |
-
$this->markTestSkipped(sprintf('Unsupported stream "%s".', $path));
|
53 |
-
}
|
54 |
-
|
55 |
-
$actual = array();
|
56 |
-
|
57 |
-
$i->seek(0);
|
58 |
-
$actual[] = $i->getPathname();
|
59 |
-
|
60 |
-
$i->seek(1);
|
61 |
-
$actual[] = $i->getPathname();
|
62 |
-
|
63 |
-
$i->seek(2);
|
64 |
-
$actual[] = $i->getPathname();
|
65 |
-
|
66 |
-
$this->assertEquals($contains, $actual);
|
67 |
-
}
|
68 |
-
|
69 |
-
public function getPaths()
|
70 |
-
{
|
71 |
-
$data = array();
|
72 |
-
|
73 |
-
// ftp
|
74 |
-
$contains = array(
|
75 |
-
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README',
|
76 |
-
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'index.html',
|
77 |
-
'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub',
|
78 |
-
);
|
79 |
-
$data[] = array('ftp://ftp.mozilla.org/', false, $contains);
|
80 |
-
|
81 |
-
return $data;
|
82 |
-
}
|
83 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
|
15 |
-
use Symfony\Component\Finder\Comparator\NumberComparator;
|
16 |
-
|
17 |
-
class SizeRangeFilterIteratorTest extends RealIteratorTestCase
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* @dataProvider getAcceptData
|
21 |
-
*/
|
22 |
-
public function testAccept($size, $expected)
|
23 |
-
{
|
24 |
-
$inner = new InnerSizeIterator(self::$files);
|
25 |
-
|
26 |
-
$iterator = new SizeRangeFilterIterator($inner, $size);
|
27 |
-
|
28 |
-
$this->assertIterator($expected, $iterator);
|
29 |
-
}
|
30 |
-
|
31 |
-
public function getAcceptData()
|
32 |
-
{
|
33 |
-
$lessThan1KGreaterThan05K = array(
|
34 |
-
'.foo',
|
35 |
-
'.git',
|
36 |
-
'foo',
|
37 |
-
'test.php',
|
38 |
-
'toto',
|
39 |
-
);
|
40 |
-
|
41 |
-
return array(
|
42 |
-
array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)),
|
43 |
-
);
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
class InnerSizeIterator extends \ArrayIterator
|
48 |
-
{
|
49 |
-
public function current()
|
50 |
-
{
|
51 |
-
return new \SplFileInfo(parent::current());
|
52 |
-
}
|
53 |
-
|
54 |
-
public function getFilename()
|
55 |
-
{
|
56 |
-
return parent::current();
|
57 |
-
}
|
58 |
-
|
59 |
-
public function isFile()
|
60 |
-
{
|
61 |
-
return $this->current()->isFile();
|
62 |
-
}
|
63 |
-
|
64 |
-
public function getSize()
|
65 |
-
{
|
66 |
-
return $this->current()->getSize();
|
67 |
-
}
|
68 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php
DELETED
@@ -1,169 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of the Symfony package.
|
5 |
-
*
|
6 |
-
* (c) Fabien Potencier <fabien@symfony.com>
|
7 |
-
*
|
8 |
-
* For the full copyright and license information, please view the LICENSE
|
9 |
-
* file that was distributed with this source code.
|
10 |
-
*/
|
11 |
-
|
12 |
-
namespace Symfony\Component\Finder\Tests\Iterator;
|
13 |
-
|
14 |
-
use Symfony\Component\Finder\Iterator\SortableIterator;
|
15 |
-
|
16 |
-
class SortableIteratorTest extends RealIteratorTestCase
|
17 |
-
{
|
18 |
-
public function testConstructor()
|
19 |
-
{
|
20 |
-
try {
|
21 |
-
new SortableIterator(new Iterator(array()), 'foobar');
|
22 |
-
$this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid');
|
23 |
-
} catch (\Exception $e) {
|
24 |
-
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @dataProvider getAcceptData
|
30 |
-
*/
|
31 |
-
public function testAccept($mode, $expected)
|
32 |
-
{
|
33 |
-
if (!is_callable($mode)) {
|
34 |
-
switch ($mode) {
|
35 |
-
case SortableIterator::SORT_BY_ACCESSED_TIME :
|
36 |
-
file_get_contents(self::toAbsolute('.git'));
|
37 |
-
sleep(1);
|
38 |
-
file_get_contents(self::toAbsolute('.bar'));
|
39 |
-
break;
|
40 |
-
case SortableIterator::SORT_BY_CHANGED_TIME :
|
41 |
-
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
42 |
-
sleep(1);
|
43 |
-
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
44 |
-
break;
|
45 |
-
case SortableIterator::SORT_BY_MODIFIED_TIME :
|
46 |
-
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
47 |
-
sleep(1);
|
48 |
-
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
49 |
-
break;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
$inner = new Iterator(self::$files);
|
54 |
-
|
55 |
-
$iterator = new SortableIterator($inner, $mode);
|
56 |
-
|
57 |
-
if ($mode === SortableIterator::SORT_BY_ACCESSED_TIME
|
58 |
-
|| $mode === SortableIterator::SORT_BY_CHANGED_TIME
|
59 |
-
|| $mode === SortableIterator::SORT_BY_MODIFIED_TIME) {
|
60 |
-
$this->assertOrderedIteratorForGroups($expected, $iterator);
|
61 |
-
} else {
|
62 |
-
$this->assertOrderedIterator($expected, $iterator);
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
public function getAcceptData()
|
67 |
-
{
|
68 |
-
$sortByName = array(
|
69 |
-
'.bar',
|
70 |
-
'.foo',
|
71 |
-
'.foo/.bar',
|
72 |
-
'.foo/bar',
|
73 |
-
'.git',
|
74 |
-
'foo',
|
75 |
-
'foo bar',
|
76 |
-
'foo/bar.tmp',
|
77 |
-
'test.php',
|
78 |
-
'test.py',
|
79 |
-
'toto',
|
80 |
-
);
|
81 |
-
|
82 |
-
$sortByType = array(
|
83 |
-
'.foo',
|
84 |
-
'.git',
|
85 |
-
'foo',
|
86 |
-
'toto',
|
87 |
-
'.bar',
|
88 |
-
'.foo/.bar',
|
89 |
-
'.foo/bar',
|
90 |
-
'foo bar',
|
91 |
-
'foo/bar.tmp',
|
92 |
-
'test.php',
|
93 |
-
'test.py',
|
94 |
-
);
|
95 |
-
|
96 |
-
$customComparison = array(
|
97 |
-
'.bar',
|
98 |
-
'.foo',
|
99 |
-
'.foo/.bar',
|
100 |
-
'.foo/bar',
|
101 |
-
'.git',
|
102 |
-
'foo',
|
103 |
-
'foo bar',
|
104 |
-
'foo/bar.tmp',
|
105 |
-
'test.php',
|
106 |
-
'test.py',
|
107 |
-
'toto',
|
108 |
-
);
|
109 |
-
|
110 |
-
$sortByAccessedTime = array(
|
111 |
-
// For these two files the access time was set to 2005-10-15
|
112 |
-
array('foo/bar.tmp', 'test.php'),
|
113 |
-
// These files were created more or less at the same time
|
114 |
-
array(
|
115 |
-
'.git',
|
116 |
-
'.foo',
|
117 |
-
'.foo/.bar',
|
118 |
-
'.foo/bar',
|
119 |
-
'test.py',
|
120 |
-
'foo',
|
121 |
-
'toto',
|
122 |
-
'foo bar',
|
123 |
-
),
|
124 |
-
// This file was accessed after sleeping for 1 sec
|
125 |
-
array('.bar'),
|
126 |
-
);
|
127 |
-
|
128 |
-
$sortByChangedTime = array(
|
129 |
-
array(
|
130 |
-
'.git',
|
131 |
-
'.foo',
|
132 |
-
'.foo/.bar',
|
133 |
-
'.foo/bar',
|
134 |
-
'.bar',
|
135 |
-
'foo',
|
136 |
-
'foo/bar.tmp',
|
137 |
-
'toto',
|
138 |
-
'foo bar',
|
139 |
-
),
|
140 |
-
array('test.php'),
|
141 |
-
array('test.py'),
|
142 |
-
);
|
143 |
-
|
144 |
-
$sortByModifiedTime = array(
|
145 |
-
array(
|
146 |
-
'.git',
|
147 |
-
'.foo',
|
148 |
-
'.foo/.bar',
|
149 |
-
'.foo/bar',
|
150 |
-
'.bar',
|
151 |
-
'foo',
|
152 |
-
'foo/bar.tmp',
|
153 |
-
'toto',
|
154 |
-
'foo bar',
|
155 |
-
),
|
156 |
-
array('test.php'),
|
157 |
-
array('test.py'),
|
158 |
-
);
|
159 |
-
|
160 |
-
return array(
|
161 |
-
array(SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)),
|
162 |
-
array(SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)),
|
163 |
-
array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)),
|
164 |
-
array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)),
|
165 |
-
array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)),
|
166 |
-
array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }, $this->toAbsolute($customComparison)),
|
167 |
-
);
|
168 |
-
}
|
169 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|