Sha256: 4d27eea613956ad3c377b6d45e598e5c940f185e45a53781637beecdead72916

Contents?: true

Size: 1.54 KB

Versions: 24

Compression:

Stored size: 1.54 KB

Contents

<?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\Comparator\NumberComparator;
use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;

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',
            'qux',
            'test.php',
            'toto',
            'toto/.git',
        );

        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();
    }
}

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
dependabot-composer-0.106.12 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.106.11 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.106.5 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.100.2 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.36 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.19 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.13 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.11 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.10 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.7 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.6 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.98.1 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.70 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.63 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.60 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.52 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.50 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.47 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.42 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.95.40 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php