You are here

public function FinderTest::testDepth in Database Sanitize 7

File

vendor/symfony/finder/Tests/FinderTest.php, line 88

Class

FinderTest

Namespace

Symfony\Component\Finder\Tests

Code

public function testDepth() {
  $finder = $this
    ->buildFinder();
  $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();
  $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();
  $this
    ->assertSame($finder, $finder
    ->depth('>= 1'));
  $this
    ->assertIterator($this
    ->toAbsolute(array(
    'foo/bar.tmp',
  )), $finder
    ->in(self::$tmpDir)
    ->getIterator());
  $finder = $this
    ->buildFinder();
  $finder
    ->depth('< 1')
    ->depth('>= 1');
  $this
    ->assertIterator(array(), $finder
    ->in(self::$tmpDir)
    ->getIterator());
}