From 17fd14b532662814af6d9333ae953710c9001360 Mon Sep 17 00:00:00 2001 From: Guilherme Blanco Date: Mon, 4 May 2020 18:04:15 -0400 Subject: [PATCH] Update tests/Functional/ExceptionTest.php Co-authored-by: Gabriel Caruso --- tests/Functional/ExceptionTest.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/Functional/ExceptionTest.php b/tests/Functional/ExceptionTest.php index 987e8d781b5..b09148cd7cf 100644 --- a/tests/Functional/ExceptionTest.php +++ b/tests/Functional/ExceptionTest.php @@ -20,7 +20,6 @@ use function chmod; use function exec; use function file_exists; -use function in_array; use function posix_geteuid; use function posix_getpwuid; use function sprintf; @@ -29,7 +28,7 @@ use function unlink; use function version_compare; -use const PHP_OS; +use const PHP_OS_FAMILY; class ExceptionTest extends FunctionalTestCase { @@ -310,7 +309,7 @@ public function testConnectionExceptionSqLite(): void } // mode 0 is considered read-only on Windows - $mode = in_array(PHP_OS, ['Linux', 'Darwin']) ? 0444 : 0000; + $mode = PHP_OS_FAMILY !== 'Windows' ? 0444 : 0000; $filename = sprintf('%s/%s', sys_get_temp_dir(), 'doctrine_failed_connection_' . $mode . '.db'); @@ -435,7 +434,7 @@ private function tearDownForeignKeyConstraintViolationExceptionTest(): void private function isLinuxRoot(): bool { - return PHP_OS === 'Linux' && posix_getpwuid(posix_geteuid())['name'] === 'root'; + return PHP_OS_FAMILY !== 'Windows' && posix_getpwuid(posix_geteuid())['name'] === 'root'; } private function cleanupReadOnlyFile(string $filename): void