From a6edd781169fb8fe33603b1aa72bc1874428df8f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 10 Mar 2016 15:31:39 +0100 Subject: [PATCH] [Filesystem] Fix transient tests --- .../Component/ClassLoader/Tests/ClassMapGeneratorTest.php | 2 +- src/Symfony/Component/Filesystem/Tests/FilesystemTest.php | 2 +- .../Tests/DateFormatter/AbstractIntlDateFormatterTest.php | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php index 7bdf5aa0dc..45ed15b180 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php @@ -22,7 +22,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase public function prepare_workspace() { - $this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().mt_rand(0, 1000); + $this->workspace = sys_get_temp_dir().'/'.microtime(true).'.'.mt_rand(); mkdir($this->workspace, 0777, true); $this->workspace = realpath($this->workspace); } diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index ff27f4cebc..d4129dce3a 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -48,7 +48,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase { $this->umask = umask(0); $this->filesystem = new Filesystem(); - $this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().mt_rand(0, 1000); + $this->workspace = sys_get_temp_dir().'/'.microtime(true).'.'.mt_rand(); mkdir($this->workspace, 0777, true); $this->workspace = realpath($this->workspace); } diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php index 3f7dcfd32d..071889de65 100644 --- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php @@ -414,7 +414,10 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase public function testFormatWithIntlTimeZone() { - if (PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) { + if (!extension_loaded('intl')) { + $this->markTestSkipped('Extension intl is required.'); + } + if (PHP_VERSION_ID < 50500 && !method_exists('IntlDateFormatter', 'setTimeZone')) { $this->markTestSkipped('Only in PHP 5.5+ IntlDateFormatter allows to use DateTimeZone objects.'); }