Skip to content

Commit a21e094

Browse files
Merge branch '4.0'
* 4.0: (24 commits) moved Twig runtime to proper class fixed deprecated messages in tests add PHP errors options to XML schema definition [HttpCache] Unlink tmp file on error Added LB translation for #26327 (Errors sign for people that do not see colors) [TwigBridge] Fix rendering of currency by MoneyType Import InvalidArgumentException in PdoAdapter [DI] Do not suggest writing an implementation when multiple exist [Intl] Update ICU data to 61.1 Use 3rd person verb form in command description [Validator] Add Japanese translation Support phpdbg SAPI in Debug::enable() [HttpKernel] DumpDataCollector: do not flush when a dumper is provided [DI] Fix hardcoded cache dir for warmups [Routing] fix tests [Routing] Fixed the importing of files using glob patterns that match multiple resources [Ldap] cast to string when checking empty passwords [Validator] sync validator translation id [WebProfilerBundle] use the router to resolve file links no type errors with invalid submitted data types ...
2 parents 6347bc2 + c72995d commit a21e094

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

SplFileInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SplFileInfo extends \SplFileInfo
2828
*/
2929
public function __construct(string $file, string $relativePath, string $relativePathname)
3030
{
31-
parent::__construct($file);
31+
parent::__construct(realpath($file) ?: $file);
3232
$this->relativePath = $relativePath;
3333
$this->relativePathname = $relativePathname;
3434
}

Tests/FinderTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ public function testFiles()
4646
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
4747
}
4848

49+
public function testRemoveTrailingSlash()
50+
{
51+
if ('\\' === \DIRECTORY_SEPARATOR) {
52+
$this->markTestSkipped('This test cannot be run on Windows.');
53+
}
54+
55+
$finder = $this->buildFinder();
56+
57+
$expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar'));
58+
$in = '//'.realpath(self::$tmpDir).'//';
59+
60+
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
61+
}
62+
4963
public function testDepth()
5064
{
5165
$finder = $this->buildFinder();
@@ -514,8 +528,8 @@ public function testMultipleLocationsWithSubDirectories()
514528
$finder->in($locations)->depth('< 10')->name('*.neon');
515529

516530
$expected = array(
517-
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
518-
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
531+
__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
532+
__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
519533
);
520534

521535
$this->assertIterator($expected, $finder);

0 commit comments

Comments
 (0)