diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-01-29 21:50:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-29 21:50:31 +0300 |
commit | 339450a1e49ca3aebfe2824aa5f0153360101cd0 (patch) | |
tree | 652c19a013ef23d45d1e6eb19b26725a237931f3 /plugins/TestRunner | |
parent | ae0d7185cee2f73f053c0bb546e9054e6fe183f1 (diff) |
Make sure test fixture symlinks are created correctly (#12515)
Diffstat (limited to 'plugins/TestRunner')
-rw-r--r-- | plugins/TestRunner/Commands/TestsSetupFixture.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/TestRunner/Commands/TestsSetupFixture.php b/plugins/TestRunner/Commands/TestsSetupFixture.php index 565a81122a..9e6a541e1e 100644 --- a/plugins/TestRunner/Commands/TestsSetupFixture.php +++ b/plugins/TestRunner/Commands/TestsSetupFixture.php @@ -157,7 +157,13 @@ class TestsSetupFixture extends ConsoleCommand foreach (array('libs', 'plugins', 'tests', 'misc', 'piwik.js') as $linkName) { $linkPath = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/' . $linkName; if (!file_exists($linkPath)) { - symlink(PIWIK_INCLUDE_PATH . '/' . $linkName, $linkPath); + $success = @symlink($target, $linkPath); + // setting symlink might fail when the symlink already exists but pointing to a no longer existing path/file + // eg when sometimes running it on a VM and sometimes on the VM's host itself. + if (!$success) { + unlink($target); + symlink($target, $linkPath); + } } } } |