Вход Регистрация
Файл: gapps/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php
Строк: 43
<?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 SymfonyComponentFinderTestsIterator;

use 
SymfonyComponentFinderIteratorDepthRangeFilterIterator;

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',
            
'toto/.git',
            
'.foo',
            
'.foo/.bar',
            
'.bar',
            
'foo bar',
            
'.foo/bar',
        );

        
$graterThanOrEqualTo1 = array(
            
'toto/.git',
            
'foo/bar.tmp',
            
'.foo/.bar',
            
'.foo/bar',
        );

        
$equalTo1 = array(
            
'toto/.git',
            
'foo/bar.tmp',
            
'.foo/.bar',
            
'.foo/bar',
        );

        return array(
            array(
00$this->toAbsolute($lessThan1)),
            array(
01$this->toAbsolute($lessThanOrEqualTo1)),
            array(
2PHP_INT_MAX, array()),
            array(
1PHP_INT_MAX$this->toAbsolute($graterThanOrEqualTo1)),
            array(
11$this->toAbsolute($equalTo1)),
        );
    }
}
Онлайн: 0
Реклама