Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/finder/Tests/FinderTest.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 7a779792577d |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
12:7a779792577d | 13:5fb285c0d0e3 |
---|---|
44 $finder->directories(); | 44 $finder->directories(); |
45 $finder->files(); | 45 $finder->files(); |
46 $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); | 46 $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); |
47 } | 47 } |
48 | 48 |
49 public function testRemoveTrailingSlash() | |
50 { | |
51 $finder = $this->buildFinder(); | |
52 | |
53 $expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')); | |
54 $in = self::$tmpDir.'//'; | |
55 | |
56 $this->assertIterator($expected, $finder->in($in)->files()->getIterator()); | |
57 } | |
58 | |
59 public function testSymlinksNotResolved() | |
60 { | |
61 if ('\\' === DIRECTORY_SEPARATOR) { | |
62 $this->markTestSkipped('symlinks are not supported on Windows'); | |
63 } | |
64 | |
65 $finder = $this->buildFinder(); | |
66 | |
67 symlink($this->toAbsolute('foo'), $this->toAbsolute('baz')); | |
68 $expected = $this->toAbsolute(array('baz/bar.tmp')); | |
69 $in = self::$tmpDir.'/baz/'; | |
70 try { | |
71 $this->assertIterator($expected, $finder->in($in)->files()->getIterator()); | |
72 unlink($this->toAbsolute('baz')); | |
73 } catch (\Exception $e) { | |
74 unlink($this->toAbsolute('baz')); | |
75 throw $e; | |
76 } | |
77 } | |
78 | |
79 public function testBackPathNotNormalized() | |
80 { | |
81 $finder = $this->buildFinder(); | |
82 | |
83 $expected = $this->toAbsolute(array('foo/../foo/bar.tmp')); | |
84 $in = self::$tmpDir.'/foo/../foo/'; | |
85 $this->assertIterator($expected, $finder->in($in)->files()->getIterator()); | |
86 } | |
87 | |
49 public function testDepth() | 88 public function testDepth() |
50 { | 89 { |
51 $finder = $this->buildFinder(); | 90 $finder = $this->buildFinder(); |
52 $this->assertSame($finder, $finder->depth('< 1')); | 91 $this->assertSame($finder, $finder->depth('< 1')); |
53 $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); | 92 $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); |
259 } | 298 } |
260 | 299 |
261 public function testInWithGlob() | 300 public function testInWithGlob() |
262 { | 301 { |
263 $finder = $this->buildFinder(); | 302 $finder = $this->buildFinder(); |
264 $finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator(); | 303 $finder->in(array(__DIR__.'/Fixtures/*/B/C/', __DIR__.'/Fixtures/*/*/B/C/'))->getIterator(); |
265 | 304 |
266 $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder); | 305 $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder); |
267 } | 306 } |
268 | 307 |
269 /** | 308 /** |