Sha256: f74f9416211b4838db49a641daccb7b8818c656e382c44356d30c5d41d195120

Contents?: true

Size: 1.52 KB

Versions: 16

Compression:

Stored size: 1.52 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 = [
            '.foo',
            '.git',
            'foo',
            'qux',
            'test.php',
            'toto',
            'toto/.git',
        ];

        return [
            [[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

16 entries across 16 versions & 1 rubygems

Version Path
dependabot-composer-0.112.1 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.111.57 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.111.56 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.111.52 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.111.50 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.111.25 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.111.17 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.111.15 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.110.13 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.108.11 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.108.8 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.107.47 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.107.39 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.107.36 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.107.28 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php
dependabot-composer-0.107.14 helpers/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php