Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / config / Tests / Resource / DirectoryResourceTest.php
index 60bd616a41de5d842c4a4fb99a72c4ef2c560f71..99c75f1047576216dd963abc92f2c012ff391fc2 100644 (file)
@@ -54,22 +54,36 @@ class DirectoryResourceTest extends TestCase
     public function testGetResource()
     {
         $resource = new DirectoryResource($this->directory);
-        $this->assertSame($this->directory, $resource->getResource(), '->getResource() returns the path to the resource');
+        $this->assertSame(realpath($this->directory), $resource->getResource(), '->getResource() returns the path to the resource');
     }
 
     public function testGetPattern()
     {
-        $resource = new DirectoryResource('foo', 'bar');
+        $resource = new DirectoryResource($this->directory, 'bar');
         $this->assertEquals('bar', $resource->getPattern());
     }
 
+    /**
+     * @expectedException \InvalidArgumentException
+     * @expectedExceptionMessageRegExp /The directory ".*" does not exist./
+     */
+    public function testResourceDoesNotExist()
+    {
+        $resource = new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999));
+    }
+
     public function testIsFresh()
     {
         $resource = new DirectoryResource($this->directory);
         $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if the resource has not changed');
         $this->assertFalse($resource->isFresh(time() - 86400), '->isFresh() returns false if the resource has been updated');
+    }
+
+    public function testIsFreshForDeletedResources()
+    {
+        $resource = new DirectoryResource($this->directory);
+        $this->removeDirectory($this->directory);
 
-        $resource = new DirectoryResource('/____foo/foobar'.mt_rand(1, 999999));
         $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the resource does not exist');
     }
 
@@ -155,7 +169,7 @@ class DirectoryResourceTest extends TestCase
 
         $unserialized = unserialize(serialize($resource));
 
-        $this->assertSame($this->directory, $resource->getResource());
+        $this->assertSame(realpath($this->directory), $resource->getResource());
         $this->assertSame('/\.(foo|xml)$/', $resource->getPattern());
     }