diff --git a/src/Symfony/Component/Finder/SplFileInfo.php b/src/Symfony/Component/Finder/SplFileInfo.php index 19f95e26be69a..2cf3a27fa9f6b 100644 --- a/src/Symfony/Component/Finder/SplFileInfo.php +++ b/src/Symfony/Component/Finder/SplFileInfo.php @@ -28,7 +28,7 @@ class SplFileInfo extends \SplFileInfo */ public function __construct($file, $relativePath, $relativePathname) { - parent::__construct($file); + parent::__construct(realpath($file) ?: $file); $this->relativePath = $relativePath; $this->relativePathname = $relativePathname; } diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 6e13e9c3832d3..dd90c4e844b86 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -48,6 +48,20 @@ public function testFiles() $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); } + public function testRemoveTrailingSlash() + { + if ('\\' === \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('This test cannot be run on Windows.'); + } + + $finder = $this->buildFinder(); + + $expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')); + $in = '//'.realpath(self::$tmpDir).'//'; + + $this->assertIterator($expected, $finder->in($in)->files()->getIterator()); + } + public function testDepth() { $finder = $this->buildFinder(); @@ -504,8 +518,8 @@ public function testMultipleLocationsWithSubDirectories() $finder->in($locations)->depth('< 10')->name('*.neon'); $expected = array( - __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon', - __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon', + __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon', + __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon', ); $this->assertIterator($expected, $finder); diff --git a/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php b/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php index fdf810bebd3db..3c805086afec2 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/FilePathsIteratorTest.php @@ -31,7 +31,7 @@ public function testSubPath($baseDir, array $paths, array $subPaths, array $subP public function getSubPathData() { - $tmpDir = sys_get_temp_dir().'/symfony_finder'; + $tmpDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.'symfony_finder'; return array( array( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy