Skip to content

Commit 5c77025

Browse files
committed
Merge branch '3.1'
* 3.1: (24 commits) [Yaml] fix exception contexts Added people - person inflection People - person singularization [Yaml] properly handle unindented collections [Serializer] Add test for ignored attributes during denormalization chomp newlines only at the end of YAML documents Fixed server status command when port has been omitted Update UPGRADE FROM 2.x to 3.0 [Config] Allow schemed path in FileResource fix removed commands wording in upgrade file Catch \Throwable Catch \Throwable [DependencyInjection] Avoid generating call_user_func in more cases [Validator] Support for DateTimeImmutable [YAML] fixed "dump" signature in upgrade file [Cache] Rename nonce to version [FrameworkBundle] update upgrade instructions Use levenshtein level for better Bundle matching [WebProfilerBundle] Fix CORS ajax security issues remove methods that were needed for PHP 5.3 ...
2 parents 79ab1a8 + 048dc47 commit 5c77025

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Resource/FileResource.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function __construct($resource)
3636
{
3737
$this->resource = realpath($resource);
3838

39+
if (false === $this->resource && file_exists($resource)) {
40+
$this->resource = $resource;
41+
}
42+
3943
if (false === $this->resource) {
4044
throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $resource));
4145
}

Tests/Resource/FileResourceTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class FileResourceTest extends \PHPUnit_Framework_TestCase
2121

2222
protected function setUp()
2323
{
24-
$this->file = realpath(sys_get_temp_dir()).'/tmp.xml';
24+
$this->file = sys_get_temp_dir().'/tmp.xml';
2525
$this->time = time();
2626
touch($this->file, $this->time);
2727
$this->resource = new FileResource($this->file);
@@ -41,6 +41,12 @@ public function testGetResource()
4141
$this->assertSame(realpath($this->file), $this->resource->getResource(), '->getResource() returns the path to the resource');
4242
}
4343

44+
public function testGetResourceWithScheme()
45+
{
46+
$resource = new FileResource('file://'.$this->file);
47+
$this->assertSame('file://'.$this->file, $resource->getResource(), '->getResource() returns the path to the schemed resource');
48+
}
49+
4450
public function testToString()
4551
{
4652
$this->assertSame(realpath($this->file), (string) $this->resource);

0 commit comments

Comments
 (0)