Skip to content

Commit

Permalink
Update tests/Functional/ExceptionTest.php
Browse files Browse the repository at this point in the history
Co-authored-by: Gabriel Caruso <[email protected]>
  • Loading branch information
2 people authored and morozov committed Aug 28, 2020
1 parent 30372a0 commit 17fd14b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/Functional/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,7 +28,7 @@
use function unlink;
use function version_compare;

use const PHP_OS;
use const PHP_OS_FAMILY;

class ExceptionTest extends FunctionalTestCase
{
Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 17fd14b

Please sign in to comment.