Skip to content

Commit 45c0c49

Browse files
committed
minor #19765 [Config] Fix DirectoryResourceTest for symlinks (ogizanagi)
This PR was merged into the 3.1 branch. Discussion ---------- [Config] Fix DirectoryResourceTest for symlinks | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | no (only tests, locally) | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Tests were failing locally (on my macbook), because the `DirectoryResource` implementation now uses `realpath`. Which means the path returned by `->getResource()` may differ from the given one in case it is a symlink: ```diff There were 2 failures: 1) Symfony\Component\Config\Tests\Resource\DirectoryResourceTest::testGetResource ->getResource() returns the path to the resource Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -/var/folders/j0/grc5nstx5b5f95cgg09_cy_h0000gn/T/symfonyDirectoryIterator +/private/var/folders/j0/grc5nstx5b5f95cgg09_cy_h0000gn/T/symfonyDirectoryIterator src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php:56 2) Symfony\Component\Config\Tests\Resource\DirectoryResourceTest::testSerializeUnserialize Failed asserting that two strings are identical. --- Expected +++ Actual @@ @@ -/var/folders/j0/grc5nstx5b5f95cgg09_cy_h0000gn/T/symfonyDirectoryIterator +/private/var/folders/j0/grc5nstx5b5f95cgg09_cy_h0000gn/T/symfonyDirectoryIterator src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php:169 ``` Commits ------- 56f74eb [Config] Fix DirectoryResourceTest for symlinks
2 parents 120a05d + 56f74eb commit 45c0c49

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function removeDirectory($directory)
5353
public function testGetResource()
5454
{
5555
$resource = new DirectoryResource($this->directory);
56-
$this->assertSame($this->directory, $resource->getResource(), '->getResource() returns the path to the resource');
56+
$this->assertSame(realpath($this->directory), $resource->getResource(), '->getResource() returns the path to the resource');
5757
}
5858

5959
public function testGetPattern()
@@ -166,7 +166,7 @@ public function testSerializeUnserialize()
166166

167167
$unserialized = unserialize(serialize($resource));
168168

169-
$this->assertSame($this->directory, $resource->getResource());
169+
$this->assertSame(realpath($this->directory), $resource->getResource());
170170
$this->assertSame('/\.(foo|xml)$/', $resource->getPattern());
171171
}
172172

0 commit comments

Comments
 (0)