Skip to content

Commit

Permalink
Merge pull request #7009 from rarila/fix-symlink-test-error
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Nov 27, 2021
2 parents eb31ef3 + 2e56fca commit 7660dc2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/Config/ConfigTest.php
Expand Up @@ -20,6 +20,7 @@
use function get_class;
use function getcwd;
use function implode;
use function in_array;
use function is_array;
use function preg_match;
use function realpath;
Expand Down Expand Up @@ -144,20 +145,23 @@ public function testIgnoreSymlinkedProjectDirectory(): void
{
@unlink(dirname(__DIR__, 1) . '/fixtures/symlinktest/ignored/b');

$no_symlinking_error = 'symlink(): Cannot create symlink, error code(1314)';
$no_symlinking_error = [
'symlink(): Cannot create symlink, error code(1314)',
'symlink(): Permission denied',
];
$last_error = error_get_last();
$check_symlink_error =
!is_array($last_error) ||
!isset($last_error['message']) ||
$no_symlinking_error !== $last_error['message'];
!in_array($last_error['message'], $no_symlinking_error);

@symlink(dirname(__DIR__, 1) . '/fixtures/symlinktest/a', dirname(__DIR__, 1) . '/fixtures/symlinktest/ignored/b');

if ($check_symlink_error) {
$last_error = error_get_last();

if (is_array($last_error) && $no_symlinking_error === $last_error['message']) {
$this->markTestSkipped($no_symlinking_error);
if (is_array($last_error) && in_array($last_error['message'], $no_symlinking_error)) {
$this->markTestSkipped($last_error['message']);
}
}

Expand Down

0 comments on commit 7660dc2

Please sign in to comment.