diff options
Diffstat (limited to 'Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests')
44 files changed, 0 insertions, 3050 deletions
diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php deleted file mode 100644 index bf59844..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/ComparatorTest.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Comparator; - -use Symfony\Component\Finder\Comparator\Comparator; - -class ComparatorTest extends \PHPUnit_Framework_TestCase -{ - public function testGetSetOperator() - { - $comparator = new Comparator(); - try { - $comparator->setOperator('foo'); - $this->fail('->setOperator() throws an \InvalidArgumentException if the operator is not valid.'); - } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.'); - } - - $comparator = new Comparator(); - $comparator->setOperator('>'); - $this->assertEquals('>', $comparator->getOperator(), '->getOperator() returns the current operator'); - } - - public function testGetSetTarget() - { - $comparator = new Comparator(); - $comparator->setTarget(8); - $this->assertEquals(8, $comparator->getTarget(), '->getTarget() returns the target'); - } - - /** - * @dataProvider getTestData - */ - public function testTest($operator, $target, $match, $noMatch) - { - $c = new Comparator(); - $c->setOperator($operator); - $c->setTarget($target); - - foreach ($match as $m) { - $this->assertTrue($c->test($m), '->test() tests a string against the expression'); - } - - foreach ($noMatch as $m) { - $this->assertFalse($c->test($m), '->test() tests a string against the expression'); - } - } - - public function getTestData() - { - return array( - array('<', '1000', array('500', '999'), array('1000', '1500')), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php deleted file mode 100644 index 2739126..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/DateComparatorTest.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Comparator; - -use Symfony\Component\Finder\Comparator\DateComparator; - -class DateComparatorTest extends \PHPUnit_Framework_TestCase -{ - public function testConstructor() - { - try { - new DateComparator('foobar'); - $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); - } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); - } - - try { - new DateComparator(''); - $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); - } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); - } - } - - /** - * @dataProvider getTestData - */ - public function testTest($test, $match, $noMatch) - { - $c = new DateComparator($test); - - foreach ($match as $m) { - $this->assertTrue($c->test($m), '->test() tests a string against the expression'); - } - - foreach ($noMatch as $m) { - $this->assertFalse($c->test($m), '->test() tests a string against the expression'); - } - } - - public function getTestData() - { - return array( - array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), - array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), - array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), - array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), - array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), - array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), - array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php deleted file mode 100644 index 8284d07..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Comparator/NumberComparatorTest.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Comparator; - -use Symfony\Component\Finder\Comparator\NumberComparator; - -class NumberComparatorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getConstructorTestData - */ - public function testConstructor($successes, $failures) - { - foreach ($successes as $s) { - new NumberComparator($s); - } - - foreach ($failures as $f) { - try { - new NumberComparator($f); - $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); - } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); - } - } - } - - /** - * @dataProvider getTestData - */ - public function testTest($test, $match, $noMatch) - { - $c = new NumberComparator($test); - - foreach ($match as $m) { - $this->assertTrue($c->test($m), '->test() tests a string against the expression'); - } - - foreach ($noMatch as $m) { - $this->assertFalse($c->test($m), '->test() tests a string against the expression'); - } - } - - public function getTestData() - { - return array( - array('< 1000', array('500', '999'), array('1000', '1500')), - - array('< 1K', array('500', '999'), array('1000', '1500')), - array('<1k', array('500', '999'), array('1000', '1500')), - array(' < 1 K ', array('500', '999'), array('1000', '1500')), - array('<= 1K', array('1000'), array('1001')), - array('> 1K', array('1001'), array('1000')), - array('>= 1K', array('1000'), array('999')), - - array('< 1KI', array('500', '1023'), array('1024', '1500')), - array('<= 1KI', array('1024'), array('1025')), - array('> 1KI', array('1025'), array('1024')), - array('>= 1KI', array('1024'), array('1023')), - - array('1KI', array('1024'), array('1023', '1025')), - array('==1KI', array('1024'), array('1023', '1025')), - - array('==1m', array('1000000'), array('999999', '1000001')), - array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)), - - array('==1g', array('1000000000'), array('999999999', '1000000001')), - array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)), - - array('!= 1000', array('500', '999'), array('1000')), - ); - } - - public function getConstructorTestData() - { - return array( - array( - array( - '1', '0', - '3.5', '33.55', '123.456', '123456.78', - '.1', '.123', - '.0', '0.0', - '1.', '0.', '123.', - '==1', '!=1', '<1', '>1', '<=1', '>=1', - '==1k', '==1ki', '==1m', '==1mi', '==1g', '==1gi', - '1k', '1ki', '1m', '1mi', '1g', '1gi', - ), - array( - false, null, '', - ' ', 'foobar', - '=1', '===1', - '0 . 1', '123 .45', '234. 567', - '..', '.0.', '0.1.2', - ), - ), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/ExpressionTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/ExpressionTest.php deleted file mode 100644 index 4254a45..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/ExpressionTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Expression; - -use Symfony\Component\Finder\Expression\Expression; - -class ExpressionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getTypeGuesserData - */ - public function testTypeGuesser($expr, $type) - { - $this->assertEquals($type, Expression::create($expr)->getType()); - } - - /** - * @dataProvider getCaseSensitiveData - */ - public function testCaseSensitive($expr, $isCaseSensitive) - { - $this->assertEquals($isCaseSensitive, Expression::create($expr)->isCaseSensitive()); - } - - /** - * @dataProvider getRegexRenderingData - */ - public function testRegexRendering($expr, $body) - { - $this->assertEquals($body, Expression::create($expr)->renderPattern()); - } - - public function getTypeGuesserData() - { - return array( - array('{foo}', Expression::TYPE_REGEX), - array('/foo/', Expression::TYPE_REGEX), - array('foo', Expression::TYPE_GLOB), - array('foo*', Expression::TYPE_GLOB), - ); - } - - public function getCaseSensitiveData() - { - return array( - array('{foo}m', true), - array('/foo/i', false), - array('foo*', true), - ); - } - - public function getRegexRenderingData() - { - return array( - array('{foo}m', 'foo'), - array('/foo/i', 'foo'), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/GlobTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/GlobTest.php deleted file mode 100644 index 9d4c3e5..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/GlobTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Expression; - -use Symfony\Component\Finder\Expression\Expression; - -class GlobTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getToRegexData - */ - public function testGlobToRegex($glob, $match, $noMatch) - { - foreach ($match as $m) { - $this->assertRegExp(Expression::create($glob)->getRegex()->render(), $m, '::toRegex() converts a glob to a regexp'); - } - - foreach ($noMatch as $m) { - $this->assertNotRegExp(Expression::create($glob)->getRegex()->render(), $m, '::toRegex() converts a glob to a regexp'); - } - } - - public function getToRegexData() - { - return array( - array('', array(''), array('f', '/')), - array('*', array('foo'), array('foo/', '/foo')), - array('foo.*', array('foo.php', 'foo.a', 'foo.'), array('fooo.php', 'foo.php/foo')), - array('fo?', array('foo', 'fot'), array('fooo', 'ffoo', 'fo/')), - array('fo{o,t}', array('foo', 'fot'), array('fob', 'fo/')), - array('foo(bar|foo)', array('foo(bar|foo)'), array('foobar', 'foofoo')), - array('foo,bar', array('foo,bar'), array('foo', 'bar')), - array('fo{o,\\,}', array('foo', 'fo,'), array()), - array('fo{o,\\\\}', array('foo', 'fo\\'), array()), - array('/foo', array('/foo'), array('foo')), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/RegexTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/RegexTest.php deleted file mode 100644 index 620ba10..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Expression/RegexTest.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Expression; - -use Symfony\Component\Finder\Expression\Expression; - -class RegexTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getHasFlagsData - */ - public function testHasFlags($regex, $start, $end) - { - $expr = new Expression($regex); - - $this->assertEquals($start, $expr->getRegex()->hasStartFlag()); - $this->assertEquals($end, $expr->getRegex()->hasEndFlag()); - } - - /** - * @dataProvider getHasJokersData - */ - public function testHasJokers($regex, $start, $end) - { - $expr = new Expression($regex); - - $this->assertEquals($start, $expr->getRegex()->hasStartJoker()); - $this->assertEquals($end, $expr->getRegex()->hasEndJoker()); - } - - /** - * @dataProvider getSetFlagsData - */ - public function testSetFlags($regex, $start, $end, $expected) - { - $expr = new Expression($regex); - $expr->getRegex()->setStartFlag($start)->setEndFlag($end); - - $this->assertEquals($expected, $expr->render()); - } - - /** - * @dataProvider getSetJokersData - */ - public function testSetJokers($regex, $start, $end, $expected) - { - $expr = new Expression($regex); - $expr->getRegex()->setStartJoker($start)->setEndJoker($end); - - $this->assertEquals($expected, $expr->render()); - } - - public function testOptions() - { - $expr = new Expression('~abc~is'); - $expr->getRegex()->removeOption('i')->addOption('m'); - - $this->assertEquals('~abc~sm', $expr->render()); - } - - public function testMixFlagsAndJokers() - { - $expr = new Expression('~^.*abc.*$~is'); - - $expr->getRegex()->setStartFlag(false)->setEndFlag(false)->setStartJoker(false)->setEndJoker(false); - $this->assertEquals('~abc~is', $expr->render()); - - $expr->getRegex()->setStartFlag(true)->setEndFlag(true)->setStartJoker(true)->setEndJoker(true); - $this->assertEquals('~^.*abc.*$~is', $expr->render()); - } - - /** - * @dataProvider getReplaceJokersTestData - */ - public function testReplaceJokers($regex, $expected) - { - $expr = new Expression($regex); - $expr = $expr->getRegex()->replaceJokers('@'); - - $this->assertEquals($expected, $expr->renderPattern()); - } - - public function getHasFlagsData() - { - return array( - array('~^abc~', true, false), - array('~abc$~', false, true), - array('~abc~', false, false), - array('~^abc$~', true, true), - array('~^abc\\$~', true, false), - ); - } - - public function getHasJokersData() - { - return array( - array('~.*abc~', true, false), - array('~abc.*~', false, true), - array('~abc~', false, false), - array('~.*abc.*~', true, true), - array('~.*abc\\.*~', true, false), - ); - } - - public function getSetFlagsData() - { - return array( - array('~abc~', true, false, '~^abc~'), - array('~abc~', false, true, '~abc$~'), - array('~abc~', false, false, '~abc~'), - array('~abc~', true, true, '~^abc$~'), - ); - } - - public function getSetJokersData() - { - return array( - array('~abc~', true, false, '~.*abc~'), - array('~abc~', false, true, '~abc.*~'), - array('~abc~', false, false, '~abc~'), - array('~abc~', true, true, '~.*abc.*~'), - ); - } - - public function getReplaceJokersTestData() - { - return array( - array('~.abc~', '@abc'), - array('~\\.abc~', '\\.abc'), - array('~\\\\.abc~', '\\\\@abc'), - array('~\\\\\\.abc~', '\\\\\\.abc'), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/DummyAdapter.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/DummyAdapter.php deleted file mode 100644 index 0cbae14..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/DummyAdapter.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\FakeAdapter; - -use Symfony\Component\Finder\Adapter\AbstractAdapter; - -/** - * @author Jean-François Simon <contact@jfsimon.fr> - */ -class DummyAdapter extends AbstractAdapter -{ - /** - * @var \Iterator - */ - private $iterator; - - /** - * @param \Iterator $iterator - */ - public function __construct(\Iterator $iterator) - { - $this->iterator = $iterator; - } - - /** - * {@inheritdoc} - */ - public function searchInDirectory($dir) - { - return $this->iterator; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'yes'; - } - - /** - * {@inheritdoc} - */ - protected function canBeUsed() - { - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/FailingAdapter.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/FailingAdapter.php deleted file mode 100644 index 6e6ed24..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/FailingAdapter.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\FakeAdapter; - -use Symfony\Component\Finder\Adapter\AbstractAdapter; -use Symfony\Component\Finder\Exception\AdapterFailureException; - -/** - * @author Jean-François Simon <contact@jfsimon.fr> - */ -class FailingAdapter extends AbstractAdapter -{ - /** - * {@inheritdoc} - */ - public function searchInDirectory($dir) - { - throw new AdapterFailureException($this); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'failing'; - } - - /** - * {@inheritdoc} - */ - protected function canBeUsed() - { - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/NamedAdapter.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/NamedAdapter.php deleted file mode 100644 index 5a260b0..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/NamedAdapter.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\FakeAdapter; - -use Symfony\Component\Finder\Adapter\AbstractAdapter; - -/** - * @author Jean-François Simon <contact@jfsimon.fr> - */ -class NamedAdapter extends AbstractAdapter -{ - /** - * @var string - */ - private $name; - - /** - * @param string $name - */ - public function __construct($name) - { - $this->name = $name; - } - - /** - * {@inheritdoc} - */ - public function searchInDirectory($dir) - { - return new \ArrayIterator(array()); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - protected function canBeUsed() - { - return true; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/UnsupportedAdapter.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/UnsupportedAdapter.php deleted file mode 100644 index 1f91b98..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FakeAdapter/UnsupportedAdapter.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\FakeAdapter; - -use Symfony\Component\Finder\Adapter\AbstractAdapter; - -/** - * @author Jean-François Simon <contact@jfsimon.fr> - */ -class UnsupportedAdapter extends AbstractAdapter -{ - /** - * {@inheritdoc} - */ - public function searchInDirectory($dir) - { - return new \ArrayIterator(array()); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'unsupported'; - } - - /** - * {@inheritdoc} - */ - protected function canBeUsed() - { - return false; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php deleted file mode 100644 index fe0984d..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/FinderTest.php +++ /dev/null @@ -1,869 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests; - -use Symfony\Component\Finder\Finder; -use Symfony\Component\Finder\Adapter; - -class FinderTest extends Iterator\RealIteratorTestCase -{ - public function testCreate() - { - $this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testDirectories($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->directories()); - $this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->directories(); - $finder->files(); - $finder->directories(); - $this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testFiles($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->files()); - $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->files(); - $finder->directories(); - $finder->files(); - $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testDepth($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->depth('< 1')); - $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->depth('<= 0')); - $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->depth('>= 1')); - $this->assertIterator($this->toAbsolute(array('foo/bar.tmp')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->depth('< 1')->depth('>= 1'); - $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testName($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->name('*.php')); - $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->name('test.ph*'); - $finder->name('test.py'); - $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->name('~^test~i'); - $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->name('~\\.php$~i'); - $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->name('test.p{hp,y}'); - $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testNotName($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->notName('*.php')); - $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->notName('*.php'); - $finder->notName('*.py'); - $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->name('test.ph*'); - $finder->name('test.py'); - $finder->notName('*.php'); - $finder->notName('*.py'); - $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->name('test.ph*'); - $finder->name('test.py'); - $finder->notName('*.p{hp,y}'); - $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getRegexNameTestData - * - * @group regexName - */ - public function testRegexName($adapter, $regex) - { - $finder = $this->buildFinder($adapter); - $finder->name($regex); - $this->assertIterator($this->toAbsolute(array('test.py', 'test.php')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testSize($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->files()->size('< 1K')->size('> 500')); - $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testDate($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->files()->date('until last month')); - $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testExclude($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->exclude('foo')); - $this->assertIterator($this->toAbsolute(array('test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testIgnoreVCS($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false)); - $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false); - $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false)); - $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testIgnoreDotFiles($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false)); - $this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $finder->ignoreDotFiles(false)->ignoreDotFiles(false)->ignoreVCS(false); - $this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false)); - $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testSortByName($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->sortByName()); - $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testSortByType($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->sortByType()); - $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'toto', 'foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testSortByAccessedTime($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->sortByAccessedTime()); - $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testSortByChangedTime($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->sortByChangedTime()); - $this->assertIterator($this->toAbsolute(array('toto', 'test.py', 'test.php', 'foo/bar.tmp', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testSortByModifiedTime($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->sortByModifiedTime()); - $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testSort($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); })); - $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testFilter($adapter) - { - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->filter(function (\SplFileInfo $f) { return preg_match('/test/', $f) > 0; })); - $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testFollowLinks($adapter) - { - if ('\\' == DIRECTORY_SEPARATOR) { - return; - } - - $finder = $this->buildFinder($adapter); - $this->assertSame($finder, $finder->followLinks()); - $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testIn($adapter) - { - $finder = $this->buildFinder($adapter); - try { - $finder->in('foobar'); - $this->fail('->in() throws a \InvalidArgumentException if the directory does not exist'); - } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '->in() throws a \InvalidArgumentException if the directory does not exist'); - } - - $finder = $this->buildFinder($adapter); - $iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator(); - - $this->assertIterator(array(self::$tmpDir.DIRECTORY_SEPARATOR.'test.php', __DIR__.DIRECTORY_SEPARATOR.'FinderTest.php'), $iterator); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testInWithGlob($adapter) - { - $finder = $this->buildFinder($adapter); - $finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator(); - - $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder); - } - - /** - * @dataProvider getAdaptersTestData - * @expectedException \InvalidArgumentException - */ - public function testInWithNonDirectoryGlob($adapter) - { - $finder = $this->buildFinder($adapter); - $finder->in(__DIR__.'/Fixtures/A/a*'); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testInWithGlobBrace($adapter) - { - $finder = $this->buildFinder($adapter); - $finder->in(array(__DIR__.'/Fixtures/{A,copy/A}/B/C'))->getIterator(); - - $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testGetIterator($adapter) - { - $finder = $this->buildFinder($adapter); - try { - $finder->getIterator(); - $this->fail('->getIterator() throws a \LogicException if the in() method has not been called'); - } catch (\Exception $e) { - $this->assertInstanceOf('LogicException', $e, '->getIterator() throws a \LogicException if the in() method has not been called'); - } - - $finder = $this->buildFinder($adapter); - $dirs = array(); - foreach ($finder->directories()->in(self::$tmpDir) as $dir) { - $dirs[] = (string) $dir; - } - - $expected = $this->toAbsolute(array('foo', 'toto')); - - sort($dirs); - sort($expected); - - $this->assertEquals($expected, $dirs, 'implements the \IteratorAggregate interface'); - - $finder = $this->buildFinder($adapter); - $this->assertEquals(2, iterator_count($finder->directories()->in(self::$tmpDir)), 'implements the \IteratorAggregate interface'); - - $finder = $this->buildFinder($adapter); - $a = iterator_to_array($finder->directories()->in(self::$tmpDir)); - $a = array_values(array_map(function ($a) { return (string) $a; }, $a)); - sort($a); - $this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface'); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testRelativePath($adapter) - { - $finder = $this->buildFinder($adapter)->in(self::$tmpDir); - - $paths = array(); - - foreach ($finder as $file) { - $paths[] = $file->getRelativePath(); - } - - $ref = array('', '', '', '', 'foo', ''); - - sort($ref); - sort($paths); - - $this->assertEquals($ref, $paths); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testRelativePathname($adapter) - { - $finder = $this->buildFinder($adapter)->in(self::$tmpDir)->sortByName(); - - $paths = array(); - - foreach ($finder as $file) { - $paths[] = $file->getRelativePathname(); - } - - $ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar'); - - sort($paths); - sort($ref); - - $this->assertEquals($ref, $paths); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testAppendWithAFinder($adapter) - { - $finder = $this->buildFinder($adapter); - $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); - - $finder1 = $this->buildFinder($adapter); - $finder1->directories()->in(self::$tmpDir); - - $finder = $finder->append($finder1); - - $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testAppendWithAnArray($adapter) - { - $finder = $this->buildFinder($adapter); - $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); - - $finder->append($this->toAbsolute(array('foo', 'toto'))); - - $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator()); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testAppendReturnsAFinder($adapter) - { - $this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', $this->buildFinder($adapter)->append(array())); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testAppendDoesNotRequireIn($adapter) - { - $finder = $this->buildFinder($adapter); - $finder->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); - - $finder1 = Finder::create()->append($finder); - - $this->assertIterator(iterator_to_array($finder->getIterator()), $finder1->getIterator()); - } - - public function testCountDirectories() - { - $directory = Finder::create()->directories()->in(self::$tmpDir); - $i = 0; - - foreach ($directory as $dir) { - $i++; - } - - $this->assertCount($i, $directory); - } - - public function testCountFiles() - { - $files = Finder::create()->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $i = 0; - - foreach ($files as $file) { - $i++; - } - - $this->assertCount($i, $files); - } - - /** - * @expectedException \LogicException - */ - public function testCountWithoutIn() - { - $finder = Finder::create()->files(); - count($finder); - } - - /** - * @dataProvider getContainsTestData - * @group grep - */ - public function testContains($adapter, $matchPatterns, $noMatchPatterns, $expected) - { - $finder = $this->buildFinder($adapter); - $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures') - ->name('*.txt')->sortByName() - ->contains($matchPatterns) - ->notContains($noMatchPatterns); - - $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testContainsOnDirectory(Adapter\AdapterInterface $adapter) - { - $finder = $this->buildFinder($adapter); - $finder->in(__DIR__) - ->directories() - ->name('Fixtures') - ->contains('abc'); - $this->assertIterator(array(), $finder); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testNotContainsOnDirectory(Adapter\AdapterInterface $adapter) - { - $finder = $this->buildFinder($adapter); - $finder->in(__DIR__) - ->directories() - ->name('Fixtures') - ->notContains('abc'); - $this->assertIterator(array(), $finder); - } - - /** - * Searching in multiple locations involves AppendIterator which does an unnecessary rewind which leaves FilterIterator - * with inner FilesystemIterator in an invalid state. - * - * @see https://bugs.php.net/bug.php?id=49104 - * - * @dataProvider getAdaptersTestData - */ - public function testMultipleLocations(Adapter\AdapterInterface $adapter) - { - $locations = array( - self::$tmpDir.'/', - self::$tmpDir.'/toto/', - ); - - // it is expected that there are test.py test.php in the tmpDir - $finder = $this->buildFinder($adapter); - $finder->in($locations)->depth('< 1')->name('test.php'); - - $this->assertCount(1, $finder); - } - - /** - * Iterator keys must be the file pathname. - * - * @dataProvider getAdaptersTestData - */ - public function testIteratorKeys(Adapter\AdapterInterface $adapter) - { - $finder = $this->buildFinder($adapter)->in(self::$tmpDir); - foreach ($finder as $key => $file) { - $this->assertEquals($file->getPathname(), $key); - } - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag(Adapter\AdapterInterface $adapter) - { - $finder = $this->buildFinder($adapter); - $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s') - ->path('/^dir/'); - - $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', - 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat',); - $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); - } - - public function testAdaptersOrdering() - { - $finder = Finder::create() - ->removeAdapters() - ->addAdapter(new FakeAdapter\NamedAdapter('a'), 0) - ->addAdapter(new FakeAdapter\NamedAdapter('b'), -50) - ->addAdapter(new FakeAdapter\NamedAdapter('c'), 50) - ->addAdapter(new FakeAdapter\NamedAdapter('d'), -25) - ->addAdapter(new FakeAdapter\NamedAdapter('e'), 25); - - $this->assertEquals( - array('c', 'e', 'a', 'd', 'b'), - array_map(function (Adapter\AdapterInterface $adapter) { - return $adapter->getName(); - }, $finder->getAdapters()) - ); - } - - public function testAdaptersChaining() - { - $iterator = new \ArrayIterator(array()); - $filenames = $this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')); - foreach ($filenames as $file) { - $iterator->append(new \Symfony\Component\Finder\SplFileInfo($file, null, null)); - } - - $finder = Finder::create() - ->removeAdapters() - ->addAdapter(new FakeAdapter\UnsupportedAdapter(), 3) - ->addAdapter(new FakeAdapter\FailingAdapter(), 2) - ->addAdapter(new FakeAdapter\DummyAdapter($iterator), 1); - - $this->assertIterator($filenames, $finder->in(sys_get_temp_dir())->getIterator()); - } - - public function getAdaptersTestData() - { - return array_map( - function ($adapter) { return array($adapter); }, - $this->getValidAdapters() - ); - } - - public function getContainsTestData() - { - $tests = array( - array('', '', array()), - array('foo', 'bar', array()), - array('', 'foobar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')), - array('lorem ipsum dolor sit amet', 'foobar', array('lorem.txt')), - array('sit', 'bar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')), - array('dolor sit amet', '@^L@m', array('dolor.txt', 'ipsum.txt')), - array('/^lorem ipsum dolor sit amet$/m', 'foobar', array('lorem.txt')), - array('lorem', 'foobar', array('lorem.txt')), - array('', 'lorem', array('dolor.txt', 'ipsum.txt')), - array('ipsum dolor sit amet', '/^IPSUM/m', array('lorem.txt')), - ); - - return $this->buildTestData($tests); - } - - public function getRegexNameTestData() - { - $tests = array( - array('~.+\\.p.+~i'), - array('~t.*s~i'), - ); - - return $this->buildTestData($tests); - } - - /** - * @dataProvider getTestPathData - */ - public function testPath(Adapter\AdapterInterface $adapter, $matchPatterns, $noMatchPatterns, array $expected) - { - $finder = $this->buildFinder($adapter); - $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures') - ->path($matchPatterns) - ->notPath($noMatchPatterns); - - $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); - } - - public function testAdapterSelection() - { - // test that by default, PhpAdapter is selected - $adapters = Finder::create()->getAdapters(); - $this->assertTrue($adapters[0] instanceof Adapter\PhpAdapter); - - // test another adapter selection - $adapters = Finder::create()->setAdapter('gnu_find')->getAdapters(); - $this->assertTrue($adapters[0] instanceof Adapter\GnuFindAdapter); - - // test that useBestAdapter method removes selection - $adapters = Finder::create()->useBestAdapter()->getAdapters(); - $this->assertFalse($adapters[0] instanceof Adapter\PhpAdapter); - } - - public function getTestPathData() - { - $tests = array( - array('', '', array()), - array('/^A\/B\/C/', '/C$/', - array('A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat'), - ), - array('/^A\/B/', 'foobar', - array( - 'A'.DIRECTORY_SEPARATOR.'B', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', - ), - ), - array('A/B/C', 'foobar', - array( - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy', - ), - ), - array('A/B', 'foobar', - array( - //dirs - 'A'.DIRECTORY_SEPARATOR.'B', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - //files - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat.copy', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy', - ), - ), - array('/^with space\//', 'foobar', - array( - 'with space'.DIRECTORY_SEPARATOR.'foo.txt', - ), - ), - ); - - return $this->buildTestData($tests); - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testAccessDeniedException(Adapter\AdapterInterface $adapter) - { - if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('chmod is not supported on Windows'); - } - - $finder = $this->buildFinder($adapter); - $finder->files()->in(self::$tmpDir); - - // make 'foo' directory non-readable - $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo'; - chmod($testDir, 0333); - - if (false === $couldRead = is_readable($testDir)) { - try { - $this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator()); - $this->fail('Finder should throw an exception when opening a non-readable directory.'); - } catch (\Exception $e) { - $expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException'; - if ($e instanceof \PHPUnit_Framework_ExpectationFailedException) { - $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString())); - } - - $this->assertInstanceOf($expectedExceptionClass, $e); - } - } - - // restore original permissions - chmod($testDir, 0777); - clearstatcache($testDir); - - if ($couldRead) { - $this->markTestSkipped('could read test files while test requires unreadable'); - } - } - - /** - * @dataProvider getAdaptersTestData - */ - public function testIgnoredAccessDeniedException(Adapter\AdapterInterface $adapter) - { - if ('\\' === DIRECTORY_SEPARATOR) { - $this->markTestSkipped('chmod is not supported on Windows'); - } - - $finder = $this->buildFinder($adapter); - $finder->files()->ignoreUnreadableDirs()->in(self::$tmpDir); - - // make 'foo' directory non-readable - $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo'; - chmod($testDir, 0333); - - if (false === ($couldRead = is_readable($testDir))) { - $this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator()); - } - - // restore original permissions - chmod($testDir, 0777); - clearstatcache($testDir); - - if ($couldRead) { - $this->markTestSkipped('could read test files while test requires unreadable'); - } - } - - private function buildTestData(array $tests) - { - $data = array(); - foreach ($this->getValidAdapters() as $adapter) { - foreach ($tests as $test) { - $data[] = array_merge(array($adapter), $test); - } - } - - return $data; - } - - private function buildFinder(Adapter\AdapterInterface $adapter) - { - return Finder::create() - ->removeAdapters() - ->addAdapter($adapter); - } - - private function getValidAdapters() - { - return array_filter( - array( - new Adapter\BsdFindAdapter(), - new Adapter\GnuFindAdapter(), - new Adapter\PhpAdapter(), - ), - function (Adapter\AdapterInterface $adapter) { - return $adapter->isSupported(); - } - ); - } - - /** - * Searching in multiple locations with sub directories involves - * AppendIterator which does an unnecessary rewind which leaves - * FilterIterator with inner FilesystemIterator in an invalid state. - * - * @see https://bugs.php.net/bug.php?id=49104 - */ - public function testMultipleLocationsWithSubDirectories() - { - $locations = array( - __DIR__.'/Fixtures/one', - self::$tmpDir.DIRECTORY_SEPARATOR.'toto', - ); - - $finder = new Finder(); - $finder->in($locations)->depth('< 10')->name('*.neon'); - - $expected = array( - __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon', - __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon', - ); - - $this->assertIterator($expected, $finder); - $this->assertIteratorInForeach($expected, $finder); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/C/abc.dat b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/C/abc.dat deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/C/abc.dat +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/ab.dat b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/ab.dat deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/B/ab.dat +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/a.dat b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/a.dat deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/A/a.dat +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/ab.dat.copy b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/ab.dat.copy deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/B/ab.dat.copy +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/a.dat.copy b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/a.dat.copy deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/copy/A/a.dat.copy +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/dolor.txt b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/dolor.txt deleted file mode 100644 index 658bec6..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/dolor.txt +++ /dev/null @@ -1,2 +0,0 @@ -dolor sit amet -DOLOR SIT AMET
\ No newline at end of file diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/ipsum.txt b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/ipsum.txt deleted file mode 100644 index c7f392d..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/ipsum.txt +++ /dev/null @@ -1,2 +0,0 @@ -ipsum dolor sit amet -IPSUM DOLOR SIT AMET
\ No newline at end of file diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/lorem.txt b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/lorem.txt deleted file mode 100644 index 2991a2c..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/lorem.txt +++ /dev/null @@ -1,2 +0,0 @@ -lorem ipsum dolor sit amet -LOREM IPSUM DOLOR SIT AMET
\ No newline at end of file diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/a b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/a deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/a +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/c.neon b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/c.neon deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/c.neon +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/d.neon b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/d.neon deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/one/b/d.neon +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/with space/foo.txt b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/with space/foo.txt deleted file mode 100644 index e69de29..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Fixtures/with space/foo.txt +++ /dev/null diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php deleted file mode 100644 index 62629b1..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/CustomFilterIteratorTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\CustomFilterIterator; - -class CustomFilterIteratorTest extends IteratorTestCase -{ - /** - * @expectedException \InvalidArgumentException - */ - public function testWithInvalidFilter() - { - new CustomFilterIterator(new Iterator(), array('foo')); - } - - /** - * @dataProvider getAcceptData - */ - public function testAccept($filters, $expected) - { - $inner = new Iterator(array('test.php', 'test.py', 'foo.php')); - - $iterator = new CustomFilterIterator($inner, $filters); - - $this->assertIterator($expected, $iterator); - } - - public function getAcceptData() - { - return array( - array(array(function (\SplFileInfo $fileinfo) { return false; }), array()), - array(array(function (\SplFileInfo $fileinfo) { return preg_match('/^test/', $fileinfo) > 0; }), array('test.php', 'test.py')), - array(array('is_dir'), array()), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php deleted file mode 100644 index 709d5fe..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DateRangeFilterIteratorTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\DateRangeFilterIterator; -use Symfony\Component\Finder\Comparator\DateComparator; - -class DateRangeFilterIteratorTest extends RealIteratorTestCase -{ - /** - * @dataProvider getAcceptData - */ - public function testAccept($size, $expected) - { - $files = self::$files; - $files[] = self::toAbsolute('doesnotexist'); - $inner = new Iterator($files); - - $iterator = new DateRangeFilterIterator($inner, $size); - - $this->assertIterator($expected, $iterator); - } - - public function getAcceptData() - { - $since20YearsAgo = array( - '.git', - 'test.py', - 'foo', - 'foo/bar.tmp', - 'test.php', - 'toto', - '.bar', - '.foo', - '.foo/.bar', - 'foo bar', - '.foo/bar', - ); - - $since2MonthsAgo = array( - '.git', - 'test.py', - 'foo', - 'toto', - '.bar', - '.foo', - '.foo/.bar', - 'foo bar', - '.foo/bar', - ); - - $untilLastMonth = array( - 'foo/bar.tmp', - 'test.php', - ); - - return array( - array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)), - array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)), - array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php deleted file mode 100644 index 5ec9832..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/DepthRangeFilterIteratorTest.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator; - -class DepthRangeFilterIteratorTest extends RealIteratorTestCase -{ - /** - * @dataProvider getAcceptData - */ - public function testAccept($minDepth, $maxDepth, $expected) - { - $inner = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST); - - $iterator = new DepthRangeFilterIterator($inner, $minDepth, $maxDepth); - - $actual = array_keys(iterator_to_array($iterator)); - sort($expected); - sort($actual); - $this->assertEquals($expected, $actual); - } - - public function getAcceptData() - { - $lessThan1 = array( - '.git', - 'test.py', - 'foo', - 'test.php', - 'toto', - '.foo', - '.bar', - 'foo bar', - ); - - $lessThanOrEqualTo1 = array( - '.git', - 'test.py', - 'foo', - 'foo/bar.tmp', - 'test.php', - 'toto', - '.foo', - '.foo/.bar', - '.bar', - 'foo bar', - '.foo/bar', - ); - - $graterThanOrEqualTo1 = array( - 'foo/bar.tmp', - '.foo/.bar', - '.foo/bar', - ); - - $equalTo1 = array( - 'foo/bar.tmp', - '.foo/.bar', - '.foo/bar', - ); - - return array( - array(0, 0, $this->toAbsolute($lessThan1)), - array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)), - array(2, PHP_INT_MAX, array()), - array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)), - array(1, 1, $this->toAbsolute($equalTo1)), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php deleted file mode 100644 index 693b733..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator; -use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator; - -class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase -{ - /** - * @dataProvider getAcceptData - */ - public function testAccept($directories, $expected) - { - $inner = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST); - - $iterator = new ExcludeDirectoryFilterIterator($inner, $directories); - - $this->assertIterator($expected, $iterator); - } - - public function getAcceptData() - { - $foo = array( - '.bar', - '.foo', - '.foo/.bar', - '.foo/bar', - '.git', - 'test.py', - 'test.php', - 'toto', - 'foo bar', - ); - - $fo = array( - '.bar', - '.foo', - '.foo/.bar', - '.foo/bar', - '.git', - 'test.py', - 'foo', - 'foo/bar.tmp', - 'test.php', - 'toto', - 'foo bar', - ); - - return array( - array(array('foo'), $this->toAbsolute($foo)), - array(array('fo'), $this->toAbsolute($fo)), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php deleted file mode 100644 index fdf810b..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\FilePathsIterator; - -class FilePathsIteratorTest extends RealIteratorTestCase -{ - /** - * @dataProvider getSubPathData - */ - public function testSubPath($baseDir, array $paths, array $subPaths, array $subPathnames) - { - $iterator = new FilePathsIterator($paths, $baseDir); - - foreach ($iterator as $index => $file) { - $this->assertEquals($paths[$index], $file->getPathname()); - $this->assertEquals($subPaths[$index], $iterator->getSubPath()); - $this->assertEquals($subPathnames[$index], $iterator->getSubPathname()); - } - } - - public function getSubPathData() - { - $tmpDir = sys_get_temp_dir().'/symfony_finder'; - - return array( - array( - $tmpDir, - array( - // paths - $tmpDir.DIRECTORY_SEPARATOR.'.git' => $tmpDir.DIRECTORY_SEPARATOR.'.git', - $tmpDir.DIRECTORY_SEPARATOR.'test.py' => $tmpDir.DIRECTORY_SEPARATOR.'test.py', - $tmpDir.DIRECTORY_SEPARATOR.'foo' => $tmpDir.DIRECTORY_SEPARATOR.'foo', - $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp', - $tmpDir.DIRECTORY_SEPARATOR.'test.php' => $tmpDir.DIRECTORY_SEPARATOR.'test.php', - $tmpDir.DIRECTORY_SEPARATOR.'toto' => $tmpDir.DIRECTORY_SEPARATOR.'toto', - ), - array( - // subPaths - $tmpDir.DIRECTORY_SEPARATOR.'.git' => '', - $tmpDir.DIRECTORY_SEPARATOR.'test.py' => '', - $tmpDir.DIRECTORY_SEPARATOR.'foo' => '', - $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => 'foo', - $tmpDir.DIRECTORY_SEPARATOR.'test.php' => '', - $tmpDir.DIRECTORY_SEPARATOR.'toto' => '', - ), - array( - // subPathnames - $tmpDir.DIRECTORY_SEPARATOR.'.git' => '.git', - $tmpDir.DIRECTORY_SEPARATOR.'test.py' => 'test.py', - $tmpDir.DIRECTORY_SEPARATOR.'foo' => 'foo', - $tmpDir.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.tmp' => 'foo'.DIRECTORY_SEPARATOR.'bar.tmp', - $tmpDir.DIRECTORY_SEPARATOR.'test.php' => 'test.php', - $tmpDir.DIRECTORY_SEPARATOR.'toto' => 'toto', - ), - ), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php deleted file mode 100644 index cfa8684..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FileTypeFilterIteratorTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\FileTypeFilterIterator; - -class FileTypeFilterIteratorTest extends RealIteratorTestCase -{ - /** - * @dataProvider getAcceptData - */ - public function testAccept($mode, $expected) - { - $inner = new InnerTypeIterator(self::$files); - - $iterator = new FileTypeFilterIterator($inner, $mode); - - $this->assertIterator($expected, $iterator); - } - - public function getAcceptData() - { - $onlyFiles = array( - 'test.py', - 'foo/bar.tmp', - 'test.php', - '.bar', - '.foo/.bar', - '.foo/bar', - 'foo bar', - ); - - $onlyDirectories = array( - '.git', - 'foo', - 'toto', - '.foo', - ); - - return array( - array(FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)), - array(FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)), - ); - } -} - -class InnerTypeIterator extends \ArrayIterator -{ - public function current() - { - return new \SplFileInfo(parent::current()); - } - - public function isFile() - { - return $this->current()->isFile(); - } - - public function isDir() - { - return $this->current()->isDir(); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php deleted file mode 100644 index 744bdae..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilecontentFilterIteratorTest.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\FilecontentFilterIterator; - -class FilecontentFilterIteratorTest extends IteratorTestCase -{ - public function testAccept() - { - $inner = new MockFileListIterator(array('test.txt')); - $iterator = new FilecontentFilterIterator($inner, array(), array()); - $this->assertIterator(array('test.txt'), $iterator); - } - - public function testDirectory() - { - $inner = new MockFileListIterator(array('directory')); - $iterator = new FilecontentFilterIterator($inner, array('directory'), array()); - $this->assertIterator(array(), $iterator); - } - - public function testUnreadableFile() - { - $inner = new MockFileListIterator(array('file r-')); - $iterator = new FilecontentFilterIterator($inner, array('file r-'), array()); - $this->assertIterator(array(), $iterator); - } - - /** - * @dataProvider getTestFilterData - */ - public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray) - { - $iterator = new FilecontentFilterIterator($inner, $matchPatterns, $noMatchPatterns); - $this->assertIterator($resultArray, $iterator); - } - - public function getTestFilterData() - { - $inner = new MockFileListIterator(); - - $inner[] = new MockSplFileInfo(array( - 'name' => 'a.txt', - 'contents' => 'Lorem ipsum...', - 'type' => 'file', - 'mode' => 'r+', ) - ); - - $inner[] = new MockSplFileInfo(array( - 'name' => 'b.yml', - 'contents' => 'dolor sit...', - 'type' => 'file', - 'mode' => 'r+', ) - ); - - $inner[] = new MockSplFileInfo(array( - 'name' => 'some/other/dir/third.php', - 'contents' => 'amet...', - 'type' => 'file', - 'mode' => 'r+', ) - ); - - $inner[] = new MockSplFileInfo(array( - 'name' => 'unreadable-file.txt', - 'contents' => false, - 'type' => 'file', - 'mode' => 'r+', ) - ); - - return array( - array($inner, array('.'), array(), array('a.txt', 'b.yml', 'some/other/dir/third.php')), - array($inner, array('ipsum'), array(), array('a.txt')), - array($inner, array('i', 'amet'), array('Lorem', 'amet'), array('b.yml')), - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php deleted file mode 100644 index c4b9795..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilenameFilterIteratorTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\FilenameFilterIterator; - -class FilenameFilterIteratorTest extends IteratorTestCase -{ - /** - * @dataProvider getAcceptData - */ - public function testAccept($matchPatterns, $noMatchPatterns, $expected) - { - $inner = new InnerNameIterator(array('test.php', 'test.py', 'foo.php')); - - $iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns); - - $this->assertIterator($expected, $iterator); - } - - public function getAcceptData() - { - return array( - array(array('test.*'), array(), array('test.php', 'test.py')), - array(array(), array('test.*'), array('foo.php')), - array(array('*.php'), array('test.*'), array('foo.php')), - array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.py')), - array(array('/\.php$/'), array(), array('test.php', 'foo.php')), - array(array(), array('/\.php$/'), array('test.py')), - ); - } -} - -class InnerNameIterator extends \ArrayIterator -{ - public function current() - { - return new \SplFileInfo(parent::current()); - } - - public function getFilename() - { - return parent::current(); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php deleted file mode 100644 index 029a266..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/FilterIteratorTest.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -/** - * @author Alex Bogomazov - */ -class FilterIteratorTest extends RealIteratorTestCase -{ - public function testFilterFilesystemIterators() - { - $i = new \FilesystemIterator($this->toAbsolute()); - - // it is expected that there are test.py test.php in the tmpDir - $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i)); - $i->expects($this->any()) - ->method('accept') - ->will($this->returnCallback(function () use ($i) { - return (bool) preg_match('/\.php/', (string) $i->current()); - }) - ); - - $c = 0; - foreach ($i as $item) { - $c++; - } - - $this->assertEquals(1, $c); - - $i->rewind(); - - $c = 0; - foreach ($i as $item) { - $c++; - } - - // This would fail with \FilterIterator but works with Symfony\Component\Finder\Iterator\FilterIterator - // see https://bugs.php.net/bug.php?id=49104 - $this->assertEquals(1, $c); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/Iterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/Iterator.php deleted file mode 100644 index 849bf08..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/Iterator.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -class Iterator implements \Iterator -{ - protected $values = array(); - - public function __construct(array $values = array()) - { - foreach ($values as $value) { - $this->attach(new \SplFileInfo($value)); - } - $this->rewind(); - } - - public function attach(\SplFileInfo $fileinfo) - { - $this->values[] = $fileinfo; - } - - public function rewind() - { - reset($this->values); - } - - public function valid() - { - return false !== $this->current(); - } - - public function next() - { - next($this->values); - } - - public function current() - { - return current($this->values); - } - - public function key() - { - return key($this->values); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php deleted file mode 100644 index ae7388e..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase -{ - protected function assertIterator($expected, \Traversable $iterator) - { - // set iterator_to_array $use_key to false to avoid values merge - // this made FinderTest::testAppendWithAnArray() failed with GnuFinderAdapter - $values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false)); - - $expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected); - - sort($values); - sort($expected); - - $this->assertEquals($expected, array_values($values)); - } - - protected function assertOrderedIterator($expected, \Traversable $iterator) - { - $values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)); - - $this->assertEquals($expected, array_values($values)); - } - - /** - * Same as assertOrderedIterator, but checks the order of groups of - * array elements. - * - * @param array $expected - an array of arrays. For any two subarrays - * $a and $b such that $a goes before $b in $expected, the method - * asserts that any element of $a goes before any element of $b - * in the sequence generated by $iterator - * @param \Traversable $iterator - */ - protected function assertOrderedIteratorForGroups($expected, \Traversable $iterator) - { - $values = array_values(array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator))); - - foreach ($expected as $subarray) { - $temp = array(); - while (count($values) && count($temp) < count($subarray)) { - array_push($temp, array_shift($values)); - } - sort($temp); - sort($subarray); - $this->assertEquals($subarray, $temp); - } - } - - /** - * Same as IteratorTestCase::assertIterator with foreach usage. - * - * @param array $expected - * @param \Traversable $iterator - */ - protected function assertIteratorInForeach($expected, \Traversable $iterator) - { - $values = array(); - foreach ($iterator as $file) { - $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file); - $values[] = $file->getPathname(); - } - - sort($values); - sort($expected); - - $this->assertEquals($expected, array_values($values)); - } - - /** - * Same as IteratorTestCase::assertOrderedIterator with foreach usage. - * - * @param array $expected - * @param \Traversable $iterator - */ - protected function assertOrderedIteratorInForeach($expected, \Traversable $iterator) - { - $values = array(); - foreach ($iterator as $file) { - $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file); - $values[] = $file->getPathname(); - } - - $this->assertEquals($expected, array_values($values)); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php deleted file mode 100644 index eb0adfa..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockFileListIterator.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -class MockFileListIterator extends \ArrayIterator -{ - public function __construct(array $filesArray = array()) - { - $files = array_map(function ($file) { return new MockSplFileInfo($file); }, $filesArray); - parent::__construct($files); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php deleted file mode 100644 index f2e8f8e..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -class MockSplFileInfo extends \SplFileInfo -{ - const TYPE_DIRECTORY = 1; - const TYPE_FILE = 2; - const TYPE_UNKNOWN = 3; - - private $contents = null; - private $mode = null; - private $type = null; - private $relativePath = null; - private $relativePathname = null; - - public function __construct($param) - { - if (is_string($param)) { - parent::__construct($param); - } elseif (is_array($param)) { - $defaults = array( - 'name' => 'file.txt', - 'contents' => null, - 'mode' => null, - 'type' => null, - 'relativePath' => null, - 'relativePathname' => null, - ); - $defaults = array_merge($defaults, $param); - parent::__construct($defaults['name']); - $this->setContents($defaults['contents']); - $this->setMode($defaults['mode']); - $this->setType($defaults['type']); - $this->setRelativePath($defaults['relativePath']); - $this->setRelativePathname($defaults['relativePathname']); - } else { - throw new \RuntimeException(sprintf('Incorrect parameter "%s"', $param)); - } - } - - public function isFile() - { - if (null === $this->type) { - return preg_match('/file/', $this->getFilename()); - }; - - return self::TYPE_FILE === $this->type; - } - - public function isDir() - { - if (null === $this->type) { - return preg_match('/directory/', $this->getFilename()); - } - - return self::TYPE_DIRECTORY === $this->type; - } - - public function isReadable() - { - if (null === $this->mode) { - return preg_match('/r\+/', $this->getFilename()); - } - - return preg_match('/r\+/', $this->mode); - } - - public function getContents() - { - return $this->contents; - } - - public function setContents($contents) - { - $this->contents = $contents; - } - - public function setMode($mode) - { - $this->mode = $mode; - } - - public function setType($type) - { - if (is_string($type)) { - switch ($type) { - case 'directory': - $this->type = self::TYPE_DIRECTORY; - case 'd': - $this->type = self::TYPE_DIRECTORY; - break; - case 'file': - $this->type = self::TYPE_FILE; - case 'f': - $this->type = self::TYPE_FILE; - break; - default: - $this->type = self::TYPE_UNKNOWN; - } - } else { - $this->type = $type; - } - } - - public function setRelativePath($relativePath) - { - $this->relativePath = $relativePath; - } - - public function setRelativePathname($relativePathname) - { - $this->relativePathname = $relativePathname; - } - - public function getRelativePath() - { - return $this->relativePath; - } - - public function getRelativePathname() - { - return $this->relativePathname; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php deleted file mode 100644 index 89d8edb..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\MultiplePcreFilterIterator; - -class MultiplePcreFilterIteratorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider getIsRegexFixtures - */ - public function testIsRegex($string, $isRegex, $message) - { - $testIterator = new TestMultiplePcreFilterIterator(); - $this->assertEquals($isRegex, $testIterator->isRegex($string), $message); - } - - public function getIsRegexFixtures() - { - return array( - array('foo', false, 'string'), - array(' foo ', false, '" " is not a valid delimiter'), - array('\\foo\\', false, '"\\" is not a valid delimiter'), - array('afooa', false, '"a" is not a valid delimiter'), - array('//', false, 'the pattern should contain at least 1 character'), - array('/a/', true, 'valid regex'), - array('/foo/', true, 'valid regex'), - array('/foo/i', true, 'valid regex with a single modifier'), - array('/foo/imsxu', true, 'valid regex with multiple modifiers'), - array('#foo#', true, '"#" is a valid delimiter'), - array('{foo}', true, '"{,}" is a valid delimiter pair'), - array('*foo.*', false, '"*" is not considered as a valid delimiter'), - array('?foo.?', false, '"?" is not considered as a valid delimiter'), - ); - } -} - -class TestMultiplePcreFilterIterator extends MultiplePcreFilterIterator -{ - public function __construct() - { - } - - public function accept() - { - throw new \BadFunctionCallException('Not implemented'); - } - - public function isRegex($str) - { - return parent::isRegex($str); - } - - public function toRegex($str) - { - throw new \BadFunctionCallException('Not implemented'); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/PathFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/PathFilterIteratorTest.php deleted file mode 100644 index 579beed..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/PathFilterIteratorTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\PathFilterIterator; - -class PathFilterIteratorTest extends IteratorTestCase -{ - /** - * @dataProvider getTestFilterData - */ - public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray) - { - $iterator = new PathFilterIterator($inner, $matchPatterns, $noMatchPatterns); - $this->assertIterator($resultArray, $iterator); - } - - public function getTestFilterData() - { - $inner = new MockFileListIterator(); - - //PATH: A/B/C/abc.dat - $inner[] = new MockSplFileInfo(array( - 'name' => 'abc.dat', - 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', - )); - - //PATH: A/B/ab.dat - $inner[] = new MockSplFileInfo(array( - 'name' => 'ab.dat', - 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', - )); - - //PATH: A/a.dat - $inner[] = new MockSplFileInfo(array( - 'name' => 'a.dat', - 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'a.dat', - )); - - //PATH: copy/A/B/C/abc.dat.copy - $inner[] = new MockSplFileInfo(array( - 'name' => 'abc.dat.copy', - 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', - )); - - //PATH: copy/A/B/ab.dat.copy - $inner[] = new MockSplFileInfo(array( - 'name' => 'ab.dat.copy', - 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', - )); - - //PATH: copy/A/a.dat.copy - $inner[] = new MockSplFileInfo(array( - 'name' => 'a.dat.copy', - 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'a.dat', - )); - - return array( - array($inner, array('/^A/'), array(), array('abc.dat', 'ab.dat', 'a.dat')), - array($inner, array('/^A\/B/'), array(), array('abc.dat', 'ab.dat')), - array($inner, array('/^A\/B\/C/'), array(), array('abc.dat')), - array($inner, array('/A\/B\/C/'), array(), array('abc.dat', 'abc.dat.copy')), - - array($inner, array('A'), array(), array('abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')), - array($inner, array('A/B'), array(), array('abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy')), - array($inner, array('A/B/C'), array(), array('abc.dat', 'abc.dat.copy')), - - array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')), - array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')), - array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')), - - ); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php deleted file mode 100644 index e22476d..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -abstract class RealIteratorTestCase extends IteratorTestCase -{ - protected static $tmpDir; - protected static $files; - - public static function setUpBeforeClass() - { - self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; - - self::$files = array( - '.git/', - '.foo/', - '.foo/.bar', - '.foo/bar', - '.bar', - 'test.py', - 'foo/', - 'foo/bar.tmp', - 'test.php', - 'toto/', - 'foo bar', - ); - - self::$files = self::toAbsolute(self::$files); - - if (is_dir(self::$tmpDir)) { - self::tearDownAfterClass(); - } else { - mkdir(self::$tmpDir); - } - - foreach (self::$files as $file) { - if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { - mkdir($file); - } else { - touch($file); - } - } - - file_put_contents(self::toAbsolute('test.php'), str_repeat(' ', 800)); - file_put_contents(self::toAbsolute('test.py'), str_repeat(' ', 2000)); - - touch(self::toAbsolute('foo/bar.tmp'), strtotime('2005-10-15')); - touch(self::toAbsolute('test.php'), strtotime('2005-10-15')); - } - - public static function tearDownAfterClass() - { - foreach (array_reverse(self::$files) as $file) { - if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { - @rmdir($file); - } else { - @unlink($file); - } - } - } - - protected static function toAbsolute($files = null) - { - /* - * Without the call to setUpBeforeClass() property can be null. - */ - if (!self::$tmpDir) { - self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; - } - - if (is_array($files)) { - $f = array(); - foreach ($files as $file) { - if (is_array($file)) { - $f[] = self::toAbsolute($file); - } else { - $f[] = self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $file); - } - } - - return $f; - } - - if (is_string($files)) { - return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files); - } - - return self::$tmpDir; - } - - protected static function toAbsoluteFixtures($files) - { - $f = array(); - foreach ($files as $file) { - $f[] = realpath(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.$file); - } - - return $f; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php deleted file mode 100644 index 412054b..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. -* -* (c) Fabien Potencier <fabien@symfony.com> -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator; - -class RecursiveDirectoryIteratorTest extends IteratorTestCase -{ - /** - * @dataProvider getPaths - * - * @param string $path - * @param bool $seekable - * @param array $contains - * @param string $message - */ - public function testRewind($path, $seekable, $contains, $message = null) - { - try { - $i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); - } catch (\UnexpectedValueException $e) { - $this->markTestSkipped(sprintf('Unsupported stream "%s".', $path)); - } - - $i->rewind(); - - $this->assertTrue(true, $message); - } - - /** - * @dataProvider getPaths - * - * @param string $path - * @param bool $seekable - * @param array $contains - * @param string $message - */ - public function testSeek($path, $seekable, $contains, $message = null) - { - try { - $i = new RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS); - } catch (\UnexpectedValueException $e) { - $this->markTestSkipped(sprintf('Unsupported stream "%s".', $path)); - } - - $actual = array(); - - $i->seek(0); - $actual[] = $i->getPathname(); - - $i->seek(1); - $actual[] = $i->getPathname(); - - $i->seek(2); - $actual[] = $i->getPathname(); - - $this->assertEquals($contains, $actual); - } - - public function getPaths() - { - $data = array(); - - // ftp - $contains = array( - 'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'README', - 'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'index.html', - 'ftp://ftp.mozilla.org'.DIRECTORY_SEPARATOR.'pub', - ); - $data[] = array('ftp://ftp.mozilla.org/', false, $contains); - - return $data; - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php deleted file mode 100644 index 8780db4..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SizeRangeFilterIteratorTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator; -use Symfony\Component\Finder\Comparator\NumberComparator; - -class SizeRangeFilterIteratorTest extends RealIteratorTestCase -{ - /** - * @dataProvider getAcceptData - */ - public function testAccept($size, $expected) - { - $inner = new InnerSizeIterator(self::$files); - - $iterator = new SizeRangeFilterIterator($inner, $size); - - $this->assertIterator($expected, $iterator); - } - - public function getAcceptData() - { - $lessThan1KGreaterThan05K = array( - '.foo', - '.git', - 'foo', - 'test.php', - 'toto', - ); - - return array( - array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)), - ); - } -} - -class InnerSizeIterator extends \ArrayIterator -{ - public function current() - { - return new \SplFileInfo(parent::current()); - } - - public function getFilename() - { - return parent::current(); - } - - public function isFile() - { - return $this->current()->isFile(); - } - - public function getSize() - { - return $this->current()->getSize(); - } -} diff --git a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php b/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php deleted file mode 100644 index e2f433f..0000000 --- a/Aufgabe06/vendor/symfony/finder/Symfony/Component/Finder/Tests/Iterator/SortableIteratorTest.php +++ /dev/null @@ -1,169 +0,0 @@ -<?php - -/* - * This file is part of the Symfony package. - * - * (c) Fabien Potencier <fabien@symfony.com> - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Finder\Tests\Iterator; - -use Symfony\Component\Finder\Iterator\SortableIterator; - -class SortableIteratorTest extends RealIteratorTestCase -{ - public function testConstructor() - { - try { - new SortableIterator(new Iterator(array()), 'foobar'); - $this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid'); - } catch (\Exception $e) { - $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid'); - } - } - - /** - * @dataProvider getAcceptData - */ - public function testAccept($mode, $expected) - { - if (!is_callable($mode)) { - switch ($mode) { - case SortableIterator::SORT_BY_ACCESSED_TIME : - file_get_contents(self::toAbsolute('.git')); - sleep(1); - file_get_contents(self::toAbsolute('.bar')); - break; - case SortableIterator::SORT_BY_CHANGED_TIME : - file_put_contents(self::toAbsolute('test.php'), 'foo'); - sleep(1); - file_put_contents(self::toAbsolute('test.py'), 'foo'); - break; - case SortableIterator::SORT_BY_MODIFIED_TIME : - file_put_contents(self::toAbsolute('test.php'), 'foo'); - sleep(1); - file_put_contents(self::toAbsolute('test.py'), 'foo'); - break; - } - } - - $inner = new Iterator(self::$files); - - $iterator = new SortableIterator($inner, $mode); - - if ($mode === SortableIterator::SORT_BY_ACCESSED_TIME - || $mode === SortableIterator::SORT_BY_CHANGED_TIME - || $mode === SortableIterator::SORT_BY_MODIFIED_TIME) { - $this->assertOrderedIteratorForGroups($expected, $iterator); - } else { - $this->assertOrderedIterator($expected, $iterator); - } - } - - public function getAcceptData() - { - $sortByName = array( - '.bar', - '.foo', - '.foo/.bar', - '.foo/bar', - '.git', - 'foo', - 'foo bar', - 'foo/bar.tmp', - 'test.php', - 'test.py', - 'toto', - ); - - $sortByType = array( - '.foo', - '.git', - 'foo', - 'toto', - '.bar', - '.foo/.bar', - '.foo/bar', - 'foo bar', - 'foo/bar.tmp', - 'test.php', - 'test.py', - ); - - $customComparison = array( - '.bar', - '.foo', - '.foo/.bar', - '.foo/bar', - '.git', - 'foo', - 'foo bar', - 'foo/bar.tmp', - 'test.php', - 'test.py', - 'toto', - ); - - $sortByAccessedTime = array( - // For these two files the access time was set to 2005-10-15 - array('foo/bar.tmp', 'test.php'), - // These files were created more or less at the same time - array( - '.git', - '.foo', - '.foo/.bar', - '.foo/bar', - 'test.py', - 'foo', - 'toto', - 'foo bar', - ), - // This file was accessed after sleeping for 1 sec - array('.bar'), - ); - - $sortByChangedTime = array( - array( - '.git', - '.foo', - '.foo/.bar', - '.foo/bar', - '.bar', - 'foo', - 'foo/bar.tmp', - 'toto', - 'foo bar', - ), - array('test.php'), - array('test.py'), - ); - - $sortByModifiedTime = array( - array( - '.git', - '.foo', - '.foo/.bar', - '.foo/bar', - '.bar', - 'foo', - 'foo/bar.tmp', - 'toto', - 'foo bar', - ), - array('test.php'), - array('test.py'), - ); - - return array( - array(SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)), - array(SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)), - array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)), - array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)), - array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)), - array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealpath(), $b->getRealpath()); }, $this->toAbsolute($customComparison)), - ); - } -} |
