Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / symfony / filesystem / Tests / LockHandlerTest.php
index 0791cebc694b84d7172fe30c45f3de87a75b9877..14eabc021edb5f055b93b61b9ead9d126c7f6b14 100644 (file)
@@ -16,6 +16,9 @@ use Symfony\Component\Filesystem\Exception\IOException;
 use Symfony\Component\Filesystem\Filesystem;
 use Symfony\Component\Filesystem\LockHandler;
 
+/**
+ * @group legacy
+ */
 class LockHandlerTest extends TestCase
 {
     /**
@@ -45,11 +48,15 @@ class LockHandlerTest extends TestCase
     public function testErrorHandlingInLockIfLockPathBecomesUnwritable()
     {
         // skip test on Windows; PHP can't easily set file as unreadable on Windows
-        if ('\\' === DIRECTORY_SEPARATOR) {
+        if ('\\' === \DIRECTORY_SEPARATOR) {
             $this->markTestSkipped('This test cannot run on Windows.');
         }
 
-        $lockPath = sys_get_temp_dir().'/'.uniqid();
+        if (!getenv('USER') || 'root' === getenv('USER')) {
+            $this->markTestSkipped('This test will fail if run under superuser');
+        }
+
+        $lockPath = sys_get_temp_dir().'/'.uniqid('', true);
         $e = null;
         $wrongMessage = null;
 
@@ -76,7 +83,7 @@ class LockHandlerTest extends TestCase
             $fs->remove($lockPath);
         }
 
-        $this->assertInstanceOf('Symfony\Component\Filesystem\Exception\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', get_class($e)));
+        $this->assertInstanceOf('Symfony\Component\Filesystem\Exception\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', \get_class($e)));
         $this->assertNull($wrongMessage, sprintf('Expected exception message to contain "Permission denied", got "%s" instead.', $wrongMessage));
     }