comparison vendor/symfony/finder/Tests/FinderTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
197 $finder = $this->buildFinder(); 197 $finder = $this->buildFinder();
198 $this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false)); 198 $this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false));
199 $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar']), $finder->in(self::$tmpDir)->getIterator()); 199 $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar']), $finder->in(self::$tmpDir)->getIterator());
200 } 200 }
201 201
202 public function testIgnoreVCSCanBeDisabledAfterFirstIteration()
203 {
204 $finder = $this->buildFinder();
205 $finder->in(self::$tmpDir);
206 $finder->ignoreDotFiles(false);
207
208 $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar']), $finder->getIterator());
209
210 $finder->ignoreVCS(false);
211 $this->assertIterator($this->toAbsolute(['.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar']), $finder->getIterator());
212 }
213
202 public function testIgnoreDotFiles() 214 public function testIgnoreDotFiles()
203 { 215 {
204 $finder = $this->buildFinder(); 216 $finder = $this->buildFinder();
205 $this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false)); 217 $this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false));
206 $this->assertIterator($this->toAbsolute(['.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar']), $finder->in(self::$tmpDir)->getIterator()); 218 $this->assertIterator($this->toAbsolute(['.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar']), $finder->in(self::$tmpDir)->getIterator());
210 $this->assertIterator($this->toAbsolute(['.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar']), $finder->in(self::$tmpDir)->getIterator()); 222 $this->assertIterator($this->toAbsolute(['.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar']), $finder->in(self::$tmpDir)->getIterator());
211 223
212 $finder = $this->buildFinder(); 224 $finder = $this->buildFinder();
213 $this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false)); 225 $this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false));
214 $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar']), $finder->in(self::$tmpDir)->getIterator()); 226 $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar']), $finder->in(self::$tmpDir)->getIterator());
227 }
228
229 public function testIgnoreDotFilesCanBeDisabledAfterFirstIteration()
230 {
231 $finder = $this->buildFinder();
232 $finder->in(self::$tmpDir);
233
234 $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar']), $finder->getIterator());
235
236 $finder->ignoreDotFiles(false);
237 $this->assertIterator($this->toAbsolute(['foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar']), $finder->getIterator());
215 } 238 }
216 239
217 public function testSortByName() 240 public function testSortByName()
218 { 241 {
219 $finder = $this->buildFinder(); 242 $finder = $this->buildFinder();
314 $finder->in(__DIR__.'/Fixtures/A/a*'); 337 $finder->in(__DIR__.'/Fixtures/A/a*');
315 } 338 }
316 339
317 public function testInWithGlobBrace() 340 public function testInWithGlobBrace()
318 { 341 {
342 if (!\defined('GLOB_BRACE')) {
343 $this->markTestSkipped('Glob brace is not supported on this system.');
344 }
345
319 $finder = $this->buildFinder(); 346 $finder = $this->buildFinder();
320 $finder->in([__DIR__.'/Fixtures/{A,copy/A}/B/C'])->getIterator(); 347 $finder->in([__DIR__.'/Fixtures/{A,copy/A}/B/C'])->getIterator();
321 348
322 $this->assertIterator($this->toAbsoluteFixtures(['A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy']), $finder); 349 $this->assertIterator($this->toAbsoluteFixtures(['A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy']), $finder);
323 } 350 }