Skip to content

Commit 47bc7fb

Browse files
committed
Fix tests bootstrap
1 parent 44076f6 commit 47bc7fb

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

tests/bootstrap.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@
66
require_once $projectRoot . '/vendor/autoload.php';
77

88
// Symlink module into ssp vendor lib so that templates and urls can resolve correctly
9-
$linkPath = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules/oidc';
10-
if (false === file_exists($linkPath)) {
11-
echo "Linking '$linkPath' to '$projectRoot'\n";
12-
symlink($projectRoot, $linkPath);
13-
} else {
14-
echo "'$linkPath' linked to '$projectRoot'\n";
9+
$modulesDir = $projectRoot . '/vendor/simplesamlphp/simplesamlphp/modules';
10+
$linkPath = $modulesDir . '/oidc';
11+
$target = '../../../../';
12+
13+
if (!is_dir($modulesDir)) {
14+
mkdir($modulesDir, 0777, true);
15+
}
16+
17+
if (is_link($linkPath)) {
18+
if (!file_exists($linkPath) || (readlink($linkPath) !== $target && realpath($linkPath) !== $projectRoot)) {
19+
unlink($linkPath);
20+
symlink($target, $linkPath);
21+
echo "Re-linking '$linkPath' to '$target'\n";
22+
} else {
23+
echo "'$linkPath' linked to '$projectRoot'\n";
24+
}
25+
} elseif (!file_exists($linkPath)) {
26+
echo "Linking '$linkPath' to '$target'\n";
27+
symlink($target, $linkPath);
1528
}

0 commit comments

Comments
 (0)