-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-bootstrap.php
33 lines (23 loc) · 965 Bytes
/
test-bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
$lockFile = sys_get_temp_dir() . '/phpUnit' . sha1(__DIR__);
$fh = fopen($lockFile, 'w+');
echo "Waiting for lock ($lockFile)...\n";
flock($fh, LOCK_EX);
$testPackages = getenv('TEST_PACKAGES');
echo "Update dependencies before testing\n";
$output = [];
if (trim($testPackages)) {
echo "Requiring $testPackages\n";
copy(__DIR__ . '/composer.json', __DIR__ . '/composer-test.json');
exec("cd '" . __DIR__ . "' && export COMPOSER=\"composer-test.json\" && composer require --no-interaction --with-all-dependencies $testPackages && composer dump-autoload --no-interaction", $output, $returnVar);
}
else {
echo "Using default composer.json\n";
exec("cd '" . __DIR__ . "' && composer update --with-all-dependencies && composer dump-autoload", $output, $returnVar);
}
echo implode("\n", $output) . "\n";
if ($returnVar !== 0) {
echo "Updating dependencies failed\n";
die(1);
}
return require __DIR__ . '/vendor/autoload.php';